summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/livepatch
diff options
context:
space:
mode:
authorMarcos Paulo de Souza <mpdesouza@suse.com>2026-05-04 15:34:42 -0300
committerPetr Mladek <pmladek@suse.com>2026-05-06 14:09:33 +0200
commitf4f7140c701d876e5beeb5337887a6c0822c6cb9 (patch)
tree5f1ed87c28f439f9a3b7460056efb46d6efd13d8 /tools/testing/selftests/livepatch
parentd3d9443f8bac799340bb04db51ef4ababc4f7267 (diff)
downloadlwn-f4f7140c701d876e5beeb5337887a6c0822c6cb9.tar.gz
lwn-f4f7140c701d876e5beeb5337887a6c0822c6cb9.zip
selftests: livepatch: Check for ARCH_HAS_SYSCALL_WRAPPER config
Older kernels that lack CONFIG_ARCH_HAS_SYSCALL_WRAPPER config don't have any prefixes for their syscalls. The same applies to current powerpc and loongarch, covering all currently supported architectures that support livepatch. The other supported architectures have specific prefixes, so error out when a new architecture adds livepatch support with wrappers but didn't update the test to include it. Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com> Reviewed-by: Petr Mladek <pmladek@suse.com> Acked-by: Joe Lawrence <joe.lawrence@redhat.com> Link: https://patch.msgid.link/20260504-lp-tests-old-fixes-v5-1-0be26d94ab9a@suse.com Signed-off-by: Petr Mladek <pmladek@suse.com>
Diffstat (limited to 'tools/testing/selftests/livepatch')
-rw-r--r--tools/testing/selftests/livepatch/test_modules/test_klp_syscall.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/tools/testing/selftests/livepatch/test_modules/test_klp_syscall.c b/tools/testing/selftests/livepatch/test_modules/test_klp_syscall.c
index dd802783ea84..0630ffd9d9a1 100644
--- a/tools/testing/selftests/livepatch/test_modules/test_klp_syscall.c
+++ b/tools/testing/selftests/livepatch/test_modules/test_klp_syscall.c
@@ -12,15 +12,26 @@
#include <linux/slab.h>
#include <linux/livepatch.h>
-#if defined(__x86_64__)
-#define FN_PREFIX __x64_
-#elif defined(__s390x__)
-#define FN_PREFIX __s390x_
-#elif defined(__aarch64__)
-#define FN_PREFIX __arm64_
+/*
+ * Before CONFIG_ARCH_HAS_SYSCALL_WRAPPER was introduced there were no
+ * prefixes for system calls.
+ * powerpc set this config based on configs, so it can be enabled or not.
+ */
+#if defined(CONFIG_ARCH_HAS_SYSCALL_WRAPPER)
+ #if defined(__x86_64__)
+ #define FN_PREFIX __x64_
+ #elif defined(__s390x__)
+ #define FN_PREFIX __s390x_
+ #elif defined(__aarch64__)
+ #define FN_PREFIX __arm64_
+ #elif defined(__powerpc__)
+ #define FN_PREFIX
+ #else
+ #error "Missing syscall wrapper for the given architecture."
+ #endif
#else
-/* powerpc does not select ARCH_HAS_SYSCALL_WRAPPER */
-#define FN_PREFIX
+ /* Do not set a prefix for architectures that do not enable wrappers. */
+ #define FN_PREFIX
#endif
/* Protects klp_pids */