Repository navigation
Conversation
Between a PTRACE_EVENT_EXEC stop and post_exec(), will_schedule() could write the CPU number to the old image's rseq area, which may now be ld.so text (exec_from_other_thread-32 crashed that way in CI). Call post_exec() in record_step() as soon as the scheduler has collected an exec stop, before will_schedule(). If the stop came for the old thread-group leader, which another thread's exec killed, retire the leader there first, recording its exit if we hadn't handled it, and take the thread that exec'd instead. Tell the two apart by whether the task is in an execve: with an emulated ptracer that hasn't reaped a killed thread yet, the thread group can still have other tasks when the exec stop comes. post_exec() copes with a task that died since its stop. Test: exec_rseq, exec_leader_exit_race, ptrace_exec_multithreaded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
[AI debug of intermittent CI failure - this has gone through a number of variations on where exactly to put this since the state changes are a bit tricky - part of a sequence of 4 patches to fix various issues with exec handling - otherwise patch/test by AI]
Between a PTRACE_EVENT_EXEC stop and post_exec(), will_schedule() could write the CPU number to the old image's rseq area, which may now be ld.so text (exec_from_other_thread-32 crashed that way in CI). Call post_exec() in record_step() as soon as the scheduler has collected an exec stop, before will_schedule(). If the stop came for the old thread-group leader, which another thread's exec killed, retire the leader there first, recording its exit if we hadn't handled it, and take the thread that exec'd instead. Tell the two apart by whether the task is in an execve: with an emulated ptracer that hasn't reaped a killed thread yet, the thread group can still have other tasks when the exec stop comes. post_exec() copes with a task that died since its stop.
Test: exec_rseq, exec_leader_exit_race, ptrace_exec_multithreaded.