summaryrefslogtreecommitdiff
path: root/regress/sys
diff options
context:
space:
mode:
authorSebastien Marie <semarie@cvs.openbsd.org>2015-09-24 06:52:23 +0000
committerSebastien Marie <semarie@cvs.openbsd.org>2015-09-24 06:52:23 +0000
commit15feb74511f685ef49cc6b1bca5e92ec8c8923a8 (patch)
tree9d51df0237dcdee0aaa775caf7855bc40febbe27 /regress/sys
parent967eb1312e03c298a8d2f86f5baa50eed93b87b5 (diff)
tame("xxx", NULL) and tame("xxx", {NULL}) are not the same
- change output of regress to reflect that - add test
Diffstat (limited to 'regress/sys')
-rw-r--r--regress/sys/kern/tame/generic/main.c3
-rw-r--r--regress/sys/kern/tame/generic/manager.c14
-rw-r--r--regress/sys/kern/tame/generic/tests.out64
3 files changed, 46 insertions, 35 deletions
diff --git a/regress/sys/kern/tame/generic/main.c b/regress/sys/kern/tame/generic/main.c
index 5789398bf6a..b2a775af072 100644
--- a/regress/sys/kern/tame/generic/main.c
+++ b/regress/sys/kern/tame/generic/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.4 2015/09/24 06:25:54 semarie Exp $ */
+/* $OpenBSD: main.c,v 1.5 2015/09/24 06:52:22 semarie Exp $ */
/*
* Copyright (c) 2015 Sebastien Marie <semarie@openbsd.org>
*
@@ -187,6 +187,7 @@ main(int argc, char *argv[])
* test whitelist path
*/
start_test(&ret, "stdio rpath", NULL, test_wpaths);
+ start_test1(&ret, "stdio rpath", NULL, test_wpaths);
// XXX start_test1(&ret, "stdio rpath", "/", test_wpaths);
start_test1(&ret, "stdio rpath", "/etc", test_wpaths);
start_test1(&ret, "stdio rpath", "/etc/", test_wpaths);
diff --git a/regress/sys/kern/tame/generic/manager.c b/regress/sys/kern/tame/generic/manager.c
index 76b7965c79a..0cc70cab032 100644
--- a/regress/sys/kern/tame/generic/manager.c
+++ b/regress/sys/kern/tame/generic/manager.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: manager.c,v 1.3 2015/09/24 06:25:54 semarie Exp $ */
+/* $OpenBSD: manager.c,v 1.4 2015/09/24 06:52:22 semarie Exp $ */
/*
* Copyright (c) 2015 Sebastien Marie <semarie@openbsd.org>
*
@@ -175,10 +175,14 @@ _start_test(int *ret, const char *test_name, const char *request,
int i;
/* early print testname */
- printf("test(%s): tame=(\"%s\",{", test_name, request);
- for (i = 0; paths && paths[i] != NULL; i++)
- printf("\"%s\",", paths[i]);
- printf("NULL})");
+ printf("test(%s): tame=(\"%s\",", test_name, request);
+ if (paths) {
+ printf("{");
+ for (i = 0; paths[i] != NULL; i++)
+ printf("\"%s\",", paths[i]);
+ printf("NULL})");
+ } else
+ printf("NULL)");
/* unlink previous coredump (if exists) */
if (clear_coredump(ret, test_name) == -1)
diff --git a/regress/sys/kern/tame/generic/tests.out b/regress/sys/kern/tame/generic/tests.out
index e167b3c8f9f..b3fd8d35e74 100644
--- a/regress/sys/kern/tame/generic/tests.out
+++ b/regress/sys/kern/tame/generic/tests.out
@@ -1,32 +1,38 @@
-# $OpenBSD: tests.out,v 1.3 2015/09/24 06:25:54 semarie Exp $
-test(test_nop): tame=("",{NULL}) status=0 exit=0
-test(test_inet): tame=("",{NULL}) status=9 signal=9 tamed_syscall=97
-test(test_inet): tame=("abort",{NULL}) status=134 signal=6 coredump=present tamed_syscall=97
-test(test_inet): tame=("inet",{NULL}) status=0 exit=0
-test(test_kill): tame=("inet",{NULL}) status=9 signal=9 tamed_syscall=37
-test(test_kill): tame=("proc",{NULL}) status=2 signal=2 tamed_syscall=not_found
-test(test_allowed_syscalls): tame=("malloc",{NULL}) status=0 exit=0
-test(test_allowed_syscalls): tame=("rw",{NULL}) status=0 exit=0
-test(test_allowed_syscalls): tame=("stdio",{NULL}) status=0 exit=0
-test(test_allowed_syscalls): tame=("rpath",{NULL}) status=0 exit=0
-test(test_allowed_syscalls): tame=("wpath",{NULL}) status=0 exit=0
-test(test_allowed_syscalls): tame=("tmppath",{NULL}) status=0 exit=0
-test(test_allowed_syscalls): tame=("inet",{NULL}) status=0 exit=0
-test(test_allowed_syscalls): tame=("unix",{NULL}) status=0 exit=0
-test(test_allowed_syscalls): tame=("cmsg",{NULL}) status=0 exit=0
-test(test_allowed_syscalls): tame=("dns",{NULL}) status=0 exit=0
-test(test_allowed_syscalls): tame=("getpw",{NULL}) status=0 exit=0
-test(test_allowed_syscalls): tame=("ioctl",{NULL}) status=9 signal=9 tamed_syscall=89
-test(test_allowed_syscalls): tame=("proc",{NULL}) status=9 signal=9 tamed_syscall=89
-test(test_allowed_syscalls): tame=("cpath",{NULL}) status=9 signal=9 tamed_syscall=89
-test(test_allowed_syscalls): tame=("abort",{NULL}) status=134 signal=6 coredump=present tamed_syscall=89
-test(test_allowed_syscalls): tame=("fattr",{NULL}) status=9 signal=9 tamed_syscall=89
-test(test_wpaths): tame=("stdio rpath",{NULL})
+# $OpenBSD: tests.out,v 1.4 2015/09/24 06:52:22 semarie Exp $
+test(test_nop): tame=("",NULL) status=0 exit=0
+test(test_inet): tame=("",NULL) status=9 signal=9 tamed_syscall=97
+test(test_inet): tame=("abort",NULL) status=134 signal=6 coredump=present tamed_syscall=97
+test(test_inet): tame=("inet",NULL) status=0 exit=0
+test(test_kill): tame=("inet",NULL) status=9 signal=9 tamed_syscall=37
+test(test_kill): tame=("proc",NULL) status=2 signal=2 tamed_syscall=not_found
+test(test_allowed_syscalls): tame=("malloc",NULL) status=0 exit=0
+test(test_allowed_syscalls): tame=("rw",NULL) status=0 exit=0
+test(test_allowed_syscalls): tame=("stdio",NULL) status=0 exit=0
+test(test_allowed_syscalls): tame=("rpath",NULL) status=0 exit=0
+test(test_allowed_syscalls): tame=("wpath",NULL) status=0 exit=0
+test(test_allowed_syscalls): tame=("tmppath",NULL) status=0 exit=0
+test(test_allowed_syscalls): tame=("inet",NULL) status=0 exit=0
+test(test_allowed_syscalls): tame=("unix",NULL) status=0 exit=0
+test(test_allowed_syscalls): tame=("cmsg",NULL) status=0 exit=0
+test(test_allowed_syscalls): tame=("dns",NULL) status=0 exit=0
+test(test_allowed_syscalls): tame=("getpw",NULL) status=0 exit=0
+test(test_allowed_syscalls): tame=("ioctl",NULL) status=9 signal=9 tamed_syscall=89
+test(test_allowed_syscalls): tame=("proc",NULL) status=9 signal=9 tamed_syscall=89
+test(test_allowed_syscalls): tame=("cpath",NULL) status=9 signal=9 tamed_syscall=89
+test(test_allowed_syscalls): tame=("abort",NULL) status=134 signal=6 coredump=present tamed_syscall=89
+test(test_allowed_syscalls): tame=("fattr",NULL) status=9 signal=9 tamed_syscall=89
+test(test_wpaths): tame=("stdio rpath",NULL)
open_close("/etc/passwd") fd=3 errno=0
open_close("generic") fd=3 errno=0
open_close("../../../../../../../../../../../../../../../etc/passwd") fd=3 errno=0
open_close("/nonexistent") fd=-1 errno=2
status=0 exit=0
+test(test_wpaths): tame=("stdio rpath",{NULL})
+ open_close("/etc/passwd") fd=-1 errno=2
+ open_close("generic") fd=-1 errno=2
+ open_close("../../../../../../../../../../../../../../../etc/passwd") fd=-1 errno=2
+ open_close("/nonexistent") fd=-1 errno=2
+ status=0 exit=0
test(test_wpaths): tame=("stdio rpath",{"/etc",NULL})
open_close("/etc/passwd") fd=3 errno=0
open_close("generic") fd=-1 errno=2
@@ -69,10 +75,10 @@ test(test_wpaths): tame=("stdio rpath",{".",NULL})
open_close("../../../../../../../../../../../../../../../etc/passwd") fd=-1 errno=2
open_close("/nonexistent") fd=-1 errno=2
status=0 exit=0
-test(test_tame): tame=("stdio rpath",{NULL}) status=0 exit=0
-test(test_tame): tame=("malloc rw rpath",{NULL}) status=0 exit=0
-test(test_tame): tame=("stdio rpath wpath",{NULL}) status=0 exit=0
+test(test_tame): tame=("stdio rpath",NULL) status=0 exit=0
+test(test_tame): tame=("malloc rw rpath",NULL) status=0 exit=0
+test(test_tame): tame=("stdio rpath wpath",NULL) status=0 exit=0
test(test_tame): tame=("stdio rpath wpath",{"/sbin",NULL}) status=256 exit=1 (errno: "Operation not permitted")
test(test_tame): tame=("stdio rpath wpath",{"/",NULL}) status=256 exit=1 (errno: "Operation not permitted")
-test(test_tame): tame=("stdio",{NULL}) status=256 exit=1 (errno: "Operation not permitted")
-test(test_tame): tame=("cmsg",{NULL}) status=256 exit=1 (errno: "Operation not permitted")
+test(test_tame): tame=("stdio",NULL) status=256 exit=1 (errno: "Operation not permitted")
+test(test_tame): tame=("cmsg",NULL) status=256 exit=1 (errno: "Operation not permitted")