Skip to content

Commit

Permalink
Add support to dump processLRU
Browse files Browse the repository at this point in the history
This patch adds support to print the contents of process cache. This may be useful during debugging.

Example:

$ sudo ./tetra dump processCache
{"process":{"exec_id":"YXBhcGFnLXVidW50dS1kZXY6MTAwNjgwMDAwMDAwOjE4OTg=", "pid":1898, "uid":1010, "cwd":"/home/apapag", "binary":"/home/apapag/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/node", "arguments":"--dns-result-order=ipv4first /home/apapag/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/out/bootstrap-fork --type=extensionHost --transformURIs --useHostProxy=false", "flags":"procFS auid", "start_time":"2024-09-05T07:00:23.274832687Z", "auid":1010, "parent_exec_id":"YXBhcGFnLXVidW50dS1kZXY6ODk5NTAwMDAwMDA6MTc3Ng==", "tid":1898}, "color":"inUse", "refcnt":5, "refcntOps":{"parent++":346, "parent--":342, "process++":1}}
{"process":{"exec_id":"YXBhcGFnLXVidW50dS1kZXY6MTU2OTQ0MDAwMDAwMDozMzM3OA==", "pid":33378, "uid":1010, "cwd":"/home/apapag/tetragon", "binary":"/usr/bin/bash", "flags":"procFS auid", "start_time":"2024-09-05T07:24:52.034832554Z", "auid":1010, "parent_exec_id":"YXBhcGFnLXVidW50dS1kZXY6MTU2OTIyMDAwMDAwMDozMzM3Nw==", "tid":33378}, "color":"inUse", "refcnt":2, "refcntOps":{"parent++":30, "parent--":29, "process++":1}}
{"process":{"exec_id":"YXBhcGFnLXVidW50dS1kZXY6Mjg1MjM2Nzc1Nzc4NDo1MjE1Mg==", "pid":52152, "uid":0, "cwd":"/home/apapag/tetragon", "binary":"/usr/bin/sudo", "arguments":"./tetra dump processCache --skip-zero-refcnt", "flags":"execve clone", "start_time":"2024-09-05T07:46:14.962590751Z", "auid":1010, "parent_exec_id":"YXBhcGFnLXVidW50dS1kZXY6MTU2OTQ0MDAwMDAwMDozMzM3OA==", "tid":52152}, "color":"inUse", "refcnt":2, "refcntOps":{"parent++":1, "process++":1}}
{"process":{"exec_id":"YXBhcGFnLXVidW50dS1kZXY6Mjg1MjM3NjMxOTI2OTo1MjE1NA==", "pid":52154, "uid":0, "cwd":"/home/apapag/tetragon", "binary":"/home/apapag/tetragon/tetra", "arguments":"dump processCache --skip-zero-refcnt", "flags":"execve clone", "start_time":"2024-09-05T07:46:14.971151996Z", "auid":1010, "parent_exec_id":"YXBhcGFnLXVidW50dS1kZXY6Mjg1MjM3NTU4MTQxMTo1MjE1Mw==", "tid":52154}, "color":"inUse", "refcnt":1, "refcntOps":{"process++":1}}
{"process":{"exec_id":"YXBhcGFnLXVidW50dS1kZXY6Mjg1MjM3NTU4MTQxMTo1MjE1Mw==", "pid":52153, "uid":0, "cwd":"/home/apapag/tetragon", "binary":"/usr/bin/sudo", "arguments":"./tetra dump processCache --skip-zero-refcnt", "flags":"execve", "start_time":"2024-09-05T07:46:14.970414578Z", "auid":1010, "parent_exec_id":"YXBhcGFnLXVidW50dS1kZXY6Mjg1MjM2Nzc1Nzc4NDo1MjE1Mg==", "refcnt":1, "tid":52153}, "color":"inUse", "refcnt":2, "refcntOps":{"parent++":2, "parent--":1, "process++":1}}
[...]

We also provide "--skip-zero-refcnt" command line argument to print only the entries with refcnt not equals to zero.

