summary refs log tree commit diff stats
path: root/linux-user/syscall_defs.h
diff options
context:
space:
mode:
authorArusekk <floss@arusekk.pl>2025-07-11 18:48:29 +0200
committerRichard Henderson <richard.henderson@linaro.org>2025-09-23 16:17:59 -0700
commitc8e5aed246914ff6438839350e414a3bea5a8041 (patch)
tree7ce1d83c81e0014ec6644bda93cef60a48e6bbbe /linux-user/syscall_defs.h
parent2c75137623cb60f2ac3cedfff077d00dc977b842 (diff)
downloadfocaccia-qemu-c8e5aed246914ff6438839350e414a3bea5a8041.tar.gz
focaccia-qemu-c8e5aed246914ff6438839350e414a3bea5a8041.zip
linux-user: Add syscall dispatch support
This commit adds support for the `prctl(PR_SET_SYSCALL_USER_DISPATCH)`
function in the Linux userspace emulator.

It is implemented as a fully host-independent function, by forcing
a SIGSYS early during syscall handling, if the PC is outside the
allowed range.

Since disabled SUD is indistinguishable from enabled SUD with
always-allowed region length == ~0, this encoding is used
instead of introducing a new flag.

Tested on [uglendix][1], will probably also apply to software like
tiny-wine, rpcsx, limbo, lazypoline, vicar, sysfail and endokernel,
to name a few.

[1]: https://sr.ht/~arusekk/uglendix

Signed-off-by: Arusekk <floss@arusekk.pl>
Message-ID: <20250711225226.14652-1-floss@arusekk.pl>
[rth: Split out is_vdso_sigreturn region matching and other minor tweaks.]
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'linux-user/syscall_defs.h')
-rw-r--r--linux-user/syscall_defs.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index df26a2d28f..cd9ff709b8 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -690,6 +690,12 @@ typedef struct target_siginfo {
 #define TARGET_TRAP_UNK         (5)     /* undiagnosed trap */
 
 /*
+ * SIGSYS si_codes
+ */
+#define TARGET_SYS_SECCOMP       (1)  /* seccomp triggered */
+#define TARGET_SYS_USER_DISPATCH (2)  /* syscall user dispatch triggered */
+
+/*
  * SIGEMT si_codes
  */
 #define TARGET_EMT_TAGOVF      1       /* tag overflow */