[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <df30d093-c173-495a-8ed9-874857df7dee@app.fastmail.com>
Date: Fri, 14 Mar 2025 13:05:15 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: "Will Deacon" <will@...nel.org>, "Thomas Huth" <thuth@...hat.com>
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 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__.
Checking for both in the kernel headers does not solve this
problem, and I think we can still decide that we don't care:
in the worst case, an application using the headers from assembly
will have to get fixed later when it needs to be built against
old headers.
I checked that old gcc versions pass __ASSEMBLY__ at least as
far back as gcc-2.95, and it should be completely safe to
assume that no older gcc versions would be used on kernel
headers, and they probably would choke on c99 features like
'long long'. I would also assume that any other compiler that
may be used to include kernel headers has to have enough
gcc compatibility to define all the common macros.
Arnd
Powered by blists - more mailing lists