diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2004-03-02 23:45:28 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2004-03-02 23:45:28 +0000 |
commit | f3b121190609f4f951ab26c14beea566284c6042 (patch) | |
tree | 7cde0b19775ee16405f1a07841dd1e2fe00a4b02 /sys/arch/sparc | |
parent | d4625f56e5db994701c492c3cf784977c2e1b0dc (diff) |
In process_set_pc() and process_set_regs(), disallow unaligned pc and npc
values. Workaround against PR #3663.
ok deraadt@
Diffstat (limited to 'sys/arch/sparc')
-rw-r--r-- | sys/arch/sparc/sparc/process_machdep.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/arch/sparc/sparc/process_machdep.c b/sys/arch/sparc/sparc/process_machdep.c index a3b2e940c24..595aa4c7e83 100644 --- a/sys/arch/sparc/sparc/process_machdep.c +++ b/sys/arch/sparc/sparc/process_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: process_machdep.c,v 1.7 2004/02/08 00:04:21 deraadt Exp $ */ +/* $OpenBSD: process_machdep.c,v 1.8 2004/03/02 23:45:27 miod Exp $ */ /* $NetBSD: process_machdep.c,v 1.6 1996/03/14 21:09:26 christos Exp $ */ /* @@ -103,6 +103,10 @@ process_write_regs(p, regs) struct reg *regs; { int psr = p->p_md.md_tf->tf_psr & ~PSR_ICC; + + if (((regs->r_pc | regs->r_npc) & 0x03) != 0) + return (EINVAL); + bcopy((caddr_t)regs, p->p_md.md_tf, sizeof(struct reg)); p->p_md.md_tf->tf_psr = psr | (regs->r_psr & PSR_ICC); return (0); @@ -123,6 +127,9 @@ process_set_pc(p, addr) struct proc *p; caddr_t addr; { + if (((u_int)addr & 0x03) != 0) + return (EINVAL); + p->p_md.md_tf->tf_pc = (u_int)addr; p->p_md.md_tf->tf_npc = (u_int)addr + 4; return (0); |