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: 908 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx20.g.dreamhost.com (mx2.sub5.homie.mail.dreamhost.com [208.113.200.128]) by wilcox.dreamhost.com (Postfix) with ESMTP id C858636006F for ; Wed, 14 May 2014 04:46:23 -0700 (PDT) Received: by homiemail-mx20.g.dreamhost.com (Postfix, from userid 14307373) id 6CDC641A4F57A; Wed, 14 May 2014 04:46:23 -0700 (PDT) X-Original-To: glibc@patchwork.siddhesh.in Delivered-To: x14307373@homiemail-mx20.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx20.g.dreamhost.com (Postfix) with ESMTPS id 49D2841A4F56A for ; Wed, 14 May 2014 04:46:23 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:date:message-id:subject:from:to :cc:content-type; q=dns; s=default; b=LMU75xNBn5iqtl9wXVX5higazD r/rptsP8GI/Rm+UCE6gXGryZnnPskIu7LESCPCTZB3Uci1opf1xz+y7825MpNAh3 w04Ylgnnb5NnxG5XUhc3rzNGE6jKjrEqlKXNKwrYOaAjPekrlsdFWs1eg7e87aSZ 5/cyl9XYjjCm8SjM0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:date:message-id:subject:from:to :cc:content-type; s=default; bh=jwJHMtYc+/kH58gVC5f4N7P3ga8=; b= w49uF9gIQ+94bmMYuojklpD8DrraP4q5cvvQMAZxbMuoieHA7eXAFJqqbPCjLLUG NF/QGkrA8jlubvyqMKw0QklkQINwaf9ZtBtazZ2sGzciFPavdy9bk3A+jfQySIHT RYqiI9kmqiM9vrzsF1JlmCyyFsfgcR0geV/lM/9d8bc= Received: (qmail 23364 invoked by alias); 14 May 2014 11:46:20 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk 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 Authentication-Results: sourceware.org; auth=none 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 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to:cc :content-type; bh=ZUcipdr8pmC3pFYgosFGg5Ci8IGp1k5Bpbi9kl5b9Es=; b=Ps0ys1QT3bUhrZBpZBkb0lSsNHCJbQKr8q9AJi3cMRHb5rd8UmJ3P45hRbtOyWpT06 fv7EV7FO3GUO4Hi6yUG91+yqkE1OK7Qq12jFJHg4lf1GOUiFSI99mOtydawb3WRXT4PI yw052+WHC5Yjaa6G6dHLNCPj0HGfY4UsOFrANZ+VL2ZJdwKqlG0RWxN3BNl2E9qg4fMA nf0nDqshZzqjRPcLDm71JbAw5+CMtIJMZu32FiUi8GGRJXEfFRnaiP+MV/au6kpGgdx5 Ex421iPpcfHB7Lm1So+7Tcv+VSN/yBg3vXc3eBN+/QrqXJLFmUDsktV3GMPZHiW86Ba3 YN6g== X-Gm-Message-State: ALoCoQmUF3/rfaVmILLAYFMSvJWdLMNgTXr98yUpm1vMukaXYZNrLt0e4bJq266WzmzNPO5+YMEI 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-DH-Original-To: glibc@patchwork.siddhesh.in 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