diff options
Diffstat (limited to 'regress/sys/kern/tame/generic/main.c')
-rw-r--r-- | regress/sys/kern/tame/generic/main.c | 48 |
1 files changed, 47 insertions, 1 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 */ |