aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Tomasz Napierala <trasz@FreeBSD.org>2021-07-26 10:57:47 +0000
committerEdward Tomasz Napierala <trasz@FreeBSD.org>2021-07-26 10:57:52 +0000
commitb54838003cd43845576764dbad8f587d8f8b291d (patch)
tree187903ca403d4b4bc3a0ecc835e5deb562c539c7
parentccc510b46340da563e21549a1a0cb99915d8d623 (diff)
downloadsrc-b54838003cd43845576764dbad8f587d8f8b291d.tar.gz
src-b54838003cd43845576764dbad8f587d8f8b291d.zip
linux: fix sigaltstack on amd64
To determine whether to use alternate signal stack or not, we need to use the native signal number, not the one translated with bsd_to_linux_signal(). In practical terms, this fixes golang. Reviewed By: dchagin Fixes: 135dd0cab51 Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D31298
-rw-r--r--sys/amd64/linux/linux_sysvec.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c
index fede294ce706..75fb21c7d037 100644
--- a/sys/amd64/linux/linux_sysvec.c
+++ b/sys/amd64/linux/linux_sysvec.c
@@ -630,9 +630,6 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
LINUX_CTR4(rt_sendsig, "%p, %d, %p, %u",
catcher, sig, mask, code);
- /* Translate the signal. */
- sig = bsd_to_linux_signal(sig);
-
/* Save user context. */
bzero(&sf, sizeof(sf));
bsd_to_linux_sigset(mask, &sf.sf_sc.uc_sigmask);
@@ -676,6 +673,9 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
/* Align to 16 bytes. */
sfp = (struct l_rt_sigframe *)((unsigned long)sp & ~0xFul);
+ /* Translate the signal. */
+ sig = bsd_to_linux_signal(sig);
+
/* Build the argument list for the signal handler. */
regs->tf_rdi = sig; /* arg 1 in %rdi */
regs->tf_rax = 0;