Hi, qemu-user implements calling signal-race-safe syscalls for the guest in assembly directly to the kernel instead of going through the host's libc.
The proposed patch adds a switch to go through libc, which allows interposition of libc's syscall(), even when the guest program is statically linked. The motivation behind the change is intercepting statically linked binaries [1] with firebuild [2], a build accelerator implemented in userspace. I have tested the Linux changes, but not not BSD ones. I think they are trivial enough to work and I'd like to port firebuild to BSD, too, in the future. Cheers, Balint [1] https://github.com/firebuild/firebuild/pull/1334 [2] https://github.com/firebuild/firebuild Balint Reczey (1): user: add runtime switch to call safe_syscall via libc bsd-user/main.c | 11 +++++++ common-user/meson.build | 1 + common-user/safe-syscall.c | 57 +++++++++++++++++++++++++++++++++++++ docs/user/main.rst | 28 ++++++++++++++++-- include/user/safe-syscall.h | 25 +++++++++++----- linux-user/main.c | 9 ++++++ 6 files changed, 122 insertions(+), 9 deletions(-) create mode 100644 common-user/safe-syscall.c -- 2.43.0
