From 7d05a8168b45c0580e1f9a79c2dd26c8f0d31fca Mon Sep 17 00:00:00 2001 From: Yvan Roux Date: Tue, 20 May 2014 13:45:22 +0100 Subject: AArch64: Remove asm/ptrace.h inclusion in sys/user.h and sys/procfs.h This patch fixes an issue observed by the Xen project, where including signal.h exposes various PSR_MODE #defines. This is due to the usage in sys/user.h and sys/procfs.h of the struct user_pt_regs and user_fpsimd_state included via asm/ptrace.h. The namespace pollution this inclusion introduce is already partially fixed with some #undef of the PTRACE_* symbols, but other symbols like the PSR_MODE ones are still present, and undefining them is not safe since a user can include ptrace.h before user.h. My proposition is to define the 2 structures we need in user.h and get rid of the asm/ptrace.h inclusion. Build and make check are clean on AArch64. 2014-05-20 Will Newton Yvan Roux * sysdeps/unix/sysv/linux/aarch64/sys/user.h: Remove unused #include of asm/ptrace.h. (PTRACE_GET_THREAD_AREA): Remove #undef. (PTRACE_GETHBPREGS): Likewise. (PTRACE_SETHBPREGS): Likewise. (struct user_regs_struct): New structure. (struct user_fpsimd_struct): New structure. * sysdeps/unix/sysv/linux/aarch64/sys/procfs.h: Remove unused #include of asm/ptrace.h and second #include of sys/user.h. (PTRACE_GET_THREAD_AREA): Remove #undef. (PTRACE_GETHBPREGS): Likewise. (PTRACE_SETHBPREGS): Likewise. (ELF_NGREG): Use new struct user_regs_struct. (elf_fpregset_t): Use new struct user_fpsimd_struct. --- sysdeps/unix/sysv/linux/aarch64/sys/procfs.h | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'sysdeps/unix/sysv/linux/aarch64/sys/procfs.h') diff --git a/sysdeps/unix/sysv/linux/aarch64/sys/procfs.h b/sysdeps/unix/sysv/linux/aarch64/sys/procfs.h index b02af8ac1a..211227cc43 100644 --- a/sysdeps/unix/sysv/linux/aarch64/sys/procfs.h +++ b/sysdeps/unix/sysv/linux/aarch64/sys/procfs.h @@ -33,17 +33,6 @@ #include #include -/* We need to see the definition of struct pt_regs but do not want the - linux PTRACE_* defines since they conflict with the generic eglibc - definitions in sys/ptrace.h Hence the undef's below. */ -#include - -#undef PTRACE_GET_THREAD_AREA -#undef PTRACE_GETHBPREGS -#undef PTRACE_SETHBPREGS - -#include - __BEGIN_DECLS /* Type for a general-purpose register. */ @@ -53,11 +42,11 @@ typedef unsigned long elf_greg_t; pt_regs' directly in the typedef, but tradition says that the register set is an array, which does have some peculiar semantics, so leave it that way. */ -#define ELF_NGREG (sizeof (struct user_pt_regs) / sizeof(elf_greg_t)) +#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t)) typedef elf_greg_t elf_gregset_t[ELF_NGREG]; /* Register set for the floating-point registers. */ -typedef struct user_fpsimd_state elf_fpregset_t; +typedef struct user_fpsimd_struct elf_fpregset_t; /* Signal info. */ struct elf_siginfo -- cgit v1.2.3