Patchwork [1/1] UBUNTU: SAUCE: powerpc: fix compile error when ptrace.h is included from userspace

login
register
mail settings
Submitter Andy Whitcroft
Date May 21, 2010, 1:33 p.m.
Message ID <1274448804-31575-2-git-send-email-apw@canonical.com>
Download mbox | patch
Permalink /patch/53154/
State Accepted
Delegated to: Leann Ogasawara
Headers show

Comments

Andy Whitcroft - May 21, 2010, 1:33 p.m.
The commit below introduced some new userspace structures to ptrace.h
this necessarily required the inclusion of linux/types.h for the kernel
and stdlib.h for userspace:

  commit 3162d92dfb79a0b5fc03380b8819fa5f870ebf1e
  Author: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
  Date:   Mon Feb 8 11:51:05 2010 +0000

    powerpc: Extended ptrace interface

However although linux/types.h is assembly safe, stdlib.h is not.  So that
when the unifdef processed versions are included in assembly files such
as occurs in eglibc, non-assembly type definitions are exposed leading
to build errors.

Looking at the original commit all of the added structures are correctly
protected by __ASSEMBLY__ wrappers, therefor the headers are actually only
required in that context.  Move the headers inside the first __ASSEMBLY__
section.

BugLink: http://bugs.launchpad.net/bugs/583733
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 arch/powerpc/include/asm/ptrace.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Tim Gardner - May 21, 2010, 1:52 p.m.
On 05/21/2010 07:33 AM, Andy Whitcroft wrote:
> The commit below introduced some new userspace structures to ptrace.h
> this necessarily required the inclusion of linux/types.h for the kernel
> and stdlib.h for userspace:
>
>    commit 3162d92dfb79a0b5fc03380b8819fa5f870ebf1e
>    Author: Dave Kleikamp<shaggy@linux.vnet.ibm.com>
>    Date:   Mon Feb 8 11:51:05 2010 +0000
>
>      powerpc: Extended ptrace interface
>
> However although linux/types.h is assembly safe, stdlib.h is not.  So that
> when the unifdef processed versions are included in assembly files such
> as occurs in eglibc, non-assembly type definitions are exposed leading
> to build errors.
>
> Looking at the original commit all of the added structures are correctly
> protected by __ASSEMBLY__ wrappers, therefor the headers are actually only
> required in that context.  Move the headers inside the first __ASSEMBLY__
> section.
>
> BugLink: http://bugs.launchpad.net/bugs/583733
> Signed-off-by: Andy Whitcroft<apw@canonical.com>
> ---
>   arch/powerpc/include/asm/ptrace.h |    4 ++--
>   1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h
> index 9e2d84c..0ed710e 100644
> --- a/arch/powerpc/include/asm/ptrace.h
> +++ b/arch/powerpc/include/asm/ptrace.h
> @@ -24,14 +24,14 @@
>    * 2 of the License, or (at your option) any later version.
>    */
>
> +#ifndef __ASSEMBLY__
> +
>   #ifdef __KERNEL__
>   #include<linux/types.h>
>   #else
>   #include<stdint.h>
>   #endif
>
> -#ifndef __ASSEMBLY__
> -
>   struct pt_regs {
>   	unsigned long gpr[32];
>   	unsigned long nip;

Pretty low risk since it'll either compile or it won't.

Acked-by: Tim Gardner <tim.gardner@canonical.com>

Patch

diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h
index 9e2d84c..0ed710e 100644
--- a/arch/powerpc/include/asm/ptrace.h
+++ b/arch/powerpc/include/asm/ptrace.h
@@ -24,14 +24,14 @@ 
  * 2 of the License, or (at your option) any later version.
  */
 
+#ifndef __ASSEMBLY__
+
 #ifdef __KERNEL__
 #include <linux/types.h>
 #else
 #include <stdint.h>
 #endif
 
-#ifndef __ASSEMBLY__
-
 struct pt_regs {
 	unsigned long gpr[32];
 	unsigned long nip;