Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 May 2023 21:31:07 GMT
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 2cdeb89e5700 - main - linux(4): Fix stack unwinding on arm64 [2/2]
Message-ID:  <202305142131.34ELV7rM074056@gitrepo.freebsd.org>

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

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

commit 2cdeb89e57008e9299c1665783359141868f387e
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2023-05-14 21:25:57 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2023-05-14 21:25:57 +0000

    linux(4): Fix stack unwinding on arm64 [2/2]
    
    To allow unwinders to go througth a previous to sigreturn frame we should
    properly emulate the trampoline frame record which should points to the
    previous frame and set the trampoline frame pointer to the emulated frame
    before calling signal handler.
    
    MFC after:              1 week
---
 sys/arm64/linux/linux_sysvec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/arm64/linux/linux_sysvec.c b/sys/arm64/linux/linux_sysvec.c
index b2853d8e8359..8337bdfe0eb2 100644
--- a/sys/arm64/linux/linux_sysvec.c
+++ b/sys/arm64/linux/linux_sysvec.c
@@ -301,7 +301,7 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
 
 	/* Stack frame for unwinding */
 	frame->fp = tf->tf_x[29];
-	frame->lr = tf->tf_lr;
+	frame->lr = tf->tf_elr;
 
 	/* Translate the signal. */
 	sig = bsd_to_linux_signal(sig);
@@ -352,6 +352,7 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
 		tf->tf_x[1] = 0;
 		tf->tf_x[2] = 0;
 	}
+	tf->tf_x[29] = (register_t)&fp->fp;
 	tf->tf_x[8] = (register_t)catcher;
 	tf->tf_sp = (register_t)fp;
 	tf->tf_elr = (register_t)linux_vdso_sigcode;



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