Repository navigation
[DNM] macos: record the process tree with the kernel trace facility - #34
Draft
LalitMaganti wants to merge 1 commit into
Draft
LalitMaganti wants to merge 1 commit into
LalitMaganti wants to merge 1 commit into
Conversation
LalitMaganti
force-pushed
the
readme-rationalize
branch
from
September 16, 2026 13:10
157d35e to
e02f44b
Compare
LalitMaganti
force-pushed
the
macos-record-1
branch
from
September 16, 2026 13:10
b577062 to
d051f45
Compare
LalitMaganti
force-pushed
the
readme-rationalize
branch
from
September 16, 2026 13:16
e02f44b to
b8ace94
Compare
LalitMaganti
force-pushed
the
macos-record-1
branch
from
September 16, 2026 13:17
d051f45 to
4c84307
Compare
LalitMaganti
force-pushed
the
readme-rationalize
branch
from
September 16, 2026 13:19
b8ace94 to
9d0fe70
Compare
LalitMaganti
force-pushed
the
macos-record-1
branch
from
September 16, 2026 13:19
4c84307 to
87cfaf8
Compare
LalitMaganti
force-pushed
the
readme-rationalize
branch
from
September 16, 2026 13:21
9d0fe70 to
bd146a6
Compare
LalitMaganti
force-pushed
the
macos-record-1
branch
from
September 16, 2026 13:22
87cfaf8 to
704bcd7
Compare
LalitMaganti
force-pushed
the
readme-rationalize
branch
from
September 16, 2026 13:25
bd146a6 to
5fa2ac5
Compare
LalitMaganti
force-pushed
the
macos-record-1
branch
from
September 16, 2026 13:25
704bcd7 to
5eee0e7
Compare
macOS has no unprivileged way to follow a process tree. Configuring the kernel trace facility needs root, but the kernel keeps granting access to the process that owns a session, so recording is privileged only while it starts: configure the session, give up root for good, then run the build, read events and write the trace as the person who ran it. This records the process tree: which process started which, what program each ran, and how each exited. The kernel also reports an exit when a process replaces its image, so an exit is held briefly and cancelled by anything further from that pid. Command lines, file events and compiler traces follow.
LalitMaganti
force-pushed
the
macos-record-1
branch
from
September 16, 2026 13:31
5eee0e7 to
6b01c53
Compare
LalitMaganti
force-pushed
the
readme-rationalize
branch
from
September 16, 2026 13:31
5fa2ac5 to
b62b296
Compare
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.
Prototype for #2, step 1 of 6, on top of #33. Do not merge; the design is still TBD.
Records the process tree on macOS by reading the kernel trace facility. Starting a trace session needs root, but access is granted to the owning process and survives dropping privileges, so buildprof is privileged only while it starts: it configures the session, gives up root for good, then runs the build, reads events and writes the trace as you. The build does not run as root and keeps your environment.
This step records which process started which, what program each ran, and how each exited. Command lines, file events and compiler traces follow in the rest of the stack.
Verified on macOS 26: records a 23-process build and propagates its exit status.