Skip to content

Commit 73a029a

Browse files
committed
Improve exec capture and process attribution
1 parent c04ebd1 commit 73a029a

6 files changed

Lines changed: 1143 additions & 102 deletions

File tree

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ latency / TTFT, or plaintext) / **where** (peer IP / hostname).
4343

4444
| signal | kernel hook | event |
4545
|---|---|---|
46-
| `exec` | `sys_enter_execve` | `ToolExec`tool / subprocess: **full argv** + cwd, comm, uid |
46+
| `exec` | `sys_enter_execve` + `sched_process_exec` | `ToolExec`bounded argv fragments, successful-exec confirmation, `/proc` supplementation + cwd, comm, uid |
4747
| `exit` | `do_exit` kprobe | `ProcessExit` — outcome: **exit code + signal** (clean / SIGSEGV crash / SIGKILL-OOM), one per process |
4848
| `connect` | `sys_enter_connect` | `Egress` — peer IP:port |
4949
| `sni` | TLS ClientHello (plaintext `server_name`) | LLM **provider** + endpoint |
@@ -71,12 +71,25 @@ agent action and should not be fed into security policy decisions.
7171
"ttft":{"secs":0,"nanos":410000000}}}}
7272
{"identity":{"agent":"python3","task":"1903","session":null},"provider":null,
7373
"event":{"ToolExec":{"pid":1903,"ppid":1841,
74-
"argv":["git","clone","https://github.com/acme/repo"],"cwd":"/home/agent/work"}}}
74+
"argv":["git","clone","https://github.com/acme/repo"],"argv_truncated":false,
75+
"argv_incomplete":false,"exec_confirmed":true,"argv_source":"kernel_fragments",
76+
"captured_argc":3,"captured_bytes":36,"observed_argc":3,"observed_bytes":36,
77+
"cwd":"/home/agent/work"}}}
7578
{"identity":{"agent":"python3","task":"1841","session":null},"provider":null,
7679
"event":{"SslContent":{"pid":1841,"is_read":false,
7780
"content":"POST /v1/messages HTTP/1.1\r\nHost: api.anthropic.com\r\n..."}}}
7881
```
7982

83+
`ToolExec.argv` is reconstructed in the collector from bounded 128-byte kernel records. The
84+
collector captures up to 12 arguments and roughly 8 KiB across argv. `argv_truncated=true` means
85+
the configured limit was reached; `argv_incomplete=true` means a chunk was lost or reassembly
86+
timed out. After `sched_process_exec` confirms a successful exec, the collector attempts to replace
87+
truncated/incomplete fragments with `/proc/<pid>/cmdline` (bounded to 2 MiB). `argv_source` states
88+
which source won and `exec_confirmed` distinguishes committed execs from failed attempts. Very
89+
short-lived processes can exit before `/proc` is read, so the explicit truncation/incomplete flags
90+
remain the authoritative evidence-quality signal. Neither condition is silent, and both counters
91+
are included in collector heartbeats.
92+
8093
Filter with `jq`, e.g. every LLM call and its provider:
8194
`… | jq -c 'select(.event.LlmCall) | {agent:.identity.agent, provider, sni:.event.LlmCall.sni}'`.
8295

0 commit comments

Comments
 (0)