summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphessler <phessler@openbsd.org>2016-05-11 20:21:26 +0000
committerphessler <phessler@openbsd.org>2016-05-11 20:21:26 +0000
commitfe94ffc2e4fa51510a6b48b4fd689d9903efa54e (patch)
tree7bf51d6d6502880a0ca5df95cceb76be3e994a09
parentfix sigcookie value, address was off due to trapframe nesting (diff)
downloadwireguard-openbsd-fe94ffc2e4fa51510a6b48b4fd689d9903efa54e.tar.xz
wireguard-openbsd-fe94ffc2e4fa51510a6b48b4fd689d9903efa54e.zip
fix compile issues in MD sigreturn(2)
OK deraadt@
-rw-r--r--sys/arch/sparc/sparc/locore.s4
-rw-r--r--sys/arch/sparc/sparc/machdep.c12
2 files changed, 9 insertions, 7 deletions
diff --git a/sys/arch/sparc/sparc/locore.s b/sys/arch/sparc/sparc/locore.s
index 2c85c17f2d9..7a4556a59df 100644
--- a/sys/arch/sparc/sparc/locore.s
+++ b/sys/arch/sparc/sparc/locore.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.99 2015/03/18 20:49:40 miod Exp $ */
+/* $OpenBSD: locore.s,v 1.100 2016/05/11 20:21:26 phessler Exp $ */
/* $NetBSD: locore.s,v 1.73 1997/09/13 20:36:48 pk Exp $ */
/*
@@ -4009,6 +4009,8 @@ _C_LABEL(sigcode):
restore %g0, SYS_sigreturn, %g1 ! get registers back & set syscall #
add %sp, 64 + 16, %o0 ! compute scp
+ .globl _C_LABEL(sigcoderet)
+_C_LABEL(sigcoderet):
t ST_SYSCALL ! sigreturn(scp)
! sigreturn does not return unless it fails
mov SYS_exit, %g1 ! exit(errno)
diff --git a/sys/arch/sparc/sparc/machdep.c b/sys/arch/sparc/sparc/machdep.c
index 139b0d449c0..ae173487e9d 100644
--- a/sys/arch/sparc/sparc/machdep.c
+++ b/sys/arch/sparc/sparc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.176 2016/05/10 18:39:48 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.177 2016/05/11 20:21:26 phessler Exp $ */
/* $NetBSD: machdep.c,v 1.85 1997/09/12 08:55:02 pk Exp $ */
/*
@@ -432,7 +432,7 @@ sendsig(catcher, sig, mask, code, type, val)
*/
newsp = (int)fp - sizeof(struct rwindow);
write_user_windows();
- sf.sf_sc.sc_cookie = (long)fp ^ p->p_p->ps_sigcookie;
+ sf.sf_sc.sc_cookie = (long)&fp->sf_sc ^ p->p_p->ps_sigcookie;
if (rwindow_save(p) || copyout((caddr_t)&sf, (caddr_t)fp, sizeof sf) ||
copyout(&oldsp, &((struct rwindow *)newsp)->rw_in[6],
sizeof(register_t)) != 0) {
@@ -500,7 +500,7 @@ sys_sigreturn(p, v, retval)
p->p_comm, p->p_pid, SCARG(uap, sigcntxp));
#endif
if (PROC_PC(p) != p->p_p->ps_sigcoderet) {
- printf("%s(%d): sigreturn not from tramp [pc 0x%lx 0x%lx]\n",
+ printf("%s(%d): sigreturn not from tramp [pc 0x%x 0x%lx]\n",
p->p_comm, p->p_pid, PROC_PC(p), p->p_p->ps_sigcoderet);
sigexit(p, SIGILL);
return (EPERM);
@@ -509,17 +509,17 @@ sys_sigreturn(p, v, retval)
if ((error = copyin(sc, &ksc, sizeof(ksc))) != 0)
return (error);
- if (ksc.sc_cookie != ((long)scp ^ p->p_p->ps_sigcookie)) {
+ if (ksc.sc_cookie != ((long)sc ^ p->p_p->ps_sigcookie)) {
printf("%s(%d): cookie %lx should have been %lx\n",
p->p_comm, p->p_pid, ksc.sc_cookie,
- (long)scp ^ p->p_p->ps_sigcookie);
+ (long)sc ^ p->p_p->ps_sigcookie);
sigexit(p, SIGILL);
return (EFAULT);
}
/* Prevent reuse of the sigcontext cookie */
ksc.sc_cookie = 0;
- (void)copyout(&ksc.sc_cookie, (caddr_t)scp +
+ (void)copyout(&ksc.sc_cookie, (caddr_t)sc +
offsetof(struct sigcontext, sc_cookie),
sizeof (ksc.sc_cookie));