Skip to contentSkip to conversation

exec: test ->recursion_depth

PATCH New Alexey Dobriyan 1 participant 1 message Apr 23, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 exec: test ->recursion_depth

Test that trivially recursing script onto itself doesn't work.

Note: this is different test from ELOOP tests in execveat.c Those test that execveat(2) doesn't follow symlinks when told to do so.

---

 tools/testing/selftests/exec/.gitignore        |    3 -
 tools/testing/selftests/exec/Makefile          |    4 +
 tools/testing/selftests/exec/recursion-depth.c |   67 +++++++++++++++++++++++++
 3 files changed, 73 insertions(+), 1 deletion(-)
tools/testing/selftests/exec/.gitignore +2 -1
@@ -6,4 +6,5 @@ execveat.moved
 execveat.path.ephemeral
 execveat.ephemeral
 execveat.denatured
-xxxxxxxx*
\ No newline at end of file
+/recursion-depth
+xxxxxxxx*
tools/testing/selftests/exec/Makefile +4 -0
@@ -1,11 +1,15 @@
 # SPDX-License-Identifier: GPL-2.0
 CFLAGS = -Wall
+CFLAGS += -Wno-nonnull
+CFLAGS += -D_GNU_SOURCE
 
 TEST_GEN_PROGS := execveat
 TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir
 # Makefile is a run-time dependency, since it's accessed by the execveat test
 TEST_FILES := Makefile
 
+TEST_GEN_PROGS += recursion-depth
+
 EXTRA_CLEAN := $(OUTPUT)/subdir.moved $(OUTPUT)/execveat.moved $(OUTPUT)/xxxxx*
 
 include ../lib.mk

new file mode 100644

tools/testing/selftests/exec/recursion-depth.c new file +67 -0

67 lines not on this page · raw message