git: b54838003cd4 - main - linux: fix sigaltstack on amd64

Edward Tomasz Napierala trasz at FreeBSD.org
Mon Jul 26 11:20:14 UTC 2021


The branch main has been updated by trasz:

URL: https://cgit.FreeBSD.org/src/commit/?id=b54838003cd43845576764dbad8f587d8f8b291d

commit b54838003cd43845576764dbad8f587d8f8b291d
Author:     Edward Tomasz Napierala <trasz at FreeBSD.org>
AuthorDate: 2021-07-26 10:57:47 +0000
Commit:     Edward Tomasz Napierala <trasz at FreeBSD.org>
CommitDate: 2021-07-26 10:57:52 +0000

    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 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;


More information about the dev-commits-src-main mailing list