Skip to content

Keep a forked child's rr buffers where its parent's were - #4159

Merged
rocallahan merged 1 commit into
rr-debugger:masterfrom
ChronitonAI:fork-scratch-dontfork
Nov 19, 2026
Merged

rocallahan merged 1 commit into
rr-debugger:masterfrom
ChronitonAI:fork-scratch-dontfork

Conversation

@Keno

@Keno Keno commented Nov 17, 2026

Copy link
Copy Markdown
Member

[This fixes intermittent CI failures in madvise tests on master. It additionally stops previous rr mappings from leaking in forked children, which is a minor cleanup. However, to do this properly, we need to change the replay logic for these mappings, requiring a FORWARD_COMPATIBILITY_VERSION. I do think this is better, but if that bump is undesirable, we could relax the tests instead of fix the intermittent failure. Patch by AI after debugging the intermittent CI failure]

A forked child starts with a copy of its parent's address space, including the parent's scratch memory and syscall buffer. rr mapped new ones for the child elsewhere, and they could land in a range the parent had marked MADV_DONTFORK, which the child expects to be unmapped (madvise_dontfork failed intermittently). Now the child uses the copied scratch memory, in recording and replay, and maps its syscall buffer over the copied one.

Older rr can't replay such traces: it maps new memory over the copied scratch memory, which the child may be running on (e.g. after a fork in the syscall hook). So bump FORWARD_COMPATIBILITY_VERSION, and add a trace quirk so that rr replays older traces as before.

A forked child starts with a copy of its parent's address space,
including the parent's scratch memory and syscall buffer. rr mapped new
ones for the child elsewhere, and they could land in a range the parent
had marked MADV_DONTFORK, which the child expects to be unmapped
(madvise_dontfork failed intermittently). Now the child uses the copied
scratch memory, in recording and replay, and maps its syscall buffer
over the copied one.

Older rr can't replay such traces: it maps new memory over the copied
scratch memory, which the child may be running on (e.g. after a fork
in the syscall hook). So bump FORWARD_COMPATIBILITY_VERSION, and add a
trace quirk so that rr replays older traces as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rocallahan
rocallahan merged commit 608efe3 into rr-debugger:master Nov 19, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants