Rewriting Every Syscall in a Linux Binary at Load Time
Posted by riteshnoronha16 4 days ago
Comments
Comment by jmillikin 3 hours ago
Comment by rep_lodsb 1 hour ago
Even if you disallow executing anything outside of the .text section, you still need the syscall trap to protect against adversarial code which hides the instruction inside an immediate value:
foo: mov eax, 0xc3050f ;return a perfectly harmless constant
ret
...
call foo+1
(this could be detected if the tracing went by control flow instead of linearly from the top, but what if it's called through a function pointer?)Comment by xelaboi 1 hour ago
Comment by renewiltord 1 hour ago
I think the idea of sharing the raw prompt traces is good. Then I can feed that to an LLM and get the original information prior to expansion.
Comment by coppsilgold 3 hours ago
[1] <https://github.com/google/gvisor/blob/master/pkg/sentry/plat...>
Comment by monocasa 3 hours ago
Comment by coppsilgold 3 hours ago
Also gVisor (aka runsc) is a container runtime as well. And it doesn't gatekeep syscalls but chooses to re-implement them in userland.
Comment by ozgrakkurt 2 hours ago
How secure does this make a binary? For example would you be able to run untrusted binary code inside a browser using a method like this?
Then can websites just use C++ instead of javascript for example?
Comment by lmz 1 hour ago
Comment by ozgrakkurt 1 hour ago
Comment by CableNinja 4 days ago
Comment by amitlimaye 4 days ago
Inside the guest, there's no kernel to attach strace to — the shim IS the syscall handler. But we do have full observability: every syscall that hits the shim is logged to a trace ring buffer with the syscall number, arguments, and TSC timestamp. It's more complete than strace in some ways — you see denied calls too, with the policy verdict, and there's no observer overhead because the logging is part of the dispatch path.
So existing tools don't work, but you get something arguably better: a complete, tamper-proof record of every syscall the process attempted, including the ones that were denied before they could execute. I'll publish a follow-on tomorrow that details how we load and execute this rewritten binary and what the VMM architecture looks like.
Comment by JSR_FDED 2 hours ago
This is the kind of foundation that I would feel comfortable running agents on. It’s not the whole solution of course (yes agent, you’re allowed to delete this email but not that email can’t be solved at this level)… let me know when you tackle that next :-)
Comment by foota 3 hours ago
Comment by hparadiz 2 hours ago
Comment by im3w1l 2 hours ago
Comment by edf13 2 hours ago