| ▲ | System call instrumentation on Linux/x86‑64 using memory‑indirect calls, part I(humprog.org) | ||||||||||||||||||||||||||||||||||
| 17 points by matt_d 4 days ago | 7 comments | |||||||||||||||||||||||||||||||||||
| ▲ | freestanding 9 minutes ago | parent | next [-] | ||||||||||||||||||||||||||||||||||
that is graphomania. syscalls are easy and dont require so much bloat. beside its lefty GNUnix license | |||||||||||||||||||||||||||||||||||
| ▲ | quotemstr 2 hours ago | parent | prev [-] | ||||||||||||||||||||||||||||||||||
Linux is unusual in OS kernels in that direct system calls from arbitrary userspace code are supported and ABI-stable. This model has always been a terrible idea. It robs the system of an ability to intercept system calls in userspace before doing an expensive privilege-mode transition. If, instead, as on OpenBSD, the kernel enforced the rule that all system calls had to go through libc (or perhaps a big ntdll.dll-like VDSO), then the whole problem the linked article tries in vain to solve would disappear. If you wanted to hook a system call, you'd just change the libc/VDSO dispatch. No need to rewrite any instructions. If I were Linus, I'd make a new rule: starting today, all new system calls must go through VDSO. No exceptions. SYSCALL from anywhere else? SIGKILL. This way, you can just LD_PRELOAD in front of the VDSO and system call interception in userspace Just Works. | |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||