[PATCH 2/5] ARM: uapi: Stop leaking CONFIG_CPU_ENDIAN_BE8 reference to userspace
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Tue Dec 30 06:33:39 PST 2025
On Tue, Dec 30, 2025 at 03:20:10PM +0100, Arnd Bergmann wrote:
> On Tue, Dec 30, 2025, at 08:10, Thomas Weißschuh wrote:
> > UAPI headers are not supposed to leak references to kconfig symbols.
> > These won't be set when building userspace. Hide the kconfig reference
> > behind 'if defined(__KERNEL__)', so it will be stripped by
> > headers_install.sh, the same way other kconfig references in this file
> > are handled. The result for userspace will be the same, but the
> > exception in headers_install.sh can also be removed.
> >
> > Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
>
> According to codesearch.debian.net, there are no actual users of
> this definition outside of the kernel, and there really shouldn't
> be either.
>
> It should be both safe and correct to open-code PSR_ENDSTATE
> in the two file where it is used as
>
> if (IS_ENABLED(CONFIG_CPU_ENDIAN_BE8))
> regs->ARM_cpsr |= PSR_E_BIT
>
> and then remove the definition from the header. Alternatively
> it could be moved into the non-uapi header, or you can have
> an #ifdef around both of them.
These alternatives work for me, too. I went with the current aproach as
it matches what the rest of the file is doing and it won't break users.
I'll do the open-coding as proposed above.
Thomas
More information about the linux-snps-arc
mailing list