Repository navigation
osd: fix UBSan shift overflow in pg_pool_t::calc_pg_masks - #67458
Conversation
|
This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days. |
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
fd58ada to
c0469b6
Compare
c0469b6 to
c692eb9
Compare
|
@tchaikov thank you for review. could you take a second look? |
|
@tchaikov could you take another look please? |
UBSan reports: shift exponent 32 is too large for 32-bit type 'int' When pg_num or pgp_num is 0, pg_num-1 wraps to UINT_MAX (unsigned), cbits() returns 32, and (1 << 32) on 32-bit int is undefined behavior. Use 1ULL for the shift so the expression is well-defined; for cbits() returning 32, (1ULL << 32) - 1 equals UINT_MAX. Signed-off-by: Alexander Indenbaum <[email protected]>
c692eb9 to
a964f35
Compare
|
This PR has been added to wip-bharath5-testing-20260804.033808-main. |
UBSan reports: shift exponent 32 is too large for 32-bit type 'int'
When pg_num or pgp_num is 0, pg_num-1 wraps to UINT_MAX (unsigned), cbits() returns 32, and (1 << 32) on 32-bit int is undefined behavior.
Fix: use 1ULL for the shift so the expression is well-defined; for cbits() returning 32, (1ULL << 32) - 1 equals UINT_MAX.
No unit test added: the bug is undefined behavior, not a deterministic wrong result — only UBSan reliably detects it.
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.