Skip to content

mgr: Fix use-after-free in MgrOpRequest cleanup - #63989

Closed
pdvian wants to merge 1 commit into
ceph:mainfrom
pdvian:wip-mgr-crash
Closed

pdvian wants to merge 1 commit into
ceph:mainfrom
pdvian:wip-mgr-crash

Conversation

@pdvian

@pdvian pdvian commented Jun 18, 2025 •

Copy link
Copy Markdown
Contributor

This fix addresses a critical use-after-free bug that causing the Ceph Manager daemon to crash during MgrOpRequest cleanup.

It consistently occurred within the OpHistoryServiceThread when processing MgrOpRequest objects. The backtrace indicated an assertion failure (ceph_assert(nref == 0)) inside ~RefCountedObject, specifically triggered when an MMgrCommand was being destructed.

Fixes: https://tracker.ceph.com/issues/68683

Signed-off-by: Prashant D [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 x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

This fix addresses a critical use-after-free bug that causing the
Ceph Manager daemon to crash during MgrOpRequest cleanup.

It consistently occurred within the OpHistoryServiceThread when
processing MgrOpRequest objects. The backtrace indicated an assertion
failure (ceph_assert(nref == 0)) inside ~RefCountedObject, specifically
triggered when an MMgrCommand was being destructed.

Fixes: https://tracker.ceph.com/issues/68683

Signed-off-by: Prashant D <[email protected]>
@pdvian
pdvian requested a review from a team as a code owner June 18, 2025 05:38
@pdvian
pdvian requested a review from rzarzynski June 18, 2025 05:38
Comment thread src/mgr/MgrOpRequest.h

public:
~MgrOpRequest() override {
request->put();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, it looks the intention was rather request.reset() or, as this patch proposes, to delegate the cleaning to the destructor of the request itself.

nit: can we have ~MgrOpRequest defaulted (= default)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review. Yes. We can do that.

@batrick

batrick commented Jun 24, 2025

Copy link
Copy Markdown
Member

dup of #62445

@pdvian

pdvian commented Jun 25, 2025

Copy link
Copy Markdown
Contributor Author

@rzarzynski Should I close this PR as a duplicate of #62445 or should I update this PR to have ~MgrOpRequest defaulted (= default) ?

@batrick batrick left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DNM

@rzarzynski

Copy link
Copy Markdown
Contributor

@pdvian, @batrick: let's close this one; the other, older PR got merged.
We can refactor as a follow-up.

@rzarzynski rzarzynski closed this Jun 28, 2025
ProxBot pushed a commit to proxmox/ceph that referenced this pull request Dec 17, 2025
This change was cherry-picked 941c5eda, which was included in an
upstream pull request at ceph/ceph#63989 .

Without this change, ceph-mgr could crash when serving a ceph mgr
command.

Fixes: #6568
Signed-off-by: Kefu Chai <[email protected]>
Link: https://lore.proxmox.com/[email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants