summaryrefslogtreecommitdiff
path: root/usr.bin/kdump
diff options
context:
space:
mode:
authorRicardo Mestre <mestre@cvs.openbsd.org>2018-08-11 11:01:38 +0000
committerRicardo Mestre <mestre@cvs.openbsd.org>2018-08-11 11:01:38 +0000
commita6c7fc8aaa0c3a001e6bb034c4bc30340eeab13a (patch)
treef432eca0499e19870db2c54e9df26a92ebc866bf /usr.bin/kdump
parent4bf1832a5279b0512a6cd3a9bc03fa9dd114b60a (diff)
the only fs access kdump(1) needs is to the tracefile which by default is
ktrace.out unless argument -f is used. We can just unveil(2) that file with read permissions before the pledge(2) call. OK deraadt@
Diffstat (limited to 'usr.bin/kdump')
-rw-r--r--usr.bin/kdump/kdump.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c
index b80f7450685..fdaea84b2bb 100644
--- a/usr.bin/kdump/kdump.c
+++ b/usr.bin/kdump/kdump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kdump.c,v 1.133 2017/11/28 15:35:02 guenther Exp $ */
+/* $OpenBSD: kdump.c,v 1.134 2018/08/11 11:01:37 mestre Exp $ */
/*-
* Copyright (c) 1988, 1993
@@ -208,6 +208,8 @@ main(int argc, char *argv[])
if (argc > optind)
usage();
+ if (unveil(tracefile, "r") == -1)
+ err(1, "unveil");
if (pledge("stdio rpath getpw", NULL) == -1)
err(1, "pledge");