From: deraadt Date: Fri, 23 Oct 2015 03:26:24 +0000 (+0000) Subject: With new pledge "ps" and "vminfo" requests, ps/top/w become possible. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=4120813fd88490b8c6a143a6d02a4e4dff13ac02;p=openbsd With new pledge "ps" and "vminfo" requests, ps/top/w become possible. --- diff --git a/bin/ps/ps.c b/bin/ps/ps.c index 56876ae571d..396420e9d3e 100644 --- a/bin/ps/ps.c +++ b/bin/ps/ps.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ps.c,v 1.65 2015/06/29 15:03:33 bluhm Exp $ */ +/* $OpenBSD: ps.c,v 1.66 2015/10/23 03:26:24 deraadt Exp $ */ /* $NetBSD: ps.c,v 1.15 1995/05/18 20:33:25 mycroft Exp $ */ /*- @@ -278,6 +278,9 @@ main(int argc, char *argv[]) if (kd == NULL) errx(1, "%s", errbuf); + if (pledge("stdio rpath ps", NULL) == -1) + err(1, "abort pledge"); + if (!fmt) { if (showthreads) parsefmt(tfmt); diff --git a/usr.bin/top/top.c b/usr.bin/top/top.c index aa2f49bfb0d..a6d4fcaf3b5 100644 --- a/usr.bin/top/top.c +++ b/usr.bin/top/top.c @@ -1,4 +1,4 @@ -/* $OpenBSD: top.c,v 1.83 2015/05/06 07:53:29 mpi Exp $ */ +/* $OpenBSD: top.c,v 1.84 2015/10/23 03:26:24 deraadt Exp $ */ /* * Top users/processes display for Unix @@ -328,6 +328,9 @@ main(int argc, char *argv[]) preset_argc = 0; } while (i != 0); + if (pledge("abort stdio rpath tty ps vminfo", NULL) == -1) + err(1, "pledge"); + /* set constants for username/uid display correctly */ if (!do_unames) { uname_field = " UID "; diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c index 762566a7675..596b2b48194 100644 --- a/usr.bin/w/w.c +++ b/usr.bin/w/w.c @@ -1,4 +1,4 @@ -/* $OpenBSD: w.c,v 1.59 2015/08/31 15:49:34 deraadt Exp $ */ +/* $OpenBSD: w.c,v 1.60 2015/10/23 03:26:24 deraadt Exp $ */ /*- * Copyright (c) 1980, 1991, 1993, 1994 @@ -112,6 +112,9 @@ main(int argc, char *argv[]) char *memf, *nlistf, *p, *x; char buf[HOST_NAME_MAX+1], errbuf[_POSIX2_LINE_MAX]; + if (pledge("stdio tty rpath ps vminfo", NULL) == -1) + err(1, "pledge"); + /* Are we w(1) or uptime(1)? */ p = __progname; if (*p == '-')