summaryrefslogtreecommitdiff
path: root/sys/arch/powerpc
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2002-03-14 00:42:26 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2002-03-14 00:42:26 +0000
commit4e75a2f3d47fcb4101ad6c63743e4262538a944a (patch)
tree8b4782ea02392ac0303642f999b3a00a9de95490 /sys/arch/powerpc
parent31d9f37c33069ba39395849737d1ef3662a4c687 (diff)
Turn the ptrace(2) syscall into a kernel compile option, option PTRACE in
your kernel configuration file. By default, GENERIC will enable this. When PTRACE is not enabled, several ptrace-like features of the procfs filesystem will be disabled as well (namely, the ability to read and write any process' registers, as well as attching, single stepping and detaching to/from processes). This should help paranoid people build better sandboxens, and us to build smaller ramdisks.
Diffstat (limited to 'sys/arch/powerpc')
-rw-r--r--sys/arch/powerpc/powerpc/process_machdep.c50
1 files changed, 28 insertions, 22 deletions
diff --git a/sys/arch/powerpc/powerpc/process_machdep.c b/sys/arch/powerpc/powerpc/process_machdep.c
index 994cd40ff3d..2bda245f97c 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.4 2001/07/09 01:11:09 mickey Exp $ */
+/* $OpenBSD: process_machdep.c,v 1.5 2002/03/14 00:42:24 miod Exp $ */
/* $NetBSD: process_machdep.c,v 1.1 1996/09/30 16:34:53 ws Exp $ */
/*
@@ -37,6 +37,31 @@
#include <sys/ptrace.h>
#include <machine/reg.h>
+int
+process_read_regs(p, regs)
+ struct proc *p;
+ struct reg *regs;
+{
+ struct trapframe *tf = trapframe(p);
+
+ bcopy(&(tf->fixreg[0]), &(regs->gpr[0]), sizeof(regs->gpr));
+ bzero(&(regs->fpr[0]), sizeof(regs->fpr));
+ /*
+ * need to do floating point here
+ */
+ regs->pc = tf->srr0;
+ regs->ps = tf->srr1; /* is this the correct value for this ? */
+ regs->cnd = tf->cr;
+ regs->lr = tf->lr;
+ regs->cnt = tf->ctr;
+ regs->xer = tf->xer;
+ regs->mq = 0; /* what should this really be? */
+
+ return (0);
+}
+
+#ifdef PTRACE
+
/*
* Set the process's program counter.
*/
@@ -64,28 +89,7 @@ process_sstep(p, sstep)
tf->srr1 &= ~PSL_SE;
return 0;
}
-int
-process_read_regs(p, regs)
- struct proc *p;
- struct reg *regs;
-{
- struct trapframe *tf = trapframe(p);
- bcopy(&(tf->fixreg[0]), &(regs->gpr[0]), sizeof(regs->gpr));
- bzero(&(regs->fpr[0]), sizeof(regs->fpr));
- /*
- * need to do floating point here
- */
- regs->pc = tf->srr0;
- regs->ps = tf->srr1; /* is this the correct value for this ? */
- regs->cnd = tf->cr;
- regs->lr = tf->lr;
- regs->cnt = tf->ctr;
- regs->xer = tf->xer;
- regs->mq = 0; /* what should this really be? */
-
- return (0);
-}
int
process_write_regs(p, regs)
struct proc *p;
@@ -107,3 +111,5 @@ process_write_regs(p, regs)
return (0);
}
+
+#endif /* PTRACE */