summaryrefslogtreecommitdiff
path: root/sys/kern/kern_sysctl.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-10-25 20:39:55 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-10-25 20:39:55 +0000
commit4de863f9ffcc7109cab38b676da78eaccd6d443b (patch)
tree16b565fcdd0af584260232b6be4f56d23b42b8f4 /sys/kern/kern_sysctl.c
parentd0e9b5026b2d545908c11216c861f0d4202cfd24 (diff)
Fold "malloc" into "stdio" and -- recognizing that no program so far has
used less than "stdio" -- include all the "self" operations. Instead of different defines, use regular PLEDGE_* in the "p_pledgenote" variable (which indicates the operation subtype a system call is performing). Many checks before easier to understand. p_pledgenote can often be passed directly to ktrace, so that kdump says: 15565 test CALL pledge(0xa9a3f804c51,0) 15565 test STRU pledge request="stdio" 15565 test RET pledge 0 15565 test CALL open(0xa9a3f804c57,0x2<O_RDWR>) 15565 test NAMI "/tmp/testfile" 15565 test PLDG open, "wpath", errno 1 Operation not permitted with help from semarie, ok guenther
Diffstat (limited to 'sys/kern/kern_sysctl.c')
-rw-r--r--sys/kern/kern_sysctl.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index b5258b5309c..c76e623ca79 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.296 2015/10/09 01:10:27 deraadt Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.297 2015/10/25 20:39:54 deraadt Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -174,8 +174,10 @@ sys_sysctl(struct proc *p, void *v, register_t *retval)
if (error)
return (error);
- if (pledge_sysctl_check(p, SCARG(uap, namelen), name, SCARG(uap, new)))
- return (pledge_fail(p, EPERM, PLEDGE_SELF));
+ error = pledge_sysctl_check(p, SCARG(uap, namelen),
+ name, SCARG(uap, new));
+ if (error)
+ return (pledge_fail(p, error, PLEDGE_STDIO));
switch (name[0]) {
case CTL_KERN: