Repository navigation
Conversation
Process Activity covered only the processes the runtime starts itself: the entrypoint and each exec or SSH session. Anything those processes ran, a shell's commands or an agent's tools, left no record of starting or finishing. The workload's seccomp listener now also receives execve and execveat. When the ocsf_process_exec_enabled setting is on, the runtime records each exec of an existing executable file before letting it proceed: the caller's pid, parent pid, and start time, the executable, and the executables of the caller before the exec and of its parent. The file is looked up on a dedicated thread so a slow filesystem cannot stall the broker. The supervisor applies the setting through ReadProcessEvents, which runtimes advertising openshell.sandbox.process-exec-events honor; a read sent before the setting is known leaves the runtime's choice as it is. Each exec becomes a Process Activity Launch with launch type Exec and an Unknown outcome, because the kernel has not run it yet. When the runtime records an exec, it opens a pidfd for the caller while the caller is still blocked in the exec, so the descriptor names that process even after its pid is reused. An exit observer thread polls those descriptors and records each exit under the process's last executable, with its wait status from PIDFD_GET_INFO on kernels that keep it, or from procfs while the process is still a zombie. Processes the runtime waits for itself are left to it; orphans it adopts are watched. The supervisor emits each exit as a Process Activity Terminate whose actor is the process itself, with exit_code when the status was read and an Unknown status otherwise. Execs over a rate of 500 at once and 200 per second are counted rather than recorded, as are processes beyond the exit observer's limit of a quarter of the runtime's open-file limit, at most 1024. The count is reported at most once per second as a Process Activity record with its number in count; events the runtime evicted before a supervisor that had already been reading read them are reported the same way. A process that forks without exec has no record. An exec that fails for a reason other than a missing or non-executable file is still recorded, and the record names the file the request named when it was observed. On kernels before 6.15 the exit status is known only when the runtime reads it before the parent reaps the process. Refs #4268 Signed-off-by: Kris Hicks <[email protected]>
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
This was referenced Nov 4, 2026
2 of 10 tasks
2 of 8 tasks
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.
Summary
Process Activity covered only the processes the runtime starts itself, so anything those processes ran (a shell's commands, an agent's tools) left no record. With
ocsf_process_exec_enabledon, the runtime records every exec in the workload through the seccomp listener and the exit of each recorded process through a pidfd, and the supervisor emits them as Process Activity Launch and Terminate.Third of a stack of four for #4268 (based on #5252):
Related Issue
Refs #4268
Changes
execveandexecveat. When exec recording is on, the runtime records each exec of an existing executable before letting it proceed: pid, parent pid, start time, the executable, and the executables of the caller before the exec and of its parent. File lookups run on a dedicated thread with a bounded queue, so a slow mount can't stall the broker. A full queue lets the exec continue and counts it as suppressed.PIDFD_GET_INFO/PIDFD_INFO_EXIT(kernel 6.15+) or from procfs while the process is still a zombie. Orphans adopted by the subreaper runtime are watched; processes the runtime waits for itself are left to the session path.exit_codewhen the status was read and Unknown status otherwise.count. Events evicted before a reading supervisor reached them are reported the same way.ReadProcessEvents.executionsis anoptional bool. The supervisor leaves it unset until the gateway setting has been applied, so a replacement supervisor doesn't switch recording off. New capability:openshell.sandbox.process-exec-events.ocsf_process_exec_enabled; docs indocs/observability/ocsf-json-export.mdx.Setting:
Before (setting on, previous PR): only session Launch/Terminate;
/bin/true,/bin/sleep, and an 800-exec burst don't appear.After (Docker Desktop, kernel 7.0):
Totals: 575 Exec Launches and 574 Terminates, all with an
exit_code. Terminate joins its Launch on pid +created_time.Known limitations:
-.Release Notes
Set
ocsf_process_exec_enabledto record every program a sandboxed workload runs, and its exit code, as OCSF Process Activity events.Testing
rust:format:check, and every CI clippy invocation (--locked, including perf-harness) pass on macOS and the aarch64 Linux target for this commit/proc/selfresolution); sandbox, sandbox-backend, and supervisor suites pass in an Ubuntu 24.04 guest (kernel 6.8)Checklist