userland is allowed to change in psr.
-/* $OpenBSD: psl.h,v 1.5 2007/12/20 21:17:51 miod Exp $ */
+/* $OpenBSD: psl.h,v 1.6 2008/07/28 17:50:09 miod Exp $ */
/*
* Copyright (c) 1996 Nivas Madhur
* All rights reserved.
#define PSR_IND 0x00000002 /* interrupt disable */
#define PSR_SFRZ 0x00000001 /* shadow freeze */
+/* bits userland is not allowed to change */
+#define PSR_USERSTATIC (PSR_MODE | PSR_BO | PSR_SGN | PSR_SRM | PSR_SFD | \
+ PSR_MXM | PSR_IND | PSR_SFRZ)
+
#define FIP_V 0x00000002 /* valid */
#define FIP_E 0x00000001 /* exception */
#define FIP_ADDR 0xfffffffc /* address mask */
-/* $OpenBSD: process_machdep.c,v 1.3 2005/05/18 16:44:41 miod Exp $ */
+/* $OpenBSD: process_machdep.c,v 1.4 2008/07/28 17:50:11 miod Exp $ */
/*
* Copyright (c) 1993 The Regents of the University of California.
struct proc *p;
struct reg *regs;
{
- bcopy((caddr_t)regs, (caddr_t)USER_REGS(p), sizeof(struct reg));
+ struct reg *procregs = (struct reg *)USER_REGS(p);
+ unsigned int psr = procregs->epsr;
+
+ bcopy(regs, procregs, sizeof(struct reg));
+ procregs->epsr =
+ (psr & PSR_USERSTATIC) | (regs->epsr & ~PSR_USERSTATIC);
+
return (0);
}
-/* $OpenBSD: sig_machdep.c,v 1.8 2007/12/31 09:23:53 martin Exp $ */
+/* $OpenBSD: sig_machdep.c,v 1.9 2008/07/28 17:50:11 miod Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
tf = p->p_md.md_tf;
scp = &ksc;
+ if ((scp->sc_regs.epsr ^ tf->tf_regs.epsr) & PSR_USERSTATIC)
+ return (EINVAL);
+
bcopy((const void *)&scp->sc_regs, (caddr_t)&tf->tf_regs,
sizeof(scp->sc_regs));