lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <71188823-2a9e-4565-8ace-03a682d8d0da@redhat.com>
Date: Fri, 14 Mar 2025 19:01:45 +0100
From: Thomas Huth <thuth@...hat.com>
To: Will Deacon <will@...nel.org>, Arnd Bergmann <arnd@...db.de>
Cc: linux-kernel@...r.kernel.org, Linux-Arch <linux-arch@...r.kernel.org>,
 Catalin Marinas <catalin.marinas@....com>
Subject: Re: [PATCH 08/41] arm64: Replace __ASSEMBLY__ with __ASSEMBLER__ in
 uapi headers

On 14/03/2025 14.42, Will Deacon wrote:
> On Fri, Mar 14, 2025 at 01:05:15PM +0100, Arnd Bergmann wrote:
>> On Fri, Mar 14, 2025, at 12:55, Will Deacon wrote:
>>> On Fri, Mar 14, 2025 at 08:09:39AM +0100, Thomas Huth wrote:
>>>> __ASSEMBLY__ is only defined by the Makefile of the kernel, so
>>>> this is not really useful for uapi headers (unless the userspace
>>>> Makefile defines it, too). Let's switch to __ASSEMBLER__ which
>>>> gets set automatically by the compiler when compiling assembly
>>>> code.
>>>>
>>>> Cc: Catalin Marinas <catalin.marinas@....com>
>>>> Cc: Will Deacon <will@...nel.org>
>>>> Signed-off-by: Thomas Huth <thuth@...hat.com>
>>>> ---
>>>>   arch/arm64/include/uapi/asm/kvm.h        | 2 +-
>>>>   arch/arm64/include/uapi/asm/ptrace.h     | 4 ++--
>>>>   arch/arm64/include/uapi/asm/sigcontext.h | 4 ++--
>>>>   3 files changed, 5 insertions(+), 5 deletions(-)
>>>
>>> Is there a risk of breaking userspace with this? I wonder if it would
>>> be more conservative to do something like:
>>>
>>> #if !defined(__ASSEMBLY__) && !defined(__ASSEMBLER__)
>>>
>>> so that if somebody is doing '#define __ASSEMBLY__' then they get the
>>> same behaviour as today.
>>>
>>> Or maybe we don't care?
>>
>> I think the main risk we would have is user applications relying
>> on the __ASSEMBLER__ checks in new kernel headers and not defining
>> __ASSEMBLY__. This would result in the application not building
>> against old kernel headers that only check against __ASSEMBLY__.
> 
> Hmm. I hadn't thought about the case of old headers :/
> 
> A quick Debian codesearch shows that glibc might #define __ASSEMBLY__
> for some arch-specific headers:
> 
> https://codesearch.debian.net/search?q=%23define+__ASSEMBLY__&literal=1
> 
> which is what I was more worried about.

Since both, GCC and Clang, define __ASSEMBLER__ since a long time (Arnd 
checked GCC 2.95, and I checked that at least Clang 7.0 still has it), I 
think the only problem might be other compiler toolchains that might not set 
__ASSEMBLER__ automatically. I just checked Tiny-C 0.9.27, and that also 
sets __ASSEMBLER__ already. And according to 
https://github.com/IanHarvey/pcc/blob/master/cc/cc/cc.1#L405 it is also set 
in PCC.

I haven't spotted it in LCC though (which seems to be an old C89 compiler if 
I got it right). So if we are worried about such exotic old compilers, it's 
maybe better to check both, __ASSEMBLY__ and __ASSEMBLER__ in the uapi 
files? Or would it be ok to force those few people to set __ASSEMBLER__ 
manually in their Makefiles (just like they had to do before with 
__ASSEMBLY__) in case they want to compile assembler code with such exotic 
compilers and new kernel headers?

  Thomas


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