Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Jun 2022 19:32:06 GMT
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: b0774c8b9040 - stable/13 - linux: fix sigaltstack on amd64
Message-ID:  <202206171932.25HJW60K008010@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by dchagin:

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

commit b0774c8b904096f1bc28e9a94b764a75eb6fb4ff
Author:     Edward Tomasz Napierala <trasz@FreeBSD.org>
AuthorDate: 2021-07-26 10:57:47 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2022-06-17 19:30:21 +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
    
    (cherry picked from commit b54838003cd43845576764dbad8f587d8f8b291d)
---
 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 4a85f0469804..e6bbed4ba836 100644
--- a/sys/amd64/linux/linux_sysvec.c
+++ b/sys/amd64/linux/linux_sysvec.c
@@ -604,9 +604,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);
@@ -650,6 +647,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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202206171932.25HJW60K008010>