Repository navigation
rgw: avoid dangling DoutPrefixProvider in RGWOwnerStatsCache - #70583
Conversation
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
16 similar comments
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
0fc7595 to
5251862
Compare
5251862 to
b879270
Compare
|
ok-to-test |
1 similar comment
|
ok-to-test |
|
compilation failure from https://jenkins.ceph.com/job/ceph-pr-pipeline/826/stages/?selected-node=50 |
RGWOwnerStatsCache stores the DoutPrefixProvider* passed to its constructor as a member and dereferences it later in init_refresh(). When the store is recreated by RGWRealmReloader::reload(), that pointer is &dp, a stack-local DoutPrefix in reload()'s frame; once reload() returns the member dangles and the next async owner-quota refresh dereferences it (use-after-free). Normal startup is unaffected because its dp lives in a frame that never returns. The sibling RGWBucketStatsCache already avoids this by not storing dpp and constructing a local DoutPrefix in init_refresh(). Mirror that for RGWOwnerStatsCache and drop the now-unused dpp parameter from generate_handler() and its callers. Signed-off-by: dengjie <[email protected]>
b879270 to
4c8a515
Compare
|
Fixed the compilation failure in 4c8a515. The affected RGW targets also compile locally with -Werror. Could a Ceph developer please re-approve CI? Thanks! |
|
This PR has been added to main integration testing by anuchaithra started 2026-09-10-10:12. |
Pr testing completed and approved by @ivancich, more details : https://tracker.ceph.com/issues/80444. |
|
This is an automated message by src/script/redmine-upkeep.py. I have resolved the following tracker ticket due to the merge of this PR: No backports are pending for the ticket. If this is incorrect, please update the tracker |
…ling-dpp rgw: avoid dangling DoutPrefixProvider in RGWOwnerStatsCache Reviewed-by: Casey Bodley <[email protected]>
Problem
RGWOwnerStatsCachestores theDoutPrefixProvider*passed to its constructor as a member, then dereferences it later ininit_refresh()vialdpp_dout()/driver->load_stats_async().When the store is recreated by
RGWRealmReloader::reload(), that pointer is&dp— a stack-localDoutPrefixinreload()'s frame (src/rgw/rgw_realm_reloader.cc). Oncereload()returns, the member dangles, and the next async owner-quota refresh dereferences it (use-after-free).Normal startup is unaffected because its
dplives in a frame that never returns (rgw_appmain.cc), so this only manifests after a realm period reload.Call chain that carries the stack pointer into the heap member:
Fix
The sibling
RGWBucketStatsCachealready avoids this by not storingdppand constructing a localDoutPrefixininit_refresh(). Mirror that forRGWOwnerStatsCache, and drop the now-unuseddppparameter fromRGWQuotaHandler::generate_handler()and its two callers.Changes:
src/rgw/rgw_quota.cc—RGWOwnerStatsCache: remove thedppmember; removedppfrom the constructor;init_refresh()builds a localconst DoutPrefix dp(driver->ctx(), dout_subsys, ...); propagate the removal throughRGWQuotaHandlerImplandgenerate_handler().src/rgw/rgw_quota.h— dropdppfrom thegenerate_handler()declaration.src/rgw/driver/rados/rgw_rados.cc,src/rgw/driver/posix/rgw_sal_posix.cc— update the two call sites.No new allocations, threads, or lifetime changes — purely replacing the dangling pointer with an always-valid local object (the cache outlives any single request, and
driver->ctx()is valid for the cache's whole lifetime).Reproducer (optional, not included): build radosgw with
-fsanitize=address, configure a realm,radosgw-admin period committo force a reload, then enable owner/bucket quota and generate stats activity to trigger an async refresh; ASAN reportsheap-use-after-freeinRGWOwnerStatsCache::init_refresh().Signed-off-by: dengjie [email protected]
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