aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2012-03-05 00:22:23 -0500
committerMike Frysinger <vapier@gentoo.org>2012-03-06 14:00:33 -0500
commite2744dbc889d63fad8a2c819db4785b45d3c8c62 (patch)
tree5edfc8c2f197806c7508fe0c3e16a243361b7733
parentlibsandbox: set syscall error rather than killing on violations (diff)
downloadsandbox-e2744dbc889d63fad8a2c819db4785b45d3c8c62.tar.gz
sandbox-e2744dbc889d63fad8a2c819db4785b45d3c8c62.tar.bz2
sandbox-e2744dbc889d63fad8a2c819db4785b45d3c8c62.zip
tests: add static unlink tests
Make sure that when we trace static apps, their bad syscalls don't get a chance to actually complete. URL: http://bugs.gentoo.org/406543 Reported-by: Marijn Schouten <hkbst@gentoo.org> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/unlink_static-0.c1
-rwxr-xr-xtests/unlink_static-1.sh10
-rw-r--r--tests/unlink_static.at1
4 files changed, 13 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2646228..71c2872 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -62,6 +62,7 @@ check_PROGRAMS = \
truncate-0 \
truncate64-0 \
unlink-0 \
+ unlink_static-0 \
unlinkat-0 \
utime-0 \
utimensat-0 \
diff --git a/tests/unlink_static-0.c b/tests/unlink_static-0.c
new file mode 100644
index 0000000..efb4c91
--- /dev/null
+++ b/tests/unlink_static-0.c
@@ -0,0 +1 @@
+#include "unlink-0.c"
diff --git a/tests/unlink_static-1.sh b/tests/unlink_static-1.sh
new file mode 100755
index 0000000..62cb6b7
--- /dev/null
+++ b/tests/unlink_static-1.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+# make sure we catch openat with relative path
+[ "${at_xfail}" = "yes" ] && exit 77 # see trace-0
+
+export SANDBOX_LOG=$PWD/sb.log
+touch f
+test -e f || exit 1
+adddeny "${PWD}"
+unlink_static-0 -1,EPERM f
+test -e sb.log -a -e f
diff --git a/tests/unlink_static.at b/tests/unlink_static.at
new file mode 100644
index 0000000..081d7d2
--- /dev/null
+++ b/tests/unlink_static.at
@@ -0,0 +1 @@
+SB_CHECK(1)