selftests/seccomp: fix syscall_restart test for arm compat
authorNeill Kapron <nkapron@google.com>
Sun, 27 Apr 2025 09:40:58 +0000 (09:40 +0000)
committerKees Cook <kees@kernel.org>
Wed, 30 Apr 2025 21:21:03 +0000 (14:21 -0700)
commit797002deed03491215a352ace891749b39741b69
tree83e538354fc9cbae810061cf3970ac3519715cd3
parent8ffd015db85fea3e15a77027fda6c02ced4d2444
selftests/seccomp: fix syscall_restart test for arm compat

The inconsistencies in the systcall ABI between arm and arm-compat can
can cause a failure in the syscall_restart test due to the logic
attempting to work around the differences. The 'machine' field for an
ARM64 device running in compat mode can report 'armv8l' or 'armv8b'
which matches with the string 'arm' when only examining the first three
characters of the string.

This change adds additional validation to the workaround logic to make
sure we only take the arm path when running natively, not in arm-compat.

Fixes: 256d0afb11d6 ("selftests/seccomp: build and pass on arm64")
Signed-off-by: Neill Kapron <nkapron@google.com>
Link: https://lore.kernel.org/r/20250427094103.3488304-2-nkapron@google.com
Signed-off-by: Kees Cook <kees@kernel.org>
tools/testing/selftests/seccomp/seccomp_bpf.c