[PATCH] x86: uapi: ptrace: guard register offset macros with __ASSEMBLER__ or __FRAME_OFFSETS
Oleg Nesterov
oleg at redhat.com
Sat Sep 26 05:19:52 PDT 2026
On 08/21, Nick Desaulniers 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 at google.com>
> ---
> arch/x86/include/uapi/asm/ptrace-abi.h | 4 ++--
> arch/x86/um/asm/ptrace.h | 4 +---
> arch/x86/um/ptrace_32.c | 1 +
> 3 files changed, 4 insertions(+), 5 deletions(-)
Acked-by: Oleg Nesterov <oleg at redhat.com>
More information about the linux-um
mailing list