Re: [PATCH] x86: uapi: ptrace: guard register offset macros with __ASSEMBLER__ or __FRAME_OFFSETS
From: Oleg Nesterov
Date: Wed Sep 02 2026 - 13:50:52 EST
On 09/01, Nick Desaulniers wrote:
>
> On Fri, Aug 21, 2026 at 3:46 PM Nick Desaulniers
> <ndesaulniers@xxxxxxxxxx> wrote:
> >
> > The register offset macros in <asm/ptrace-abi.h> are guarded by
> > `defined(__ASSEMBLER__) || defined(__FRAME_OFFSETS)` for 64-bit, but
> > were left unguarded for 32-bit. This causes havoc for userspace that
> > happens to use identifiers colliding with these short macro names
> > (e.g., EBX, ECX, EAX, DS, ES, FS, GS, CS, SS). Without this guard,
> > userspace is forced to be super extra careful with include ordering to
> > minimize the chance of collision.
> >
> > Wrap both the 32-bit and 64-bit register definitions under
> > `#if defined(__ASSEMBLER__) || defined(__FRAME_OFFSETS)`, and ensure
> > User-Mode Linux (UML) defines `__FRAME_OFFSETS` for 32-bit as well.
> >
> > Assisted-by: Gemini
> > Link: https://github.com/llvm/llvm-project/issues/217413
> > Signed-off-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
>
> + enh (who pulled this into android for testing)
>
> Oleg, can I get an ack/nack here?
Oh... there is a little problem, I don't understand the usage of
(magic to me) __FRAME_OFFSETS ;)
> Or someone who knows better the
> history of UAPI headers?
Certainly not me....
OK. I'll try to read this patch tomorrow with the clear head after sleep.
Oleg.