From b54838003cd43845576764dbad8f587d8f8b291d Mon Sep 17 00:00:00 2001 From: Edward Tomasz Napierala Date: Mon, 26 Jul 2021 11:57:47 +0100 Subject: [PATCH] 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 --- sys/amd64/linux/linux_sysvec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c index fede294ce70..75fb21c7d03 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;