summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2015-10-04 18:49:30 +0000
committerderaadt <deraadt@openbsd.org>2015-10-04 18:49:30 +0000
commitd85e1e30f1bc2f6b98b133d84e144ac38304d700 (patch)
treeaf2c75e89f7fbc9d1b2364ee2f05e5d7204b3f74
parentremove tame "proc". it is not useful, because the "ed" diffs require (diff)
downloadwireguard-openbsd-d85e1e30f1bc2f6b98b133d84e144ac38304d700.tar.xz
wireguard-openbsd-d85e1e30f1bc2f6b98b133d84e144ac38304d700.zip
dmesg has two modes. The normal sysctl mode, and the -M/-N kvm searcher.
In both cases once the relevant setup is done, it can drop to tame "stdio".
-rw-r--r--sbin/dmesg/dmesg.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sbin/dmesg/dmesg.c b/sbin/dmesg/dmesg.c
index 53455ec3318..28c83f56c8d 100644
--- a/sbin/dmesg/dmesg.c
+++ b/sbin/dmesg/dmesg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dmesg.c,v 1.25 2015/01/16 06:39:57 deraadt Exp $ */
+/* $OpenBSD: dmesg.c,v 1.26 2015/10/04 18:49:30 deraadt Exp $ */
/* $NetBSD: dmesg.c,v 1.8 1995/03/18 14:54:49 cgd Exp $ */
/*-
@@ -108,6 +108,9 @@ main(int argc, char *argv[])
if (sysctl(mib, 2, bufdata, &len, NULL, 0))
err(1, "sysctl: KERN_MSGBUF");
+ if (tame("stdio", NULL) == -1)
+ err(1, "tame");
+
memcpy(&cur, bufdata, sizeof(cur));
bufdata = ((struct msgbuf *)bufdata)->msg_bufc;
} else {
@@ -120,6 +123,9 @@ main(int argc, char *argv[])
"dmesg")) == NULL)
return (1);
+ if (tame("stdio", NULL) == -1)
+ err(1, "tame");
+
if (kvm_nlist(kd, nl) == -1)
errx(1, "kvm_nlist: %s", kvm_geterr(kd));
if (nl[X_MSGBUF].n_type == 0)