]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Sanitize the type of struct user.u_ar0
authorH. Peter Anvin <hpa@zytor.com>
Thu, 7 Feb 2008 08:15:57 +0000 (00:15 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 7 Feb 2008 16:42:30 +0000 (08:42 -0800)
struct user.u_ar0 is defined to contain a pointer offset on all
architectures in which it is defined (all architectures which define an
a.out format except SPARC.) However, it has a pointer type in the headers,
which is pointless -- <asm/user.h> is not exported to userspace, and it
just makes the code messy.

Redefine the field as "unsigned long" (which is the same size as a pointer
on all Linux architectures) and change the setting code to user offsetof()
instead of hand-coded arithmetic.

Cc: Linux Arch Mailing List <linux-arch@vger.kernel.org>
Cc: Bryan Wu <bryan.wu@analog.com>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Lennert Buytenhek <kernel@wantstofly.org>
Cc: HÃ¥vard Skinnemoen <hskinnemoen@atmel.com>
Cc: Mikael Starvik <starvik@axis.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Hirokazu Takata <takata@linux-m32r.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
18 files changed:
arch/x86/ia32/ia32_aout.c
fs/binfmt_aout.c
include/asm-alpha/user.h
include/asm-arm/user.h
include/asm-avr32/user.h
include/asm-blackfin/user.h
include/asm-cris/user.h
include/asm-h8300/user.h
include/asm-ia64/user.h
include/asm-m32r/user.h
include/asm-m68k/user.h
include/asm-mips/user.h
include/asm-powerpc/user.h
include/asm-s390/user.h
include/asm-sh/user.h
include/asm-v850/user.h
include/asm-x86/user_32.h
include/asm-x86/user_64.h

index e4c12079171b682a5a45bc5d70daedec3536e2aa..58cccb6483b0580d28d935b4692f62b2675f7d02 100644 (file)
@@ -172,8 +172,7 @@ static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file,
        has_dumped = 1;
        current->flags |= PF_DUMPCORE;
        strncpy(dump.u_comm, current->comm, sizeof(current->comm));
-       dump.u_ar0 = (u32)(((unsigned long)(&dump.regs)) -
-                          ((unsigned long)(&dump)));
+       dump.u_ar0 = offsetof(struct user32, regs);
        dump.signal = signr;
        dump_thread32(regs, &dump);
 
index 7596e1e94cde858df0ba7ea0907f9b86d1f4132e..7f65e71bf8595b6f5c5047dc86d26236b933c63c 100644 (file)
@@ -115,7 +115,7 @@ static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file, u
        current->flags |= PF_DUMPCORE;
                strncpy(dump.u_comm, current->comm, sizeof(dump.u_comm));
 #ifndef __sparc__
-       dump.u_ar0 = (void *)(((unsigned long)(&dump.regs)) - ((unsigned long)(&dump)));
+       dump.u_ar0 = offsetof(struct user, regs);
 #endif
        dump.signal = signr;
        dump_thread(regs, &dump);
index 7e417fc9d4916a0f91f9799686f9fa307a9cfe61..a4eb6a4ca8d19b19724be4a02ebb58a13da54459 100644 (file)
@@ -39,7 +39,7 @@ struct user {
        unsigned long   start_data;             /* data starting address */
        unsigned long   start_stack;            /* stack starting address */
        long int        signal;                 /* signal causing core dump */
-       struct regs *   u_ar0;                  /* help gdb find registers */
+       unsigned long   u_ar0;                  /* help gdb find registers */
        unsigned long   magic;                  /* identifies a core file */
        char            u_comm[32];             /* user command name */
 };
index 3e8b0f87915935565e78e684416159d265b59d1b..825c1e7c582d9adef9263c1135754bb1d1f5ae5e 100644 (file)
@@ -67,7 +67,7 @@ struct user{
                                   esp register.  */
   long int signal;                     /* Signal that caused the core dump. */
   int reserved;                        /* No longer used */
-  struct pt_regs * u_ar0;      /* Used by gdb to help find the values for */
+  unsigned long u_ar0;         /* Used by gdb to help find the values for */
                                /* the registers. */
   unsigned long magic;         /* To uniquely identify a core file */
   char u_comm[32];             /* User command that was responsible */
index 060fb3acee49573fe791276391f722872505f528..7e9152f81f5e9ec4a2f9dd3bdd89bb387702d38b 100644 (file)
@@ -51,7 +51,7 @@ struct user {
        unsigned long   start_data;             /* data starting address */
        unsigned long   start_stack;            /* stack starting address */
        long int        signal;                 /* signal causing core dump */
-       struct regs *   u_ar0;                  /* help gdb find registers */
+       unsigned long   u_ar0;                  /* help gdb find registers */
        unsigned long   magic;                  /* identifies a core file */
        char            u_comm[32];             /* user command name */
 };
index abc34629bd59aad786d8578976a7a3c4d903aefd..afe6a0e1f7cef107767f111bd732df75bfd458b3 100644 (file)
@@ -75,7 +75,7 @@ struct user {
                                           esp register.  */
        long int signal;        /* Signal that caused the core dump. */
        int reserved;           /* No longer used */
-       struct user_regs_struct *u_ar0;
+       unsigned long u_ar0;
        /* Used by gdb to help find the values for */
        /* the registers. */
        unsigned long magic;    /* To uniquely identify a core file */
index 2538e2a003df3ddc456be77bbf427f35c813fe00..73e60fcbcf38dc87ca8f0df56f7f8b92555d1a95 100644 (file)
@@ -38,7 +38,7 @@ struct user {
        unsigned long   start_data;             /* data starting address */
        unsigned long   start_stack;            /* stack starting address */
        long int        signal;                 /* signal causing core dump */
-       struct regs *   u_ar0;                  /* help gdb find registers */
+       unsigned long   u_ar0;                  /* help gdb find registers */
        unsigned long   magic;                  /* identifies a core file */
        char            u_comm[32];             /* user command name */
 };
index 6c64f99af3e1566d2396dc4326a6a3827dd34047..14a9e18950f166384186d0eaa18a0984c4ac8f12 100644 (file)
@@ -62,8 +62,7 @@ struct user{
                                   esp register.  */
   long int signal;                     /* Signal that caused the core dump. */
   int reserved;                        /* No longer used */
-  struct user_regs_struct *u_ar0;
-                               /* Used by gdb to help find the values for */
+  unsigned long u_ar0;         /* Used by gdb to help find the values for */
                                /* the registers. */
   unsigned long magic;         /* To uniquely identify a core file */
   char u_comm[32];             /* User command that was responsible */
index 78e5a20140aa52f04ec63396c77157402a477954..8b982111034892e3ead84caff7e4ed90ce810b26 100644 (file)
@@ -44,7 +44,7 @@ struct user {
        unsigned long   start_data;             /* data starting address */
        unsigned long   start_stack;            /* stack starting address */
        long int        signal;                 /* signal causing core dump */
-       struct regs *   u_ar0;                  /* help gdb find registers */
+       unsigned long   u_ar0;                  /* help gdb find registers */
        unsigned long   magic;                  /* identifies a core file */
        char            u_comm[32];             /* user command name */
 };
index 035258d713d00f5ebb2508fda4261f956d7855e6..03b3c11c2aff2ba5b2580d96c2c534d65b1f074d 100644 (file)
@@ -38,7 +38,7 @@ struct user {
        unsigned long   start_data;             /* data starting address */
        unsigned long   start_stack;            /* stack starting address */
        long int        signal;                 /* signal causing core dump */
-       struct regs *   u_ar0;                  /* help gdb find registers */
+       unsigned long   u_ar0;                  /* help gdb find registers */
        unsigned long   magic;                  /* identifies a core file */
        char            u_comm[32];             /* user command name */
 };
index 8c56ccab4849ca0c86dfba77281d0e52d6ee0b4e..f1f478d6e050d1f11e730c92a9663993e4304337 100644 (file)
@@ -72,8 +72,7 @@ struct user{
                                   esp register.  */
   long int signal;             /* Signal that caused the core dump. */
   int reserved;                        /* No longer used */
-  struct user_regs_struct *u_ar0;
-                               /* Used by gdb to help find the values for */
+  unsigned long u_ar0;         /* Used by gdb to help find the values for */
                                /* the registers. */
   struct user_m68kfp_struct* u_fpstate;        /* Math Co-processor pointer. */
   unsigned long magic;         /* To uniquely identify a core file */
index 89bf8b4cab3c333b07c0388f546dc2bc1ed1286a..afa83a4c188843bf6b563f7a3a5c2bc70927abd2 100644 (file)
@@ -44,7 +44,7 @@ struct user {
        unsigned long   start_data;             /* data starting address */
        unsigned long   start_stack;            /* stack starting address */
        long int        signal;                 /* signal causing core dump */
-       struct regs *   u_ar0;                  /* help gdb find registers */
+       unsigned long   u_ar0;                  /* help gdb find registers */
        unsigned long   magic;                  /* identifies a core file */
        char            u_comm[32];             /* user command name */
 };
index ba8dd4c12d96dad6f78d8e894b6ae0756bbd0fe0..3fd4545dd74e5ed911ad93fde798aa4a00762b48 100644 (file)
@@ -38,7 +38,7 @@ struct user {
        unsigned long   start_data;             /* data starting address */
        unsigned long   start_stack;            /* stack starting address */
        long int        signal;                 /* signal causing core dump */
-       struct regs *   u_ar0;                  /* help gdb find registers */
+       unsigned long   u_ar0;                  /* help gdb find registers */
        unsigned long   magic;                  /* identifies a core file */
        char            u_comm[32];             /* user command name */
 };
index 1dc74baf03c4c16027d1811bfd32bf4be00c21b9..1b050e35fdc6f8448dada25aeb1790d16ee71f35 100644 (file)
@@ -63,8 +63,7 @@ struct user {
                                   the top of the stack is always found in the
                                   esp register.  */
   long int signal;                     /* Signal that caused the core dump. */
-  struct user_regs_struct *u_ar0;
-                               /* Used by gdb to help find the values for */
+  unsigned long u_ar0;         /* Used by gdb to help find the values for */
                                /* the registers. */
   unsigned long magic;         /* To uniquely identify a core file */
   char u_comm[32];             /* User command that was responsible */
index 1a4f43c7512605bfca2f5fc1c8c714ed585f9010..8fd3cf6c58d4b31925ce72d2966906ba0456fab6 100644 (file)
@@ -52,7 +52,7 @@ struct user {
        unsigned long   start_data;             /* data starting address */
        unsigned long   start_stack;            /* stack starting address */
        long int        signal;                 /* signal causing core dump */
-       struct regs *   u_ar0;                  /* help gdb find registers */
+       unsigned long   u_ar0;                  /* help gdb find registers */
        struct user_fpu_struct* u_fpstate;      /* Math Co-processor pointer */
        unsigned long   magic;                  /* identifies a core file */
        char            u_comm[32];             /* user command name */
index be90eea5285bc50175931d34d6eca55d8b6fd72e..63cdc567d272e27345152b6fbde8c6222a2c884b 100644 (file)
@@ -38,7 +38,7 @@ struct user {
        unsigned long   start_data;             /* data starting address */
        unsigned long   start_stack;            /* stack starting address */
        long int        signal;                 /* signal causing core dump */
-       struct regs *   u_ar0;                  /* help gdb find registers */
+       unsigned long   u_ar0;                  /* help gdb find registers */
        unsigned long   magic;                  /* identifies a core file */
        char            u_comm[32];             /* user command name */
 };
index ed8b8fc6906c583878346c6b687f5b97692a12f6..6157da6f882c1c2f8f7b48aa05ea97a4c13d4094 100644 (file)
@@ -116,7 +116,7 @@ struct user{
                                   esp register.  */
   long int signal;                     /* Signal that caused the core dump. */
   int reserved;                        /* No longer used */
-  struct user_pt_regs * u_ar0; /* Used by gdb to help find the values for */
+  unsigned long u_ar0;         /* Used by gdb to help find the values for */
                                /* the registers. */
   struct user_i387_struct* u_fpstate;  /* Math Co-processor pointer. */
   unsigned long magic;         /* To uniquely identify a core file */
index a5449d456cc0a7119037ebae4171d64397ecb27f..96361645560971ba818a050201b6ee3a3b9e8362 100644 (file)
@@ -118,7 +118,7 @@ struct user{
   long int signal;             /* Signal that caused the core dump. */
   int reserved;                        /* No longer used */
   int pad1;
-  struct user_pt_regs * u_ar0; /* Used by gdb to help find the values for */
+  unsigned long u_ar0;         /* Used by gdb to help find the values for */
                                /* the registers. */
   struct user_i387_struct* u_fpstate;  /* Math Co-processor pointer. */
   unsigned long magic;         /* To uniquely identify a core file */