summaryrefslogtreecommitdiff
path: root/regress/sys/kern
diff options
context:
space:
mode:
Diffstat (limited to 'regress/sys/kern')
-rw-r--r--regress/sys/kern/tame/generic/main.c48
-rw-r--r--regress/sys/kern/tame/generic/tests.out5
2 files changed, 51 insertions, 2 deletions
diff --git a/regress/sys/kern/tame/generic/main.c b/regress/sys/kern/tame/generic/main.c
index 3d597c1187e..c7e7e0ee883 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.8 2015/09/30 11:36:07 semarie Exp $ */
+/* $OpenBSD: main.c,v 1.9 2015/10/06 15:24:54 semarie Exp $ */
/*
* Copyright (c) 2015 Sebastien Marie <semarie@openbsd.org>
*
@@ -200,6 +200,48 @@ test_mmap()
close(fd);
}
+static void
+test_rpath()
+{
+ int fd;
+ char data[512];
+
+ if ((fd = open("/dev/zero", O_RDONLY, 0)) == -1)
+ _exit(errno);
+
+ if (read(fd, data, sizeof(data)) == -1)
+ _exit(errno);
+
+ close(fd);
+}
+
+static void
+test_wpath()
+{
+ int fd;
+ char data[] = { 0x01, 0x02, 0x03, 0x04, 0x05 };
+
+ if ((fd = open("/dev/null", O_WRONLY, 0)) == -1)
+ _exit(errno);
+
+ if (write(fd, data, sizeof(data)) == -1)
+ _exit(errno);
+
+ close(fd);
+}
+
+static void
+test_cpath()
+{
+ const char filename[] = "/tmp/generic-test-cpath";
+
+ if (mkdir(filename, S_IRWXU) == -1)
+ _exit(errno);
+
+ if (rmdir(filename) == -1)
+ _exit(errno);
+}
+
int
main(int argc, char *argv[])
{
@@ -249,6 +291,10 @@ main(int argc, char *argv[])
start_test(&ret, "abort", NULL, test_allowed_syscalls);
start_test(&ret, "fattr", NULL, test_allowed_syscalls);
+ start_test(&ret, "rpath", NULL, test_rpath);
+ start_test(&ret, "wpath", NULL, test_wpath);
+ start_test(&ret, "cpath", NULL, test_cpath);
+
/*
* test whitelist path
*/
diff --git a/regress/sys/kern/tame/generic/tests.out b/regress/sys/kern/tame/generic/tests.out
index deb3e6c4f04..dcc6cb83ed6 100644
--- a/regress/sys/kern/tame/generic/tests.out
+++ b/regress/sys/kern/tame/generic/tests.out
@@ -1,4 +1,4 @@
-# $OpenBSD: tests.out,v 1.7 2015/09/30 11:36:07 semarie Exp $
+# $OpenBSD: tests.out,v 1.8 2015/10/06 15:24: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
@@ -21,6 +21,9 @@ test(test_allowed_syscalls): tame=("proc",NULL) status=9 signal=9 tamed_syscall=
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_rpath): tame=("rpath",NULL) status=0 exit=0
+test(test_wpath): tame=("wpath",NULL) status=0 exit=0
+test(test_cpath): tame=("cpath",NULL) status=0 exit=0
test(test_wpaths): tame=("stdio rpath",NULL)
open_close("/etc/passwd") fd=3 errno=0
open_close("generic") fd=3 errno=0