path: root/lib/libc
diff options
authorDavid Chisnall <theraven@FreeBSD.org>2021-07-10 16:19:52 +0000
committerDavid Chisnall <theraven@FreeBSD.org>2021-07-16 17:06:44 +0000
commitcf98bc28d39d6df5386ac57375af1b60af5d6bb3 (patch)
treea90f8f68bcb8b898ba7efae5e91f5091347cf6a5 /lib/libc
parent4652422eb477731f284b1345afeefef7f269da50 (diff)
Pass the syscall number to capsicum permission-denied signals
The syscall number is stored in the same register as the syscall return on amd64 (and possibly other architectures) and so it is impossible to recover in the signal handler after the call has returned. This small tweak delivers it in the `si_value` field of the signal, which is sufficient to catch capability violations and emulate them with a call to a more-privileged process in the signal handler. This reapplies 3a522ba1bc852c3d4660a4fa32e4a94999d09a47 with a fix for the static assertion failure on i386. Approved by: markj (mentor) Reviewed by: kib, bcr (manpages) Differential Revision: https://reviews.freebsd.org/D29185
Diffstat (limited to 'lib/libc')
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/libc/sys/procctl.2 b/lib/libc/sys/procctl.2
index 432ed5919a81..ce7a2be5d5e4 100644
--- a/lib/libc/sys/procctl.2
+++ b/lib/libc/sys/procctl.2
@@ -454,6 +454,16 @@ and the
.Va si_code
member is set to
+The system call number is stored in the
+.Va si_syscall
+field of the
+.Fa siginfo
+signal handler parameter.
+The other system call parameters can be read from the
+.Fa ucontext_t
+but the system call number is typically stored in the register
+that also contains the return value and so is unavailable in the
+signal handler.
.Xr capsicum 4