summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bin/ps/Makefile2
-rw-r--r--bin/ps/ps.c14
-rw-r--r--usr.bin/pkill/Makefile3
-rw-r--r--usr.bin/pkill/pkill.c14
4 files changed, 3 insertions, 30 deletions
diff --git a/bin/ps/Makefile b/bin/ps/Makefile
index 82b5a60..5628436 100644
--- a/bin/ps/Makefile
+++ b/bin/ps/Makefile
@@ -13,7 +13,5 @@ WARNS?= 5
CFLAGS+=-DLAZY_PS
DPADD= ${LIBM} ${LIBKVM}
LDADD= -lm -lkvm
-#BINGRP= kmem
-#BINMODE=2555
.include <bsd.prog.mk>
diff --git a/bin/ps/ps.c b/bin/ps/ps.c
index bafbfa1..dcb7018 100644
--- a/bin/ps/ps.c
+++ b/bin/ps/ps.c
@@ -171,7 +171,7 @@ main(int argc, char *argv[])
struct winsize ws;
const char *nlistf, *memf;
char *cols;
- int all, ch, dropgid, elem, flag, _fmt, i, lineno;
+ int all, ch, elem, flag, _fmt, i, lineno;
int nentries, nkept, nselectors;
int prtheader, showthreads, wflag, what, xkeep, xkeep_implied;
char errbuf[_POSIX2_LINE_MAX];
@@ -196,7 +196,7 @@ main(int argc, char *argv[])
if (argc > 1)
argv[1] = kludge_oldps_options(PS_ARGS, argv[1], argv[2]);
- all = dropgid = _fmt = nselectors = optfatal = 0;
+ all = _fmt = nselectors = optfatal = 0;
prtheader = showthreads = wflag = xkeep_implied = 0;
xkeep = -1; /* Neither -x nor -X. */
init_list(&gidlist, addelem_gid, sizeof(gid_t), "group");
@@ -278,14 +278,12 @@ main(int argc, char *argv[])
break;
case 'M':
memf = optarg;
- dropgid = 1;
break;
case 'm':
sortby = SORTMEM;
break;
case 'N':
nlistf = optarg;
- dropgid = 1;
break;
case 'O':
parsefmt(o1, 1);
@@ -423,14 +421,6 @@ main(int argc, char *argv[])
if (xkeep < 0) /* Neither -X nor -x was specified. */
xkeep = xkeep_implied;
-
- /*
- * Discard setgid privileges if not the running kernel so that bad
- * guys can't print interesting stuff from kernel memory.
- */
- if (dropgid)
- setgid(getgid());
-
kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, errbuf);
if (kd == 0)
errx(1, "%s", errbuf);
diff --git a/usr.bin/pkill/Makefile b/usr.bin/pkill/Makefile
index 758d3b0..632d6f4 100644
--- a/usr.bin/pkill/Makefile
+++ b/usr.bin/pkill/Makefile
@@ -7,9 +7,6 @@ WARNS?= 5
DPADD= ${LIBKVM}
LDADD= -lkvm
-#BINGRP= kmem
-#BINMODE= 2555
-
LINKS= ${BINDIR}/pkill ${BINDIR}/pgrep
MLINKS= pkill.1 pgrep.1
diff --git a/usr.bin/pkill/pkill.c b/usr.bin/pkill/pkill.c
index 3051f95..f49bc9e 100644
--- a/usr.bin/pkill/pkill.c
+++ b/usr.bin/pkill/pkill.c
@@ -124,7 +124,7 @@ main(int argc, char **argv)
char buf[_POSIX2_LINE_MAX], *mstr, **pargv, *p, *q;
const char *execf, *coref;
int debug_opt;
- int i, ch, bestidx, rv, criteria, drop_privs;
+ int i, ch, bestidx, rv, criteria;
size_t jsz;
void (*action)(struct kinfo_proc *);
struct kinfo_proc *kp;
@@ -166,7 +166,6 @@ main(int argc, char **argv)
criteria = 0;
debug_opt = 0;
- drop_privs = 0;
execf = coref = _PATH_DEVNULL;
while ((ch = getopt(argc, argv, "DG:M:N:P:U:d:fg:lns:t:u:vx")) != -1)
@@ -180,11 +179,9 @@ main(int argc, char **argv)
break;
case 'M':
coref = optarg;
- drop_privs = 1;
break;
case 'N':
execf = optarg;
- drop_privs = 1;
break;
case 'P':
makelist(&ppidlist, LT_GENERIC, optarg);
@@ -245,15 +242,6 @@ main(int argc, char **argv)
if (!criteria)
usage();
- /*
- * Discard privileges if not the running kernel so that bad
- * guys can't print interesting stuff from kernel memory.
- */
- if (drop_privs) {
- setgid(getgid());
- setuid(getuid());
- }
-
mypid = getpid();
/*
OpenPOWER on IntegriCloud