From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0577D3A1E99 for ; Fri, 2 Jan 2026 21:53:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767390804; cv=none; b=WtVTw6NpbCm3bw5WRO2QPvtlybx9R1qvGbzcyKD7G9dwp4ehCM3nUZPiL+jCbpGkx75Ay5DvaBWk2f1x8l9ZqG2ME8dknBpibS6Yq6ldB4yyLKEGPiG1c4AXs4R9TGkFnHFQ11J44mJ+1DCl3RC/WZ4EqrBnUhkjtRUtKQOD8J8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767390804; c=relaxed/simple; bh=oNaPKUGx0i7GPxS9qV3ftiVed/UzQ6HG+Hft9CuDkyk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=rEaQSt1qGLE+kl1d1qLFyYp5Z0dxwhPeXlLMhkUAm8jUhy/BPcgroi0gQuuCVQBTJhjZ8eVpGO/zesSW4OKYvuaURhKKWf6pYCOOah1Xe4A62OxaSy/45Q0vfsPRyzIT2Uw3aXuNNgHkTbXEjOM/vUizxUOKQhCIAEKbOz3lzME= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ogDzbZHK; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ogDzbZHK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48D09C116B1; Fri, 2 Jan 2026 21:53:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767390803; bh=oNaPKUGx0i7GPxS9qV3ftiVed/UzQ6HG+Hft9CuDkyk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=ogDzbZHKQU2RBx2fdNIwScC07hsN0kNwhvw61Cp1uwYQF9wL9aqBSUXCUHzW+rIGT 4QwueY/wh3z5MoMKqkPRVZjdTLNM/MUZW1xCRckve05zeOnnbu9Ryn1ji6V1Nugt8G +U50XhR5on5uJ7E/nyGPNweV7lBotly6NVuxFBF1riH+tR6hf/LQKE/8wofZU3FD4S RYx2QBbOCdyJm6NcdUasdWS2i75pPF/XNFb5vVu7zcKTqkWeatboEOCC/JZDrsjLd6 5ufIwbcI1v1WW1qYzf10IGubd119PdiNX9b+8sdiUVP6C2i2t5uif4+zJI/vefRl6f Nc6THmFT3pzZQ== Message-ID: Date: Fri, 2 Jan 2026 13:53:22 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/5] ARC: uapi: Stop leaking CONFIG_ARC_HAS_SWAPE reference to userspace To: Arnd Bergmann , =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= , Vineet Gupta , Russell King , Dinh Nguyen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" Cc: linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <20251230-headers_install-config-leak-v1-0-efba5c58073d@linutronix.de> <20251230-headers_install-config-leak-v1-1-efba5c58073d@linutronix.de> <9ecebf46-c230-4074-9001-7ba9d65634f1@app.fastmail.com> From: Vineet Gupta Content-Language: en-US In-Reply-To: <9ecebf46-c230-4074-9001-7ba9d65634f1@app.fastmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 > Acked-by: Arnd Bergmann > > 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