selftest for default_file_splice_read() infoleak
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 19 Feb 2017 03:07:24 +0000 (22:07 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 19 Feb 2017 03:07:24 +0000 (22:07 -0500)
bug fixed in commit b9dc6f65bc5e ("fix a fencepost error in pipe_advance()")

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
tools/testing/selftests/Makefile
tools/testing/selftests/splice/Makefile [new file with mode: 0644]
tools/testing/selftests/splice/default_file_splice_read.c [new file with mode: 0644]
tools/testing/selftests/splice/default_file_splice_read.sh [new file with mode: 0755]

index 71b05891a6a14adfe7537e70333352b844966134..0e72f1d03c9ece7c32eaa7390d10a49888d56a95 100644 (file)
@@ -24,6 +24,7 @@ TARGETS += ptrace
 TARGETS += seccomp
 TARGETS += sigaltstack
 TARGETS += size
+TARGETS += splice
 TARGETS += static_keys
 TARGETS += sync
 TARGETS += sysctl
diff --git a/tools/testing/selftests/splice/Makefile b/tools/testing/selftests/splice/Makefile
new file mode 100644 (file)
index 0000000..de51f43
--- /dev/null
@@ -0,0 +1,8 @@
+TEST_PROGS := default_file_splice_read.sh
+EXTRA := default_file_splice_read
+all: $(TEST_PROGS) $(EXTRA)
+
+include ../lib.mk
+
+clean:
+       rm -fr $(TEST_PROGS) $(EXTRA)
diff --git a/tools/testing/selftests/splice/default_file_splice_read.c b/tools/testing/selftests/splice/default_file_splice_read.c
new file mode 100644 (file)
index 0000000..01dd609
--- /dev/null
@@ -0,0 +1,8 @@
+#define _GNU_SOURCE
+#include <fcntl.h>
+
+int main(int argc, char **argv)
+{
+        splice(0, 0, 1, 0, 1<<30, 0);
+       return 0;
+}
diff --git a/tools/testing/selftests/splice/default_file_splice_read.sh b/tools/testing/selftests/splice/default_file_splice_read.sh
new file mode 100755 (executable)
index 0000000..1ea2ade
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+n=`./default_file_splice_read </dev/null | wc -c`
+
+test "$n" = 0 && exit 0
+
+echo "default_file_splice_read broken: leaked $n"
+exit 1