-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fossilize-replay run by steam is not captured by execsnoop in amd64 architecture #104
Comments
Related issue: iovisor/bcc#3668 |
The long term goal is to replace execsnoop with a custom implementation optimized for system76-power. Which would preferably also be written in Rust. There are some bpf/bcc crates available on Crates.io, but I'm not currently familiar with how it all glues together yet, or what the recommended crates are today. If you're interested, you could help me with that. |
This sounds really nice! I could try working on a rust bpf PoC when I have some time. By the way, (if necessary I would create a new issue), I noticed that after receiving exec info from execsnoop it waits 2 seconds for latest cgroup info. But I think that it could be done better by let a new bpf program hooking |
That would be helpful, because the two second delay is because the scheduler's already parsing the new process's data before its cgroup and other data are assigned to it. |
Aya seems to be the most popular rust-idiomatic library for writing eBPF kernel and user space programs. Today I have taken some time written a working PoC with Aya. There are some problems with Aya though:
|
It may be worth asking Aya's developers for help with the less documented or tricky areas. Perhaps they'd be willing to accept contributions for improvements to their documentation and APIs? For now, I'd accept a solution that can at least match parity with execsnoop-bpfcc. Though we can choose a better medium for communicating the inputs. Perhaps a zero-copy serializer like https://github.com/rkyv/rkyv, or something human-readable that's efficient to serialize and deserialize like https://kdl.dev/. I tried running your proof of concept, and got this error:
|
Still using bcc + Python and just adjusts the output of script sounds also OK and it doesn't involve a lot of refactoring.
This is expected as there're no aya logger ( |
fossilize-replay is used by Steam to generate games' pre-caching shaders, and it uses all cores and is very CPU-consuming (and makes desktop very slow). system76-scheduler is supposed to limit its nice and IO to lowest. However, it could be found that fossilize-replay is niced as 14 (its default maybe?) instead of 19 when starting games from Steam.
After some debugging with strace, it seems that (unfortunately) steam is running under 32-bit mode, and execsnoop could not capture 32-bit apps' execve() without code modification. In
execve_fnname = b.get_syscall_fnname("execve")
, execsnoop by default gets__x64_sys_
as its prefix, and__ia32_compat_sys_
is not covered.It seems that it could be a lot of trouble to make bcc upstream to cover all arch's symbols upstream (they have a lot of tools scripts), so maybe it is necessary to fork execsnoop inside system76-scheduler and make some modifications?
MRE:
Compiled by:
gcc -m32 ./example.c -o example
and run --execsnoop
could not catch this.If modified with
execve_fnname = "__ia32_compat_sys_execve"
, then it could get this exec. (Haven't tested with Steam's fossilize-replay though)The text was updated successfully, but these errors were encountered: