linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Vineet Gupta <vgupta@kernel.org>
To: "Arnd Bergmann" <arnd@arndb.de>,
	"Thomas Weißschuh" <thomas.weissschuh@linutronix.de>,
	"Vineet Gupta" <vgupta@kernel.org>,
	"Russell King" <linux@armlinux.org.uk>,
	"Dinh Nguyen" <dinguyen@kernel.org>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Borislav Petkov" <bp@alien8.de>,
	"Dave Hansen" <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>
Cc: linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/5] ARC: uapi: Stop leaking CONFIG_ARC_HAS_SWAPE reference to userspace
Date: Fri, 2 Jan 2026 13:53:22 -0800	[thread overview]
Message-ID: <a033a402-e3c5-4982-9fff-b6a4c55817ae@kernel.org> (raw)
In-Reply-To: <9ecebf46-c230-4074-9001-7ba9d65634f1@app.fastmail.com>

Hi Arnd,

Long time no see. Happy New Year !

On 12/30/25 13:23, 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 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@linutronix.de>
> Acked-by: Arnd Bergmann <arnd@arndb.de>
>
> Same as for the nios2 version, I think the nicer solution would
> be to use the asm-generic header for uapi and move this one
> to arch/arc/include/asm/swab.h for kernel-internal use.
>
> In theory, using 'select ARCH_USE_BUILTIN_BSWAP' in Kconfig should
> let the compiler pick the best swap instruction, which would
> be even less code, but I'm not sure if there was a reason that
> nios2 and arc don't already do this.

The builtins didn't exist when the insns were first rolled out in hw.
It seems ARCH_USE_BUILTIN_BSWAP assumes 16,32,64 variants to be available which
surprisingly seems to be true.

foo32:
    j_s.d    [blink]
    swape    r0,r0

foo16:
    exth_s    r0,r0
    asl    r2,r0,8
    lsr_s    r0,r0,8
    or_s    r0,r0,r2
    j_s.d    [blink]
    exth_s    r0,r0

foo64:
    mov_s    r2,r1    ;4
    swape    r1,r0
    j_s.d    [blink]
    swape    r0,r2

And as you said, since all upstream cores support SWAPE, we can really get rid
of all the legacy stuff and just rely on builtins.

Thx,
-Vineet


  parent reply	other threads:[~2026-01-02 21:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-30  7:10 [PATCH 0/5] uapi: fix remaining kconfig leaks in UAPI headers Thomas Weißschuh
2025-12-30  7:10 ` [PATCH 1/5] ARC: uapi: Stop leaking CONFIG_ARC_HAS_SWAPE reference to userspace Thomas Weißschuh
2025-12-30 21:23   ` Arnd Bergmann
2026-01-02  7:55     ` Thomas Weißschuh
2026-01-02  9:40       ` Thomas Weißschuh
2026-01-02 10:31         ` Arnd Bergmann
2026-01-02 21:53     ` Vineet Gupta [this message]
2025-12-30  7:10 ` [PATCH 2/5] ARM: uapi: Stop leaking CONFIG_CPU_ENDIAN_BE8 " Thomas Weißschuh
2025-12-30 14:20   ` Arnd Bergmann
2025-12-30 14:33     ` Thomas Weißschuh
2025-12-30  7:10 ` [PATCH 3/5] nios2: uapi: Stop leaking CONFIG_NIOS2_CI_SWAB_{NO,SUPPORT} references " Thomas Weißschuh
2025-12-30 21:19   ` Arnd Bergmann
2025-12-30  7:10 ` [PATCH 4/5] x86/uapi: Stop leaking kconfig " Thomas Weißschuh
2025-12-30 21:08   ` Arnd Bergmann
2026-01-02  9:30     ` Thomas Weißschuh
2025-12-30  7:11 ` [PATCH 5/5] scripts: headers_install.sh: Remove config leak ignore machinery Thomas Weißschuh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a033a402-e3c5-4982-9fff-b6a4c55817ae@kernel.org \
    --to=vgupta@kernel.org \
    --cc=arnd@arndb.de \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=dinguyen@kernel.org \
    --cc=hpa@zytor.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=linux@armlinux.org.uk \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=thomas.weissschuh@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).