logoalt Hacker News

Rewriting Every Syscall in a Linux Binary at Load Time

65 pointsby riteshnoronha16last Tuesday at 1:26 AM26 commentsview on HN

Comments

xelaboitoday at 8:43 AM

You either have a writing style that is uncannily similar to what an LLM generates, or this article was substantially written by an LLM. I don't know what it is about the style, but I just find it a bit exhausting, like an overfit on "engaging writing" that strips away sincerity.

show 2 replies
jmillikintoday at 7:31 AM

This might be a very dumb question, but if the process is being run under KVM to catch `int 0x03` then couldn't you also use KVM to catch `syscall` and execute the original binary as-is? I don't understand what value the instruction rewriting is providing here.

show 2 replies
coppsilgoldtoday at 7:03 AM

You mentioned SECCOMP_RET_TRACE, but there is also SECCOMP_RET_TRAP[1] which appears to perform better. There is also KVM. Both of these are options for gVisor: <https://github.com/google/gvisor>

[1] <https://github.com/google/gvisor/blob/master/pkg/sentry/plat...>

show 1 reply
Thaxlltoday at 11:21 AM

It's pretty much what gVisor does.

https://gvisor.dev/

CableNinjalast Tuesday at 3:38 AM

I assume this would break observability through existing methods, right? If you were to strace a process that has been patched, would you see regular syscall data (as if it wasnt patched) or would your syscall replacement appear along the way?

show 1 reply
ozgrakkurttoday at 7:45 AM

Really informative writing thank you.

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?

show 1 reply
JSR_FDEDtoday at 8:04 AM

Love the detailed write up, thanks!

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 :-)

footatoday at 7:07 AM

Hah, I've been looking into something amusingly similar to track mmap syscalls for a process :)

show 1 reply
hparadiztoday at 8:17 AM

I've been thinking of making a kernel patch that disables eBPF for certain processes as a privacy tool. Everyone is using eBPF now.

szmarczaktoday at 10:42 AM

> It can’t detect the interception

What's stopping the process from reading its own memory and seeing that the syscall was patched?

im3w1ltoday at 7:55 AM

What about int 80h?

twictoday at 10:46 AM

[dead]

edf13today at 7:48 AM

[dead]