From patchwork Wed May 14 11:46:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yvan Roux X-Patchwork-Id: 30161 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B071620446 for ; Wed, 14 May 2014 11:46:31 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id va2sf8174536obc.5 for ; Wed, 14 May 2014 04:46:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mailing-list:precedence:list-id :list-unsubscribe:list-subscribe:list-archive:list-post:list-help :sender:delivered-to:mime-version:date:message-id:subject:from:to:cc :x-original-sender:x-original-authentication-results:content-type; bh=ZUcipdr8pmC3pFYgosFGg5Ci8IGp1k5Bpbi9kl5b9Es=; b=KTfgZHKK2hjze8S6wCWD2CDo8JDTo3SyIGeeaBN5+HaDSLxZajple3HM95QO1GGzcO N6O1uD7NyMkLopfye06qK4Wu0Pl0aA+9KBreckNSSPfumWfuKgV4g6D0vI26sTmH9ZrG Gd+CGhWSFDc+gVW18RPcRQr/936KfXDzCeszqYGSXxX9oU7eLdFJZ/Tr6qflO1A/wk0i SeI2rvfoX8tvbjHNV4bJ+I2PXAk4UPx+bSsNP6h5nGJp89IumBf1/0FzSs0hbNhcgpZA pI8coahVzlRU0z1KMXDVmJYXgOYZ5r5CXSMkbP2P7h9yT2uV4rdiUvmhoOElPmBCItMr FVWw== X-Gm-Message-State: ALoCoQl7a9OiYrD6WP+bcEZIwsRKyUfhoN8fz3A4UCzIxBX0hdrMJfpXoHDERqlWIBEbY0XO/ziS X-Received: by 10.43.94.71 with SMTP id bx7mr1283774icc.2.1400067991307; Wed, 14 May 2014 04:46:31 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.33.164 with SMTP id j33ls2373264qgj.73.gmail; Wed, 14 May 2014 04:46:31 -0700 (PDT) X-Received: by 10.52.190.138 with SMTP id gq10mr141860vdc.47.1400067991222; Wed, 14 May 2014 04:46:31 -0700 (PDT) Received: from mail-ve0-x229.google.com (mail-ve0-x229.google.com [2607:f8b0:400c:c01::229]) by mx.google.com with ESMTPS id af10si284543vec.77.2014.05.14.04.46.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 14 May 2014 04:46:31 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c01::229 as permitted sender) client-ip=2607:f8b0:400c:c01::229; Received: by mail-ve0-f169.google.com with SMTP id jx11so2188733veb.14 for ; Wed, 14 May 2014 04:46:31 -0700 (PDT) X-Received: by 10.58.195.231 with SMTP id ih7mr2705848vec.32.1400067991153; Wed, 14 May 2014 04:46:31 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp233162vcb; Wed, 14 May 2014 04:46:30 -0700 (PDT) X-Received: by 10.68.193.166 with SMTP id hp6mr3752158pbc.144.1400067990120; Wed, 14 May 2014 04:46:30 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id gm2si837890pbb.292.2014.05.14.04.46.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 May 2014 04:46:30 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-49813-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 23364 invoked by alias); 14 May 2014 11:46:20 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list List-Id: List-Unsubscribe: , List-Subscribe: List-Archive: List-Post: , List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 23353 invoked by uid 89); 14 May 2014 11:46:20 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-we0-f182.google.com MIME-Version: 1.0 X-Received: by 10.194.77.148 with SMTP id s20mr2671226wjw.31.1400067975295; Wed, 14 May 2014 04:46:15 -0700 (PDT) Date: Wed, 14 May 2014 13:46:14 +0200 Message-ID: Subject: [PATCH] AARCH64: remove asm/prtace.h inclusion in sys/user.h and sys/procfs.h From: Yvan Roux To: libc-alpha@sourceware.org Cc: Marcus Shawcroft X-Original-Sender: yvan.roux@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c01::229 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@sourceware.org X-Google-Group-Id: 836684582541 Hi, 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 lile 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 ride of the asm/ptrace.h inclusion. Build + Make check are clean on AArch64. Thanks, Yvan 2014-05-14 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. diff --git a/sysdeps/unix/sysv/linux/aarch64/sys/procfs.h b/sysdeps/unix/sysv/linux/aarch64/sys/procfs.h index b02af8a..211227c 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 diff --git a/sysdeps/unix/sysv/linux/aarch64/sys/user.h b/sysdeps/unix/sysv/linux/aarch64/sys/user.h index eceeb38..0ca2715 100644 --- a/sysdeps/unix/sysv/linux/aarch64/sys/user.h +++ b/sysdeps/unix/sysv/linux/aarch64/sys/user.h @@ -19,13 +19,19 @@ #ifndef _SYS_USER_H #define _SYS_USER_H 1 -/* We need to see the definition of struct pt_regs but do not want the - linux PTRACE_* defines since they conflict with the generic glibc - definitions in sys/ptrace.h Hence the undef's below. */ -#include - -#undef PTRACE_GET_THREAD_AREA -#undef PTRACE_GETHBPREGS -#undef PTRACE_SETHBPREGS +struct user_regs_struct +{ + unsigned long long regs[31]; + unsigned long long sp; + unsigned long long pc; + unsigned long long pstate; +}; + +struct user_fpsimd_struct +{ + __uint128_t vregs[32]; + unsigned int fpsr; + unsigned int fpcr; +}; #endif