diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2007-09-09 20:49:19 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2007-09-09 20:49:19 +0000 |
commit | ec457499afee5477325a6450be1d3623832a7d6a (patch) | |
tree | 0d2bef075c6bac0b8028d812f0a9956d03c5ee4b /sys/arch/powerpc | |
parent | 2ad8d3f46733b834de0721fb66f614b14c69dad6 (diff) |
Make sure ptrace(2) cannot change any priviliged bits in the Machine State
Register. Fixes PR 5574. From Stefan Kempf.
ok deraadt@
Diffstat (limited to 'sys/arch/powerpc')
-rw-r--r-- | sys/arch/powerpc/powerpc/process_machdep.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/arch/powerpc/powerpc/process_machdep.c b/sys/arch/powerpc/powerpc/process_machdep.c index 4004c4dd9cf..49c6834ef43 100644 --- a/sys/arch/powerpc/powerpc/process_machdep.c +++ b/sys/arch/powerpc/powerpc/process_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: process_machdep.c,v 1.12 2007/03/20 20:59:53 kettenis Exp $ */ +/* $OpenBSD: process_machdep.c,v 1.13 2007/09/09 20:49:18 kettenis Exp $ */ /* $NetBSD: process_machdep.c,v 1.1 1996/09/30 16:34:53 ws Exp $ */ /* @@ -124,6 +124,9 @@ process_write_regs(struct proc *p, struct reg *regs) struct trapframe *tf = trapframe(p); struct pcb *pcb = &p->p_addr->u_pcb; + if ((regs->ps ^ tf->srr1) & PSL_USERSTATIC) + return EINVAL; + bcopy(regs->gpr, tf->fixreg, sizeof(regs->gpr)); /* XXX What if the state is on the other cpu? */ |