From Miod Vallat, tested by him and me.
ok deraadt@
-/* $OpenBSD: signal.h,v 1.7 2012/12/02 07:03:31 guenther Exp $ */
+/* $OpenBSD: signal.h,v 1.8 2016/06/21 12:31:19 aoyama Exp $ */
/*
* Copyright (c) 1996 Nivas Madhur
* All rights reserved.
* to the handler to allow it to restore state properly if
* a non-standard exit is performed.
*/
-struct sigcontext {
- int __sc_unused;
- int sc_mask; /* signal mask to restore */
+struct sigcontext {
+ long sc_cookie;
+ int sc_mask; /* signal mask to restore */
/* begin machine dependent portion */
unsigned int sc_regs[32 + 25];
};
-/* $OpenBSD: sig_machdep.c,v 1.25 2016/05/21 00:56:43 deraadt Exp $ */
+/* $OpenBSD: sig_machdep.c,v 1.26 2016/06/21 12:31:19 aoyama Exp $ */
/*
* Copyright (c) 2014 Miodrag Vallat.
*
bzero(&sf, fsize);
sf.sf_scp = &fp->sf_sc;
sf.sf_sc.sc_mask = mask;
+ sf.sf_sc.sc_cookie = (long)sf.sf_scp ^ p->p_p->ps_sigcookie;
if (psp->ps_siginfo & sigmask(sig))
initsiginfo(&sf.sf_si, sig, code, type, val);
} */ *uap = v;
struct sigcontext ksc, *scp = SCARG(uap, sigcntxp);
struct trapframe *tf;
+ int error;
+ vaddr_t pc;
- if (PROC_PC(p) != p->p_p->ps_sigcoderet) {
+ tf = p->p_md.md_tf;
+
+ /*
+ * This is simpler than PROC_PC, assuming XIP is always valid
+ * on 88100, and doesn't have a delay slot on 88110
+ * (which is the status we expect from the signal code).
+ */
+ pc = CPU_IS88110 ? tf->tf_regs.exip : tf->tf_regs.sxip ^ XIP_V;
+ if (pc != p->p_p->ps_sigcoderet) {
sigexit(p, SIGILL);
return (EPERM);
}
(void)copyout(&ksc.sc_cookie, (caddr_t)scp +
offsetof(struct sigcontext, sc_cookie), sizeof (ksc.sc_cookie));
- tf = p->p_md.md_tf;
-
if ((((struct reg *)&ksc.sc_regs)->epsr ^ tf->tf_regs.epsr) &
PSR_USERSTATIC)
return (EINVAL);
-/* $OpenBSD: subr.S,v 1.25 2016/05/10 18:39:46 deraadt Exp $ */
+/* $OpenBSD: subr.S,v 1.26 2016/06/21 12:31:19 aoyama Exp $ */
/*
* Mach Operating System
* Copyright (c) 1993-1992 Carnegie Mellon University
* The kernel arranges for the handler to be invoked directly, and return
* here.
*/
-ENTRY(sigcode) /* r31 points to sigframe */
+ .section .rodata
+ .align 3
+ .type sigcode,@function
+GLOBAL(sigcode) /* r31 points to sigframe */
ld %r2, %r31, 0 /* pick sigcontext* */
or %r13, %r0, SYS_sigreturn
+GLOBAL(sigcoderet)
tb0 0, %r0, 450 /* syscall trap, calling sigreturn */
- .globl _C_LABEL(sigcoderet)
-_C_LABEL(sigcoderet):
NOP | failure return
#ifdef dontbother /* sigreturn will not return unless it fails */
NOP | success return
NOP
GLOBAL(esigcode)
+GLOBAL(sigfill)
+ tb0 0, %r0, 130 /* breakpoint */
+GLOBAL(sigfillsiz)
+ .word _C_LABEL(sigfillsiz) - _C_LABEL(sigfill)
+
/*
* Helper functions for pmap_copy_page() and pmap_zero_page().
*/