git: d00a638bfd66 - stable/13 - mips: Fix sendsig for stack layout randomisation
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 31 Jan 2023 01:47:14 UTC
The branch stable/13 has been updated by jrtc27:
URL: https://cgit.FreeBSD.org/src/commit/?id=d00a638bfd668fea9608fa14cbcea3df783e9be5
commit d00a638bfd668fea9608fa14cbcea3df783e9be5
Author: Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2023-01-31 01:27:50 +0000
Commit: Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2023-01-31 01:46:18 +0000
mips: Fix sendsig for stack layout randomisation
PS_STRINGS doesn't account for the stack gap, we need to use the new
PROC_PS_STRINGS macro to correctly point at the trampoline.
This is a direct commit to stable/13 as mips no longer exists in main.
Fixes: d247611467e0 ("exec: Introduce the PROC_PS_STRINGS() macro")
---
sys/mips/mips/pm_machdep.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sys/mips/mips/pm_machdep.c b/sys/mips/mips/pm_machdep.c
index 7a9db29b6ff6..9fcbef14f606 100644
--- a/sys/mips/mips/pm_machdep.c
+++ b/sys/mips/mips/pm_machdep.c
@@ -175,7 +175,8 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
/*
* Signal trampoline code is at base of user stack.
*/
- regs->ra = (register_t)(intptr_t)PS_STRINGS - *(p->p_sysent->sv_szsigcode);
+ regs->ra = (register_t)(intptr_t)PROC_PS_STRINGS(p) -
+ *(p->p_sysent->sv_szsigcode);
PROC_LOCK(p);
mtx_lock(&psp->ps_mtx);
}