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>
This commit is contained in:
Marcos Paulo de Souza 2026-05-04 15:34:42 -03:00 committed by Petr Mladek
parent d3d9443f8b
commit f4f7140c70

View File

@ -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 */