Re: [PATCH 1/8] selftests: livepatch: test-syscall: Check for ARCH_HAS_SYSCALL_WRAPPER
From: Marcos Paulo de Souza
Date: Fri Mar 27 2026 - 09:26:06 EST
On Fri, 2026-03-20 at 11:45 +0100, Miroslav Benes wrote:
> > > So I would perhaps prefer to stay with the logic that defines
> > > FN_PREFIX
> > > per architecture and has also #else branch for the rest. And more
> > > comments
> > > never hurt.
> >
> > Agreed.
>
> Hm, so I thought about a bit more and I very likely misunderstood the
> motivation behind the patch. I will speculate and correct me if I am
> wrong, please. The idea behind the whole patch set is to make the
> selftests run on older kernels which I think is something we should
> support. The issue is that old kernels (like mentioned 4.12) do not
> have
> syscall wrappers at all. getpid() syscall is just plain old
> sys_getpid
> there and not the current __x64_sys_getpid on x86. The patch fixes it
> by checking CONFIG_ARCH_HAS_SYSCALL_WRAPPER and defining FN_PREFIX
> accordingly.
Exactly. The definition was added on
commit 1bd21c6c21e848996339508d3ffb106d505256a8
Author: Dominik Brodowski <linux@xxxxxxxxxxxxxxxxxxxx>
Date: Thu Apr 5 11:53:01 2018 +0200
syscalls/core: Introduce CONFIG_ARCH_HAS_SYSCALL_WRAPPER=y
>
> So, if this is correct, I think it should be done differently. We
> should
> have something like syscall_wrapper.h which would define FN_PREFIX
> for
> the supported architectures and different kernel versions since the
> wrappers may have changed a couple of times during the history. In
> that
> case there could then be an #else branch which might just error out
> with
> the message to add proper syscall wrapper naming.
Well, it seems too much for a simple test to me, but I can do that, no
problem.
>
> The changelog then should explain it because it is not in fact tight
> to
> powerpc.
Makes sense, I'll change it.
>
> What do you think? Am I off again?
I agree with everything, but adding another header file seems a little
too much work for a simple test case, but it's doable. Let me work on
it.
>
> Miroslav