Skip to content

squid: journal/ObjectPlayer: don't acquire locks in destructor - #70014

Merged
batrick merged 1 commit into
ceph:squidfrom
tchaikov:wip-77523-squid
Jul 27, 2026
Merged

batrick merged 1 commit into
ceph:squidfrom
tchaikov:wip-77523-squid

Conversation

@tchaikov

@tchaikov tchaikov commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

~ObjectPlayer took m_timer_lock only to assert two invariants. but that
lock is borrowed by reference from the caller's SafeTimer, and an
ObjectPlayer can outlive it: a C_Fetch/C_WatchFetch completion on the
librados finisher may hold the last reference and run ~ObjectPlayer after
the timer and its lock are already gone. re-taking the freed lock is a
heap-use-after-free, which unittest_journal hits on arm64 under ASan:

  ==ERROR: AddressSanitizer: heap-use-after-free
    journal::ObjectPlayer::~ObjectPlayer  ObjectPlayer.cc:63
    journal::ObjectPlayer::C_WatchFetch::~C_WatchFetch
    journal::ObjectPlayer::C_Fetch::finish

the lock isn't needed though: at refcount 0 the watch has been cancelled
(m_watch_ctx == nullptr, asserted below) so no timer task references us, and
no fetch is in flight since a pending fetch holds a reference. nothing else
can touch our state. Furthermore, we can also skip acquiring `m_lock` as
well, because, in the destructor, it shouldn't really matter -- if one
of these asserts fails because the execution of the destructor races
with some `ObjectPlayer` mthod, we would get what the `assert()` was
added for. They are here to catch bugs and such a race just being
possible is a bug in itself.

Fixes: https://tracker.ceph.com/issues/77496
Signed-off-by: Kefu Chai <[email protected]>
(cherry picked from commit a35a926)
@tchaikov
tchaikov requested a review from a team as a code owner July 8, 2026 00:45
@tchaikov tchaikov added this to the squid milestone Jul 8, 2026
@github-actions github-actions Bot added rbd releng-audit-pass Release engineering: passed backport verification audit. labels Jul 8, 2026
@yuriw

yuriw commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to wip-yuri2-testing-20260713.172617-squid.

@idryomov idryomov modified the milestones: squid, v19.2.6 Jul 20, 2026
@batrick
batrick merged commit a3cd6cf into ceph:squid Jul 27, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-qa rbd releng-audit-pass Release engineering: passed backport verification audit. wip-yuri2-testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants