On Mon, 13 Apr 2026, Marcos Paulo de Souza wrote:
> 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 wrappes but didn't
> update the test to include it.
>
> Signed-off-by: Marcos Paulo de Souza <[email protected]>
> ---
> .../selftests/livepatch/test_modules/test_klp_syscall.c | 17
> ++++++++++++++---
> 1 file changed, 14 insertions(+), 3 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..b5527a288a7c 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__)
> +/*
> + * Before CONFIG_ARCH_HAS_SYSCALL_WRAPPER was introduced there were no
> + * prefixes for system calls.
> + * Both ppc and loongarch does not set prefixes for their system calls
> either.
> + */
> +#if !defined(CONFIG_ARCH_HAS_SYSCALL_WRAPPER) || defined(__powerpc__) || \
> + defined(__loongarch__)
> +#define FN_PREFIX
> +#elif defined(__x86_64__)
> #define FN_PREFIX __x64_
> #elif defined(__s390x__)
> #define FN_PREFIX __s390x_
> #elif defined(__aarch64__)
> #define FN_PREFIX __arm64_
> -#else
> -/* powerpc does not select ARCH_HAS_SYSCALL_WRAPPER */
> +#elif defined(__powerpc__)
> +#define FN_PREFIX
> +#elif defined(__loongarch__)
> #define FN_PREFIX
> +#else
> +#error "Missing syscall wrapper for the given architecture."
> #endif
I know that Sashiko commented on that already but even with that I wonder
if it was cleaner to structure it differently...
#if defined(CONFIG_ARCH_HAS_SYSCALL_WRAPPER)
#if define(__x86_64__)
...
#elif define(__powerpc__)
#define FN_PREFIX
#else
#error
#endif
#elif
#define FN_PREFIX
#endif
?
I still hope that it will be sufficient and we do not have to introduce
KERNEL_VERSION checks since wrappers changed/will change.
Miroslav