linux/arch/x86/um
Nick Desaulniers a661c34fe6 {x86,um}/uapi/ptrace: Guard register offset macros with __ASSEMBLER__ or __FRAME_OFFSETS
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.

Closes: https://github.com/llvm/llvm-project/issues/217413
Assisted-by: LLM
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Tested-by: Elliott Hughes <enh@google.com>
Link: https://patch.msgid.link/20260821-ptrace_uapi-v1-1-3de8638a29f2@google.com
History 2026-09-28 12:11:19 -07:00
..
asm {x86,um}/uapi/ptrace: Guard register offset macros with __ASSEMBLER__ or __FRAME_OFFSETS 2026-09-28 12:11:19 -07:00
os-Linux um: avoid struct sigcontext redefinition with musl 2026-03-21 10:41:44 +01:00
shared/sysdep um: move asm-offsets generation into a single file 2025-10-27 15:07:44 +01:00
vdso x86/um: fix vDSO installation 2026-03-21 10:43:21 +01:00
bugs_32.c um: Add missing headers 2024-04-22 21:46:20 +02:00
bugs_64.c um: Add missing headers 2024-04-22 21:46:20 +02:00
delay.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
fault.c um: Add missing headers 2024-04-22 21:46:20 +02:00
Kconfig arch: um/x86: Select ARCH_SUPPORTS_ATOMIC_RMW for UML_X86 2026-01-09 19:01:41 +08:00
Makefile x86/um: Drop gate area handling 2025-11-06 13:02:33 +01:00
mem_64.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ptrace.c execve updates for v6.17 2025-07-28 17:11:40 -07:00
ptrace_32.c {x86,um}/uapi/ptrace: Guard register offset macros with __ASSEMBLER__ or __FRAME_OFFSETS 2026-09-28 12:11:19 -07:00
ptrace_64.c um: switch to regset API and depend on XSTATE 2024-10-23 12:13:16 +02:00
ptrace_user.c um: get rid of pointless include "..." where include <...> will do 2012-10-09 22:28:45 +02:00
setjmp_32.S x86: Prepare asm files for straight-line-speculation 2021-12-08 12:25:37 +01:00
setjmp_64.S x86: Prepare asm files for straight-line-speculation 2021-12-08 12:25:37 +01:00
signal.c um: properly align signal stack on x86_64 2025-02-12 23:40:42 +01:00
stub_segv.c um: make stub data pages size tweakable 2023-04-20 23:08:43 +02:00
sys_call_table_32.c x86/syscall: Mark exit[_group] syscall handlers __noreturn 2024-06-28 15:23:38 +02:00
sys_call_table_64.c x86/syscall: Mark exit[_group] syscall handlers __noreturn 2024-06-28 15:23:38 +02:00
syscalls_32.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
syscalls_64.c um: Rely on PTRACE_SETREGSET to set FS/GS base registers 2024-01-05 16:28:56 +01:00
sysrq_32.c um: Remove outdated asm/sysrq.h header 2024-09-12 20:44:11 +02:00
sysrq_64.c um: Remove outdated asm/sysrq.h header 2024-09-12 20:44:11 +02:00
tls_32.c um: Stop tracking stub's PID via userspace_pid[] 2025-07-13 19:42:49 +02:00
tls_64.c um: Rely on PTRACE_SETREGSET to set FS/GS base registers 2024-01-05 16:28:56 +01:00
user-offsets.c um: switch to regset API and depend on XSTATE 2024-10-23 12:13:16 +02:00