diff options
author | Eugene Syromyatnikov <evgsyr@gmail.com> | 2021-08-14 14:27:28 +0200 |
---|---|---|
committer | Dmitry V. Levin <ldv@strace.io> | 2021-08-14 12:27:28 +0000 |
commit | c0e0c2917a6d1200cc52f72469d37f4f761b1f8b (patch) | |
tree | b07a642a7eccdab3fb5fb2ebb188fe3e7971d2fb | |
parent | be861226079d544f6cb32ea233e6b50895c6db40 (diff) | |
download | strace-c0e0c2917a6d1200cc52f72469d37f4f761b1f8b.tar.gz |
tests: move scno tampering check to init.sh
And convert it to a function.
* tests/init.sh (check_scno_tampering): New funtion, move the body
from...
* tests/scno_tampering.sh: ...here; call check_scno_tampering.
-rw-r--r-- | tests/init.sh | 38 | ||||
-rwxr-xr-x | tests/scno_tampering.sh | 35 |
2 files changed, 39 insertions, 34 deletions
diff --git a/tests/init.sh b/tests/init.sh index 289e2c660..349a95851 100644 --- a/tests/init.sh +++ b/tests/init.sh @@ -464,6 +464,44 @@ test_pidns() test_pidns_run_strace "$@" } +check_scno_tampering() +{ + uname_r="$(uname -r)" + case "$STRACE_ARCH" in + arm) + # PTRACE_SET_SYSCALL is supported by linux kernel + # starting with commit v2.6.16-rc1~107^2. + require_min_kernel_version_or_skip 2.6.16 ;; + aarch64) + # NT_ARM_SYSTEM_CALL regset is supported by linux kernel + # starting with commit v3.19-rc1~59^2~16. + require_min_kernel_version_or_skip 3.19 ;; + hppa) + # Syscall number and return value modification did not work + # properly before commit v4.5-rc7~31^2~1. + require_min_kernel_version_or_skip 4.5 ;; + sparc*) + # Reloading the syscall number from %g1 register is supported + # by linux kernel starting with commit v4.5-rc7~35^2~3. + require_min_kernel_version_or_skip 4.5 ;; + mips) + # Only the native ABI is supported by the kernel properly, see + # https://lists.strace.io/pipermail/strace-devel/2017-January/005896.html + msg_prefix="mips $MIPS_ABI scno tampering does not work" + uname_m="$(uname -m)" + case "$MIPS_ABI:$uname_m" in + n64:mips64) ;; + o32:mips) + # is it really mips32? + if ../is_linux_mips_n64; then + skip_ "$msg_prefix on mips n64 yet" + fi + ;; + *) skip_ "$msg_prefix on $uname_m yet" ;; + esac ;; + esac +} + check_prog cat check_prog rm diff --git a/tests/scno_tampering.sh b/tests/scno_tampering.sh index 5480dcfb3..a7d0d4650 100755 --- a/tests/scno_tampering.sh +++ b/tests/scno_tampering.sh @@ -10,37 +10,4 @@ . "${srcdir=.}/init.sh" -uname_r="$(uname -r)" -case "$STRACE_ARCH" in - arm) - # PTRACE_SET_SYSCALL is supported by linux kernel - # starting with commit v2.6.16-rc1~107^2. - require_min_kernel_version_or_skip 2.6.16 ;; - aarch64) - # NT_ARM_SYSTEM_CALL regset is supported by linux kernel - # starting with commit v3.19-rc1~59^2~16. - require_min_kernel_version_or_skip 3.19 ;; - hppa) - # Syscall number and return value modification did not work - # properly before commit v4.5-rc7~31^2~1. - require_min_kernel_version_or_skip 4.5 ;; - sparc*) - # Reloading the syscall number from %g1 register is supported - # by linux kernel starting with commit v4.5-rc7~35^2~3. - require_min_kernel_version_or_skip 4.5 ;; - mips) - # Only the native ABI is supported by the kernel properly, see - # https://lists.strace.io/pipermail/strace-devel/2017-January/005896.html - msg_prefix="mips $MIPS_ABI scno tampering does not work" - uname_m="$(uname -m)" - case "$MIPS_ABI:$uname_m" in - n64:mips64) ;; - o32:mips) - # is it really mips32? - if ../is_linux_mips_n64; then - skip_ "$msg_prefix on mips n64 yet" - fi - ;; - *) skip_ "$msg_prefix on $uname_m yet" ;; - esac ;; -esac +check_scno_tampering |