Cyber: prevent queued timer callback use-after-free - #15814
Open
timothyanderson096-ocdealcheck wants to merge 1 commit into
Open
Conversation
Queue a weak TimerTask reference so callbacks discarded by Timer::Stop() cannot outlive their owning task. Add queued-callback and mutable callback state regressions. Fixes ApolloAuto#15810
Contributor
|
这是来自QQ邮箱的自动回复邮件。您好,您的邮件我已经收到。我会尽快给您回复。
谢谢。
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TimerTaskreferenceTimer::Stop()has already destroyed the taskRationale
Capturing a strong task reference would keep a stopped timer alive, while copying the callback would change stateful periodic-callback semantics. Locking a weak task reference at execution time avoids the reported use-after-free without either behaviour change.
Testing
TimerConcurrencyTest.stop_before_queued_callback_runsTimerTest.periodic_callback_preserves_stategit diff --checkThe Apollo Bazel target could not be run locally because the Apollo development container/toolchain was unavailable. Repository CI will provide the project-level build and test result.
Fixes #15810