summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2007-04-26 17:05:11 +0000
committermiod <miod@openbsd.org>2007-04-26 17:05:11 +0000
commit6907b0e37d0e14999df7d88402524a3f9645732f (patch)
tree2ed7d7b88d5add7734a2adaba075052f9812cfde
parentBe more careful when changing cop0 SR value; or flags in instead of setting (diff)
downloadwireguard-openbsd-6907b0e37d0e14999df7d88402524a3f9645732f.tar.xz
wireguard-openbsd-6907b0e37d0e14999df7d88402524a3f9645732f.zip
Do not allow userland to change cop0 SR via ptrace; from NetBSD.
-rw-r--r--sys/arch/mips64/mips64/process_machdep.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/arch/mips64/mips64/process_machdep.c b/sys/arch/mips64/mips64/process_machdep.c
index 50ab019c316..d3fe50bbe4b 100644
--- a/sys/arch/mips64/mips64/process_machdep.c
+++ b/sys/arch/mips64/mips64/process_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: process_machdep.c,v 1.6 2005/12/17 14:56:31 kettenis Exp $ */
+/* $OpenBSD: process_machdep.c,v 1.7 2007/04/26 17:05:11 miod Exp $ */
/*
* Copyright (c) 1994 Adam Glass
@@ -40,7 +40,7 @@
* From:
* Id: procfs_i386.c,v 4.1 1993/12/17 10:47:45 jsp Rel
*
- * $Id: process_machdep.c,v 1.6 2005/12/17 14:56:31 kettenis Exp $
+ * $Id: process_machdep.c,v 1.7 2007/04/26 17:05:11 miod Exp $
*/
/*
@@ -105,6 +105,7 @@ process_write_regs(p, regs)
struct proc *p;
struct reg *regs;
{
+ register_t sr;
extern struct proc *machFPCurProcPtr;
if (p == machFPCurProcPtr) {
@@ -113,8 +114,9 @@ process_write_regs(p, regs)
else
MipsSaveCurFPState16(p);
}
+ sr = p->p_md.md_regs->sr;
bcopy((caddr_t)regs, (caddr_t)p->p_md.md_regs, REGSIZE);
-/*XXX Clear to user set bits!! */
+ p->p_md.md_regs->sr = sr;
return (0);
}