summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2015-11-13 18:09:34 +0000
committerderaadt <deraadt@openbsd.org>2015-11-13 18:09:34 +0000
commitcfee64cae0daa49125c22b20b5d9f9aaf9e7ab73 (patch)
tree0b82892dfbebe56b2e46fbfa3256a7883ec73e0e
parentmove pledge(2) after setrtable(2), like in nc(1); (diff)
downloadwireguard-openbsd-cfee64cae0daa49125c22b20b5d9f9aaf9e7ab73.tar.xz
wireguard-openbsd-cfee64cae0daa49125c22b20b5d9f9aaf9e7ab73.zip
Both gcc & collect2 can pledge "stdio rpath wpath cpath proc exec".
(cc1 "toplev.c" uses brk/sbrk, so it is on hold to figure out the right direction...) ok semarie pascal
-rw-r--r--gnu/gcc/gcc/collect2.c5
-rw-r--r--gnu/gcc/gcc/gcc.c5
2 files changed, 10 insertions, 0 deletions
diff --git a/gnu/gcc/gcc/collect2.c b/gnu/gcc/gcc/collect2.c
index f507e25e47d..f621abf0681 100644
--- a/gnu/gcc/gcc/collect2.c
+++ b/gnu/gcc/gcc/collect2.c
@@ -797,6 +797,11 @@ main (int argc, char **argv)
no_demangle = !! getenv ("COLLECT_NO_DEMANGLE");
+ if (pledge ("stdio rpath wpath cpath proc exec", NULL) == -1) {
+ error ("cannot pledge");
+ collect_exit (1);
+ }
+
/* Suppress demangling by the real linker, which may be broken. */
putenv (xstrdup ("COLLECT_NO_DEMANGLE="));
diff --git a/gnu/gcc/gcc/gcc.c b/gnu/gcc/gcc/gcc.c
index c466fee4689..c59eef8df78 100644
--- a/gnu/gcc/gcc/gcc.c
+++ b/gnu/gcc/gcc/gcc.c
@@ -6094,6 +6094,11 @@ main (int argc, char **argv)
xmalloc_set_program_name (programname);
+ if (pledge ("stdio rpath wpath cpath proc exec", NULL) == -1) {
+ error ("pledge", xstrerror (errno));
+ exit (1);
+ }
+
expandargv (&argc, &argv);
prune_options (&argc, &argv);