summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-10-10 21:19:15 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-10-10 21:19:15 +0000
commite2bb8bdb75b43853bb053fea56c666012c40a1ec (patch)
tree9791914dafb9daccfdcb5bbda79e99f28ec1aede /usr.bin
parent0a920735a987d86eed82dd44cef3075e44a4b4d1 (diff)
env(1) is obviously a program falling into pledge "stdio exec". It
does stdio, and it does a raw execve(). It is so obvious. It gets only _exit(2), kbind(2), and 46 system calls -- over half of which are deeply gutted in their functionality to only serve narrow libc needs for "stdio (includes malloc)". the other 161 system calls kill it.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/env/env.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/env/env.c b/usr.bin/env/env.c
index 5596e6fc2f2..87e9a0b8e4b 100644
--- a/usr.bin/env/env.c
+++ b/usr.bin/env/env.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: env.c,v 1.15 2014/03/08 00:09:20 schwarze Exp $ */
+/* $OpenBSD: env.c,v 1.16 2015/10/10 21:19:14 deraadt Exp $ */
/*
* Copyright (c) 1988, 1993, 1994
@@ -49,6 +49,9 @@ main(int argc, char *argv[])
setlocale(LC_ALL, "");
+ if (pledge("stdio exec", NULL) == -1)
+ err(1, "pledge");
+
while ((ch = getopt(argc, argv, "i-")) != -1)
switch(ch) {
case '-': /* obsolete */