$ sudo ./tetra dump processCache --skip-zero-refcnt
{"process":{"exec_id":"YXBhcGFnLXVidW50dS1kZXY6MTAwNjgwMDAwMDAwOjE4OTg=", "pid":1898, "uid":1010, "cwd":"/home/apapag", "binary":"/home/apapag/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/node", "arguments":"--dns-result-order=ipv4first /home/apapag/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/out/bootstrap-fork --type=extensionHost --transformURIs --useHostProxy=false", "flags":"procFS auid", "start_time":"2024-09-05T07:00:23.274832687Z", "auid":1010, "parent_exec_id":"YXBhcGFnLXVidW50dS1kZXY6ODk5NTAwMDAwMDA6MTc3Ng==", "tid":1898}, "color":"inUse", "refcnt":5, "refcntOps":{"parent++":346, "parent--":342, "process++":1}}
{"process":{"exec_id":"YXBhcGFnLXVidW50dS1kZXY6MTU2OTQ0MDAwMDAwMDozMzM3OA==", "pid":33378, "uid":1010, "cwd":"/home/apapag/tetragon", "binary":"/usr/bin/bash", "flags":"procFS auid", "start_time":"2024-09-05T07:24:52.034832554Z", "auid":1010, "parent_exec_id":"YXBhcGFnLXVidW50dS1kZXY6MTU2OTIyMDAwMDAwMDozMzM3Nw==", "tid":33378}, "color":"inUse", "refcnt":2, "refcntOps":{"parent++":30, "parent--":29, "process++":1}}
{"process":{"exec_id":"YXBhcGFnLXVidW50dS1kZXY6Mjg1MjM2Nzc1Nzc4NDo1MjE1Mg==", "pid":52152, "uid":0, "cwd":"/home/apapag/tetragon", "binary":"/usr/bin/sudo", "arguments":"./tetra dump processCache --skip-zero-refcnt", "flags":"execve clone", "start_time":"2024-09-05T07:46:14.962590751Z", "auid":1010, "parent_exec_id":"YXBhcGFnLXVidW50dS1kZXY6MTU2OTQ0MDAwMDAwMDozMzM3OA==", "tid":52152}, "color":"inUse", "refcnt":2, "refcntOps":{"parent++":1, "process++":1}}
{"process":{"exec_id":"YXBhcGFnLXVidW50dS1kZXY6Mjg1MjM3NjMxOTI2OTo1MjE1NA==", "pid":52154, "uid":0, "cwd":"/home/apapag/tetragon", "binary":"/home/apapag/tetragon/tetra", "arguments":"dump processCache --skip-zero-refcnt", "flags":"execve clone", "start_time":"2024-09-05T07:46:14.971151996Z", "auid":1010, "parent_exec_id":"YXBhcGFnLXVidW50dS1kZXY6Mjg1MjM3NTU4MTQxMTo1MjE1Mw==", "tid":52154}, "color":"inUse", "refcnt":1, "refcntOps":{"process++":1}}
{"process":{"exec_id":"YXBhcGFnLXVidW50dS1kZXY6Mjg1MjM3NTU4MTQxMTo1MjE1Mw==", "pid":52153, "uid":0, "cwd":"/home/apapag/tetragon", "binary":"/usr/bin/sudo", "arguments":"./tetra dump processCache --skip-zero-refcnt", "flags":"execve", "start_time":"2024-09-05T07:46:14.970414578Z", "auid":1010, "parent_exec_id":"YXBhcGFnLXVidW50dS1kZXY6Mjg1MjM2Nzc1Nzc4NDo1MjE1Mg==", "refcnt":1, "tid":52153}, "color":"inUse", "refcnt":2, "refcntOps":{"parent++":2, "parent--":1, "process++":1}}
[...]

Signed-off-by: Anastasios Papagiannis <[email protected]>
  • Loading branch information
tpapagian committed Sep 10, 2024
1 parent 5ebad69 commit 24fdda8
Show file tree
Hide file tree
Showing 17 changed files with 2,028 additions and 661 deletions.
71 changes: 71 additions & 0 deletions api/v1/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 24fdda8

Please sign in to comment.