summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortb <tb@openbsd.org>2017-01-04 09:21:26 +0000
committertb <tb@openbsd.org>2017-01-04 09:21:26 +0000
commit274633a250d07ee3e60b585100a6332e4c206592 (patch)
treef11dce36a8c0ed793b8009a28ac33314db1c7f70
parentComplete rewrite: (diff)
downloadwireguard-openbsd-274633a250d07ee3e60b585100a6332e4c206592.tar.xz
wireguard-openbsd-274633a250d07ee3e60b585100a6332e4c206592.zip
If find(1) may end up calling execve(2), it needs "proc exec" in addition
to its other promises. Previously, find ran unpledged if the -exec{,dir} or -ok primaries were specified: the tame(2) calls for find(1) were added a few days before the "exec" promise was implemented and these code paths were never revisited. ok millert
-rw-r--r--usr.bin/find/find.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/usr.bin/find/find.c b/usr.bin/find/find.c
index ace199bbb54..e8f3db9f046 100644
--- a/usr.bin/find/find.c
+++ b/usr.bin/find/find.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: find.c,v 1.21 2017/01/03 21:31:16 tedu Exp $ */
+/* $OpenBSD: find.c,v 1.22 2017/01/04 09:21:26 tb Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -162,6 +162,15 @@ find_execute(PLAN *plan, /* search plan */
if (pledge("stdio rpath getpw", NULL) == -1)
err(1, "pledge");
}
+ } else {
+ if (isdelete) {
+ if (pledge("stdio rpath cpath getpw proc exec", NULL)
+ == -1)
+ err(1, "pledge");
+ } else {
+ if (pledge("stdio rpath getpw proc exec", NULL) == -1)
+ err(1, "pledge");
+ }
}
rval = 0;