diff options
author | 2021-11-03 15:11:33 -0400 | |
---|---|---|
committer | 2021-11-03 15:11:33 -0400 | |
commit | 369fc5965ce5065f2653225627f61442641c5bef (patch) | |
tree | 4bd8bd61cf878902f60c7c4afc6a6c2fb3b921dc | |
parent | libsandbox: refine yama check to abort on level 3+ (diff) | |
download | sandbox-369fc5965ce5065f2653225627f61442641c5bef.tar.gz sandbox-369fc5965ce5065f2653225627f61442641c5bef.tar.bz2 sandbox-369fc5965ce5065f2653225627f61442641c5bef.zip |
tests: skip static children tests when YAMA ptrace_scope is enabled
Since we can't trace static children under certain YAMA ptrace_scope
settings, skip tests that rely on that functionality.
Closes: https://bugs.gentoo.org/821418
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r-- | tests/atlocal.in | 9 | ||||
-rwxr-xr-x | tests/script-17.sh | 8 | ||||
-rwxr-xr-x | tests/script-8.sh | 3 |
3 files changed, 19 insertions, 1 deletions
diff --git a/tests/atlocal.in b/tests/atlocal.in index e8213c0..adf3bad 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -42,5 +42,14 @@ case "${MAKEFLAGS}" in ;; esac +# Figure out currently YAMA ptrace_scope restriction level. +at_yama_ptrace_scope=$(cat /proc/sys/kernel/yama/ptrace_scope 2>/dev/null || echo 0) +if [ ${at_yama_ptrace_scope} -gt 0 ] ; then + if [ "$(id -u)" -eq 0 ] ; then + at_yama_ptrace_scope=0 + fi +fi +export at_yama_ptrace_scope + # This script must finish with ($? == 0) else the autotest runner gets upset. : diff --git a/tests/script-17.sh b/tests/script-17.sh index a8a8f51..83c51f9 100755 --- a/tests/script-17.sh +++ b/tests/script-17.sh @@ -10,7 +10,13 @@ adddeny "${PWD}/subdir" for child in 0 1 2 3 4 5 ; do fork-follow_tst ${child} subdir/dyn${child} || exit $? done -for child in 0 1 2 3 4 5 ; do + +depth="0" +# We can't trace static children currently with YAMA ptrace_scope 1+. +if [ ${at_yama_ptrace_scope} -eq 0 ] ; then + depth="${depth} 1 2 3 4 5" +fi +for child in ${depth} ; do fork-follow_static_tst ${child} subdir/static${child} || exit $? done diff --git a/tests/script-8.sh b/tests/script-8.sh index 6d9de55..9d8ca11 100755 --- a/tests/script-8.sh +++ b/tests/script-8.sh @@ -6,6 +6,9 @@ sigsuspend-zsh_tst d=$? echo "ret = $d" +# We can't trace static children currently with YAMA ptrace_scope 1+. +[ ${at_yama_ptrace_scope} -gt 0 ] && exit ${d} + sigsuspend-zsh_static_tst s=$? echo "ret = $s" |