Repository navigation
Conversation
rr marked an exiting task's robust futexes FUTEX_OWNER_DIED itself at PTRACE_EVENT_EXIT, so the kernel no longer found the task's tid in them and didn't wake their waiters, which blocked forever. When we wait for the task to exit, the kernel's writes can't race with other tracees, so leave them to the kernel, as for the child tid. Replay still makes the writes rr records, so record what the kernel writes: handle list_op_pending last, and also stop at an entry or futex the kernel can't access and at a misaligned futex. Tests: robust_futex_owner_died, robust_futex_owner_died_thread, robust_futex_walk. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keno
commented
Nov 18, 2026
| // futexes' waiters. Otherwise make the writes now so that the kernel doesn't | ||
| // make them later, at a time that might race with other tracee execution. | ||
| for (auto& w : robust_futex_writes) { | ||
| if (!may_wait_exit) { |
Member
Author
There was a problem hiding this comment.
The pid namespace case here will be fixed in a separate PR, but it's a bit more complicated and needs a separate test, so I pulled it out of this one.
rocallahan
reviewed
Nov 20, 2026
| record_robust_futex_change<Arch>(t, head, current); | ||
| auto next = t->read_mem(current, &ok); | ||
| // The kernel reads the next entry before it handles this one, and it | ||
| // handles the pending futex, which may be on the list, last. |
Collaborator
There was a problem hiding this comment.
This seems pretty fragile, right? This behaviour could change and then we'd presumably have a bug in super weird edge cases. But maybe there's nothing we can do about it.
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.
[Part 3 of the futex series. Encountered, debugged, patch, test by AI. Note that in reviewing this I've found a couple more corner cases that will be separate PRs, so there's probably 2 more PRs in this series]
When a task exits holding a robust futex, the kernel marks it FUTEX_OWNER_DIED and wakes a waiter. rr marked the futexes itself at PTRACE_EVENT_EXIT, so the kernel no longer found the task's tid in them and didn't wake the waiter, which then blocked forever. When we wait for the task to exit, the kernel's writes can't race with other tracees, so leave them to the kernel, as for the child tid.
Tests: robust_futex_owner_died, robust_futex_owner_died_thread, robust_futex_walk.