Commit 751f409db6216ebd134a94f6dcd97779933a5106

Authored by Denys Vlasenko
Committed by Linus Torvalds
1 parent 5ab1c309b3

compat: move compat_siginfo_t definition to asm/compat.h

This is a preparatory patch for the introduction of NT_SIGINFO elf note.

Make the location of compat_siginfo_t uniform across eight architectures
which have it.  Now it can be pulled in by including asm/compat.h or
linux/compat.h.

Most of the copies are verbatim.  compat_uid[32]_t had to be replaced by
__compat_uid[32]_t.  compat_uptr_t had to be moved up before
compat_siginfo_t in asm/compat.h on a several architectures (tile already
had it moved up).  compat_sigval_t had to be relocated from linux/compat.h
to asm/compat.h.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Amerigo Wang <amwang@redhat.com>
Cc: "Jonathan M. Foote" <jmfoote@cert.org>
Cc: Roland McGrath <roland@hack.frob.com>
Cc: Pedro Alves <palves@redhat.com>
Cc: Fengguang Wu <fengguang.wu@intel.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 19 changed files with 513 additions and 476 deletions Side-by-side Diff

arch/arm64/include/asm/compat.h
... ... @@ -55,6 +55,7 @@
55 55 typedef u32 compat_uint_t;
56 56 typedef u32 compat_ulong_t;
57 57 typedef u64 compat_u64;
  58 +typedef u32 compat_uptr_t;
58 59  
59 60 struct compat_timespec {
60 61 compat_time_t tv_sec;
... ... @@ -130,6 +131,64 @@
130 131  
131 132 typedef u32 compat_sigset_word;
132 133  
  134 +typedef union compat_sigval {
  135 + compat_int_t sival_int;
  136 + compat_uptr_t sival_ptr;
  137 +} compat_sigval_t;
  138 +
  139 +typedef struct compat_siginfo {
  140 + int si_signo;
  141 + int si_errno;
  142 + int si_code;
  143 +
  144 + union {
  145 + /* The padding is the same size as AArch64. */
  146 + int _pad[128/sizeof(int) - 3];
  147 +
  148 + /* kill() */
  149 + struct {
  150 + compat_pid_t _pid; /* sender's pid */
  151 + __compat_uid32_t _uid; /* sender's uid */
  152 + } _kill;
  153 +
  154 + /* POSIX.1b timers */
  155 + struct {
  156 + compat_timer_t _tid; /* timer id */
  157 + int _overrun; /* overrun count */
  158 + compat_sigval_t _sigval; /* same as below */
  159 + int _sys_private; /* not to be passed to user */
  160 + } _timer;
  161 +
  162 + /* POSIX.1b signals */
  163 + struct {
  164 + compat_pid_t _pid; /* sender's pid */
  165 + __compat_uid32_t _uid; /* sender's uid */
  166 + compat_sigval_t _sigval;
  167 + } _rt;
  168 +
  169 + /* SIGCHLD */
  170 + struct {
  171 + compat_pid_t _pid; /* which child */
  172 + __compat_uid32_t _uid; /* sender's uid */
  173 + int _status; /* exit code */
  174 + compat_clock_t _utime;
  175 + compat_clock_t _stime;
  176 + } _sigchld;
  177 +
  178 + /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
  179 + struct {
  180 + compat_uptr_t _addr; /* faulting insn/memory ref. */
  181 + short _addr_lsb; /* LSB of the reported address */
  182 + } _sigfault;
  183 +
  184 + /* SIGPOLL */
  185 + struct {
  186 + compat_long_t _band; /* POLL_IN, POLL_OUT, POLL_MSG */
  187 + int _fd;
  188 + } _sigpoll;
  189 + } _sifields;
  190 +} compat_siginfo_t;
  191 +
133 192 #define COMPAT_OFF_T_MAX 0x7fffffff
134 193 #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
135 194  
... ... @@ -139,7 +198,6 @@
139 198 * as pointers because the syscall entry code will have
140 199 * appropriately converted them already.
141 200 */
142   -typedef u32 compat_uptr_t;
143 201  
144 202 static inline void __user *compat_ptr(compat_uptr_t uptr)
145 203 {
arch/arm64/kernel/signal32.c
... ... @@ -30,59 +30,6 @@
30 30 #include <asm/uaccess.h>
31 31 #include <asm/unistd.h>
32 32  
33   -typedef struct compat_siginfo {
34   - int si_signo;
35   - int si_errno;
36   - int si_code;
37   -
38   - union {
39   - /* The padding is the same size as AArch64. */
40   - int _pad[SI_PAD_SIZE];
41   -
42   - /* kill() */
43   - struct {
44   - compat_pid_t _pid; /* sender's pid */
45   - __compat_uid32_t _uid; /* sender's uid */
46   - } _kill;
47   -
48   - /* POSIX.1b timers */
49   - struct {
50   - compat_timer_t _tid; /* timer id */
51   - int _overrun; /* overrun count */
52   - compat_sigval_t _sigval; /* same as below */
53   - int _sys_private; /* not to be passed to user */
54   - } _timer;
55   -
56   - /* POSIX.1b signals */
57   - struct {
58   - compat_pid_t _pid; /* sender's pid */
59   - __compat_uid32_t _uid; /* sender's uid */
60   - compat_sigval_t _sigval;
61   - } _rt;
62   -
63   - /* SIGCHLD */
64   - struct {
65   - compat_pid_t _pid; /* which child */
66   - __compat_uid32_t _uid; /* sender's uid */
67   - int _status; /* exit code */
68   - compat_clock_t _utime;
69   - compat_clock_t _stime;
70   - } _sigchld;
71   -
72   - /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
73   - struct {
74   - compat_uptr_t _addr; /* faulting insn/memory ref. */
75   - short _addr_lsb; /* LSB of the reported address */
76   - } _sigfault;
77   -
78   - /* SIGPOLL */
79   - struct {
80   - compat_long_t _band; /* POLL_IN, POLL_OUT, POLL_MSG */
81   - int _fd;
82   - } _sigpoll;
83   - } _sifields;
84   -} compat_siginfo_t;
85   -
86 33 struct compat_sigaction {
87 34 compat_uptr_t sa_handler;
88 35 compat_ulong_t sa_flags;
arch/mips/include/asm/compat-signal.h
... ... @@ -10,68 +10,6 @@
10 10  
11 11 #include <asm/uaccess.h>
12 12  
13   -#define SI_PAD_SIZE32 ((SI_MAX_SIZE/sizeof(int)) - 3)
14   -
15   -typedef struct compat_siginfo {
16   - int si_signo;
17   - int si_code;
18   - int si_errno;
19   -
20   - union {
21   - int _pad[SI_PAD_SIZE32];
22   -
23   - /* kill() */
24   - struct {
25   - compat_pid_t _pid; /* sender's pid */
26   - compat_uid_t _uid; /* sender's uid */
27   - } _kill;
28   -
29   - /* SIGCHLD */
30   - struct {
31   - compat_pid_t _pid; /* which child */
32   - compat_uid_t _uid; /* sender's uid */
33   - int _status; /* exit code */
34   - compat_clock_t _utime;
35   - compat_clock_t _stime;
36   - } _sigchld;
37   -
38   - /* IRIX SIGCHLD */
39   - struct {
40   - compat_pid_t _pid; /* which child */
41   - compat_clock_t _utime;
42   - int _status; /* exit code */
43   - compat_clock_t _stime;
44   - } _irix_sigchld;
45   -
46   - /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
47   - struct {
48   - s32 _addr; /* faulting insn/memory ref. */
49   - } _sigfault;
50   -
51   - /* SIGPOLL, SIGXFSZ (To do ...) */
52   - struct {
53   - int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
54   - int _fd;
55   - } _sigpoll;
56   -
57   - /* POSIX.1b timers */
58   - struct {
59   - timer_t _tid; /* timer id */
60   - int _overrun; /* overrun count */
61   - compat_sigval_t _sigval;/* same as below */
62   - int _sys_private; /* not to be passed to user */
63   - } _timer;
64   -
65   - /* POSIX.1b signals */
66   - struct {
67   - compat_pid_t _pid; /* sender's pid */
68   - compat_uid_t _uid; /* sender's uid */
69   - compat_sigval_t _sigval;
70   - } _rt;
71   -
72   - } _sifields;
73   -} compat_siginfo_t;
74   -
75 13 static inline int __copy_conv_sigset_to_user(compat_sigset_t __user *d,
76 14 const sigset_t *s)
77 15 {
arch/mips/include/asm/compat.h
... ... @@ -43,6 +43,7 @@
43 43 typedef u32 compat_uint_t;
44 44 typedef u32 compat_ulong_t;
45 45 typedef u64 compat_u64;
  46 +typedef u32 compat_uptr_t;
46 47  
47 48 struct compat_timespec {
48 49 compat_time_t tv_sec;
... ... @@ -124,6 +125,73 @@
124 125  
125 126 typedef u32 compat_sigset_word;
126 127  
  128 +typedef union compat_sigval {
  129 + compat_int_t sival_int;
  130 + compat_uptr_t sival_ptr;
  131 +} compat_sigval_t;
  132 +
  133 +#define SI_PAD_SIZE32 (128/sizeof(int) - 3)
  134 +
  135 +typedef struct compat_siginfo {
  136 + int si_signo;
  137 + int si_code;
  138 + int si_errno;
  139 +
  140 + union {
  141 + int _pad[SI_PAD_SIZE32];
  142 +
  143 + /* kill() */
  144 + struct {
  145 + compat_pid_t _pid; /* sender's pid */
  146 + __compat_uid_t _uid; /* sender's uid */
  147 + } _kill;
  148 +
  149 + /* SIGCHLD */
  150 + struct {
  151 + compat_pid_t _pid; /* which child */
  152 + __compat_uid_t _uid; /* sender's uid */
  153 + int _status; /* exit code */
  154 + compat_clock_t _utime;
  155 + compat_clock_t _stime;
  156 + } _sigchld;
  157 +
  158 + /* IRIX SIGCHLD */
  159 + struct {
  160 + compat_pid_t _pid; /* which child */
  161 + compat_clock_t _utime;
  162 + int _status; /* exit code */
  163 + compat_clock_t _stime;
  164 + } _irix_sigchld;
  165 +
  166 + /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
  167 + struct {
  168 + s32 _addr; /* faulting insn/memory ref. */
  169 + } _sigfault;
  170 +
  171 + /* SIGPOLL, SIGXFSZ (To do ...) */
  172 + struct {
  173 + int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
  174 + int _fd;
  175 + } _sigpoll;
  176 +
  177 + /* POSIX.1b timers */
  178 + struct {
  179 + timer_t _tid; /* timer id */
  180 + int _overrun; /* overrun count */
  181 + compat_sigval_t _sigval;/* same as below */
  182 + int _sys_private; /* not to be passed to user */
  183 + } _timer;
  184 +
  185 + /* POSIX.1b signals */
  186 + struct {
  187 + compat_pid_t _pid; /* sender's pid */
  188 + __compat_uid_t _uid; /* sender's uid */
  189 + compat_sigval_t _sigval;
  190 + } _rt;
  191 +
  192 + } _sifields;
  193 +} compat_siginfo_t;
  194 +
127 195 #define COMPAT_OFF_T_MAX 0x7fffffff
128 196 #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
129 197  
... ... @@ -133,7 +201,6 @@
133 201 * as pointers because the syscall entry code will have
134 202 * appropriately converted them already.
135 203 */
136   -typedef u32 compat_uptr_t;
137 204  
138 205 static inline void __user *compat_ptr(compat_uptr_t uptr)
139 206 {
arch/parisc/include/asm/compat.h
... ... @@ -36,6 +36,7 @@
36 36 typedef u32 compat_uint_t;
37 37 typedef u32 compat_ulong_t;
38 38 typedef u64 compat_u64;
  39 +typedef u32 compat_uptr_t;
39 40  
40 41 struct compat_timespec {
41 42 compat_time_t tv_sec;
... ... @@ -127,6 +128,63 @@
127 128  
128 129 typedef u32 compat_sigset_word;
129 130  
  131 +typedef union compat_sigval {
  132 + compat_int_t sival_int;
  133 + compat_uptr_t sival_ptr;
  134 +} compat_sigval_t;
  135 +
  136 +typedef struct compat_siginfo {
  137 + int si_signo;
  138 + int si_errno;
  139 + int si_code;
  140 +
  141 + union {
  142 + int _pad[128/sizeof(int) - 3];
  143 +
  144 + /* kill() */
  145 + struct {
  146 + unsigned int _pid; /* sender's pid */
  147 + unsigned int _uid; /* sender's uid */
  148 + } _kill;
  149 +
  150 + /* POSIX.1b timers */
  151 + struct {
  152 + compat_timer_t _tid; /* timer id */
  153 + int _overrun; /* overrun count */
  154 + char _pad[sizeof(unsigned int) - sizeof(int)];
  155 + compat_sigval_t _sigval; /* same as below */
  156 + int _sys_private; /* not to be passed to user */
  157 + } _timer;
  158 +
  159 + /* POSIX.1b signals */
  160 + struct {
  161 + unsigned int _pid; /* sender's pid */
  162 + unsigned int _uid; /* sender's uid */
  163 + compat_sigval_t _sigval;
  164 + } _rt;
  165 +
  166 + /* SIGCHLD */
  167 + struct {
  168 + unsigned int _pid; /* which child */
  169 + unsigned int _uid; /* sender's uid */
  170 + int _status; /* exit code */
  171 + compat_clock_t _utime;
  172 + compat_clock_t _stime;
  173 + } _sigchld;
  174 +
  175 + /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
  176 + struct {
  177 + unsigned int _addr; /* faulting insn/memory ref. */
  178 + } _sigfault;
  179 +
  180 + /* SIGPOLL */
  181 + struct {
  182 + int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
  183 + int _fd;
  184 + } _sigpoll;
  185 + } _sifields;
  186 +} compat_siginfo_t;
  187 +
130 188 #define COMPAT_OFF_T_MAX 0x7fffffff
131 189 #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
132 190  
... ... @@ -136,7 +194,6 @@
136 194 * as pointers because the syscall entry code will have
137 195 * appropriately converted them already.
138 196 */
139   -typedef u32 compat_uptr_t;
140 197  
141 198 static inline void __user *compat_ptr(compat_uptr_t uptr)
142 199 {
arch/parisc/kernel/signal32.h
... ... @@ -55,58 +55,6 @@
55 55 struct compat_sigaction sa;
56 56 };
57 57  
58   -typedef struct compat_siginfo {
59   - int si_signo;
60   - int si_errno;
61   - int si_code;
62   -
63   - union {
64   - int _pad[((128/sizeof(int)) - 3)];
65   -
66   - /* kill() */
67   - struct {
68   - unsigned int _pid; /* sender's pid */
69   - unsigned int _uid; /* sender's uid */
70   - } _kill;
71   -
72   - /* POSIX.1b timers */
73   - struct {
74   - compat_timer_t _tid; /* timer id */
75   - int _overrun; /* overrun count */
76   - char _pad[sizeof(unsigned int) - sizeof(int)];
77   - compat_sigval_t _sigval; /* same as below */
78   - int _sys_private; /* not to be passed to user */
79   - } _timer;
80   -
81   - /* POSIX.1b signals */
82   - struct {
83   - unsigned int _pid; /* sender's pid */
84   - unsigned int _uid; /* sender's uid */
85   - compat_sigval_t _sigval;
86   - } _rt;
87   -
88   - /* SIGCHLD */
89   - struct {
90   - unsigned int _pid; /* which child */
91   - unsigned int _uid; /* sender's uid */
92   - int _status; /* exit code */
93   - compat_clock_t _utime;
94   - compat_clock_t _stime;
95   - } _sigchld;
96   -
97   - /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
98   - struct {
99   - unsigned int _addr; /* faulting insn/memory ref. */
100   - } _sigfault;
101   -
102   - /* SIGPOLL */
103   - struct {
104   - int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
105   - int _fd;
106   - } _sigpoll;
107   - } _sifields;
108   -} compat_siginfo_t;
109   -
110 58 int copy_siginfo_to_user32 (compat_siginfo_t __user *to, siginfo_t *from);
111 59 int copy_siginfo_from_user32 (siginfo_t *to, compat_siginfo_t __user *from);
112 60  
arch/powerpc/include/asm/compat.h
... ... @@ -38,6 +38,7 @@
38 38 typedef u32 compat_uint_t;
39 39 typedef u32 compat_ulong_t;
40 40 typedef u64 compat_u64;
  41 +typedef u32 compat_uptr_t;
41 42  
42 43 struct compat_timespec {
43 44 compat_time_t tv_sec;
... ... @@ -114,6 +115,64 @@
114 115  
115 116 typedef u32 compat_sigset_word;
116 117  
  118 +typedef union compat_sigval {
  119 + compat_int_t sival_int;
  120 + compat_uptr_t sival_ptr;
  121 +} compat_sigval_t;
  122 +
  123 +#define SI_PAD_SIZE32 (128/sizeof(int) - 3)
  124 +
  125 +typedef struct compat_siginfo {
  126 + int si_signo;
  127 + int si_errno;
  128 + int si_code;
  129 +
  130 + union {
  131 + int _pad[SI_PAD_SIZE32];
  132 +
  133 + /* kill() */
  134 + struct {
  135 + compat_pid_t _pid; /* sender's pid */
  136 + __compat_uid_t _uid; /* sender's uid */
  137 + } _kill;
  138 +
  139 + /* POSIX.1b timers */
  140 + struct {
  141 + compat_timer_t _tid; /* timer id */
  142 + int _overrun; /* overrun count */
  143 + compat_sigval_t _sigval; /* same as below */
  144 + int _sys_private; /* not to be passed to user */
  145 + } _timer;
  146 +
  147 + /* POSIX.1b signals */
  148 + struct {
  149 + compat_pid_t _pid; /* sender's pid */
  150 + __compat_uid_t _uid; /* sender's uid */
  151 + compat_sigval_t _sigval;
  152 + } _rt;
  153 +
  154 + /* SIGCHLD */
  155 + struct {
  156 + compat_pid_t _pid; /* which child */
  157 + __compat_uid_t _uid; /* sender's uid */
  158 + int _status; /* exit code */
  159 + compat_clock_t _utime;
  160 + compat_clock_t _stime;
  161 + } _sigchld;
  162 +
  163 + /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGEMT */
  164 + struct {
  165 + unsigned int _addr; /* faulting insn/memory ref. */
  166 + } _sigfault;
  167 +
  168 + /* SIGPOLL */
  169 + struct {
  170 + int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
  171 + int _fd;
  172 + } _sigpoll;
  173 + } _sifields;
  174 +} compat_siginfo_t;
  175 +
117 176 #define COMPAT_OFF_T_MAX 0x7fffffff
118 177 #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
119 178  
... ... @@ -123,7 +182,6 @@
123 182 * as pointers because the syscall entry code will have
124 183 * appropriately converted them already.
125 184 */
126   -typedef u32 compat_uptr_t;
127 185  
128 186 static inline void __user *compat_ptr(compat_uptr_t uptr)
129 187 {
arch/powerpc/include/asm/siginfo.h
... ... @@ -10,7 +10,6 @@
10 10  
11 11 #ifdef __powerpc64__
12 12 # define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
13   -# define SI_PAD_SIZE32 ((SI_MAX_SIZE/sizeof(int)) - 3)
14 13 #endif
15 14  
16 15 #include <asm-generic/siginfo.h>
arch/powerpc/kernel/ppc32.h
... ... @@ -16,57 +16,6 @@
16 16  
17 17 /* These are here to support 32-bit syscalls on a 64-bit kernel. */
18 18  
19   -typedef struct compat_siginfo {
20   - int si_signo;
21   - int si_errno;
22   - int si_code;
23   -
24   - union {
25   - int _pad[SI_PAD_SIZE32];
26   -
27   - /* kill() */
28   - struct {
29   - compat_pid_t _pid; /* sender's pid */
30   - compat_uid_t _uid; /* sender's uid */
31   - } _kill;
32   -
33   - /* POSIX.1b timers */
34   - struct {
35   - compat_timer_t _tid; /* timer id */
36   - int _overrun; /* overrun count */
37   - compat_sigval_t _sigval; /* same as below */
38   - int _sys_private; /* not to be passed to user */
39   - } _timer;
40   -
41   - /* POSIX.1b signals */
42   - struct {
43   - compat_pid_t _pid; /* sender's pid */
44   - compat_uid_t _uid; /* sender's uid */
45   - compat_sigval_t _sigval;
46   - } _rt;
47   -
48   - /* SIGCHLD */
49   - struct {
50   - compat_pid_t _pid; /* which child */
51   - compat_uid_t _uid; /* sender's uid */
52   - int _status; /* exit code */
53   - compat_clock_t _utime;
54   - compat_clock_t _stime;
55   - } _sigchld;
56   -
57   - /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGEMT */
58   - struct {
59   - unsigned int _addr; /* faulting insn/memory ref. */
60   - } _sigfault;
61   -
62   - /* SIGPOLL */
63   - struct {
64   - int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
65   - int _fd;
66   - } _sigpoll;
67   - } _sifields;
68   -} compat_siginfo_t;
69   -
70 19 #define __old_sigaction32 old_sigaction32
71 20  
72 21 struct __old_sigaction32 {
arch/s390/include/asm/compat.h
... ... @@ -65,6 +65,7 @@
65 65 typedef u32 compat_uint_t;
66 66 typedef u32 compat_ulong_t;
67 67 typedef u64 compat_u64;
  68 +typedef u32 compat_uptr_t;
68 69  
69 70 struct compat_timespec {
70 71 compat_time_t tv_sec;
... ... @@ -144,6 +145,79 @@
144 145  
145 146 typedef u32 compat_sigset_word;
146 147  
  148 +typedef union compat_sigval {
  149 + compat_int_t sival_int;
  150 + compat_uptr_t sival_ptr;
  151 +} compat_sigval_t;
  152 +
  153 +typedef struct compat_siginfo {
  154 + int si_signo;
  155 + int si_errno;
  156 + int si_code;
  157 +
  158 + union {
  159 + int _pad[128/sizeof(int) - 3];
  160 +
  161 + /* kill() */
  162 + struct {
  163 + pid_t _pid; /* sender's pid */
  164 + uid_t _uid; /* sender's uid */
  165 + } _kill;
  166 +
  167 + /* POSIX.1b timers */
  168 + struct {
  169 + compat_timer_t _tid; /* timer id */
  170 + int _overrun; /* overrun count */
  171 + compat_sigval_t _sigval; /* same as below */
  172 + int _sys_private; /* not to be passed to user */
  173 + } _timer;
  174 +
  175 + /* POSIX.1b signals */
  176 + struct {
  177 + pid_t _pid; /* sender's pid */
  178 + uid_t _uid; /* sender's uid */
  179 + compat_sigval_t _sigval;
  180 + } _rt;
  181 +
  182 + /* SIGCHLD */
  183 + struct {
  184 + pid_t _pid; /* which child */
  185 + uid_t _uid; /* sender's uid */
  186 + int _status;/* exit code */
  187 + compat_clock_t _utime;
  188 + compat_clock_t _stime;
  189 + } _sigchld;
  190 +
  191 + /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
  192 + struct {
  193 + __u32 _addr; /* faulting insn/memory ref. - pointer */
  194 + } _sigfault;
  195 +
  196 + /* SIGPOLL */
  197 + struct {
  198 + int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
  199 + int _fd;
  200 + } _sigpoll;
  201 + } _sifields;
  202 +} compat_siginfo_t;
  203 +
  204 +/*
  205 + * How these fields are to be accessed.
  206 + */
  207 +#define si_pid _sifields._kill._pid
  208 +#define si_uid _sifields._kill._uid
  209 +#define si_status _sifields._sigchld._status
  210 +#define si_utime _sifields._sigchld._utime
  211 +#define si_stime _sifields._sigchld._stime
  212 +#define si_value _sifields._rt._sigval
  213 +#define si_int _sifields._rt._sigval.sival_int
  214 +#define si_ptr _sifields._rt._sigval.sival_ptr
  215 +#define si_addr _sifields._sigfault._addr
  216 +#define si_band _sifields._sigpoll._band
  217 +#define si_fd _sifields._sigpoll._fd
  218 +#define si_tid _sifields._timer._tid
  219 +#define si_overrun _sifields._timer._overrun
  220 +
147 221 #define COMPAT_OFF_T_MAX 0x7fffffff
148 222 #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
149 223  
... ... @@ -153,7 +227,6 @@
153 227 * as pointers because the syscall entry code will have
154 228 * appropriately converted them already.
155 229 */
156   -typedef u32 compat_uptr_t;
157 230  
158 231 static inline void __user *compat_ptr(compat_uptr_t uptr)
159 232 {
arch/s390/kernel/compat_linux.h
... ... @@ -23,74 +23,6 @@
23 23 __u32 sa_flags;
24 24 __u32 sa_restorer; /* Another 32 bit pointer */
25 25 };
26   -
27   -typedef struct compat_siginfo {
28   - int si_signo;
29   - int si_errno;
30   - int si_code;
31   -
32   - union {
33   - int _pad[((128/sizeof(int)) - 3)];
34   -
35   - /* kill() */
36   - struct {
37   - pid_t _pid; /* sender's pid */
38   - uid_t _uid; /* sender's uid */
39   - } _kill;
40   -
41   - /* POSIX.1b timers */
42   - struct {
43   - compat_timer_t _tid; /* timer id */
44   - int _overrun; /* overrun count */
45   - compat_sigval_t _sigval; /* same as below */
46   - int _sys_private; /* not to be passed to user */
47   - } _timer;
48   -
49   - /* POSIX.1b signals */
50   - struct {
51   - pid_t _pid; /* sender's pid */
52   - uid_t _uid; /* sender's uid */
53   - compat_sigval_t _sigval;
54   - } _rt;
55   -
56   - /* SIGCHLD */
57   - struct {
58   - pid_t _pid; /* which child */
59   - uid_t _uid; /* sender's uid */
60   - int _status;/* exit code */
61   - compat_clock_t _utime;
62   - compat_clock_t _stime;
63   - } _sigchld;
64   -
65   - /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
66   - struct {
67   - __u32 _addr; /* faulting insn/memory ref. - pointer */
68   - } _sigfault;
69   -
70   - /* SIGPOLL */
71   - struct {
72   - int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
73   - int _fd;
74   - } _sigpoll;
75   - } _sifields;
76   -} compat_siginfo_t;
77   -
78   -/*
79   - * How these fields are to be accessed.
80   - */
81   -#define si_pid _sifields._kill._pid
82   -#define si_uid _sifields._kill._uid
83   -#define si_status _sifields._sigchld._status
84   -#define si_utime _sifields._sigchld._utime
85   -#define si_stime _sifields._sigchld._stime
86   -#define si_value _sifields._rt._sigval
87   -#define si_int _sifields._rt._sigval.sival_int
88   -#define si_ptr _sifields._rt._sigval.sival_ptr
89   -#define si_addr _sifields._sigfault._addr
90   -#define si_band _sifields._sigpoll._band
91   -#define si_fd _sifields._sigpoll._fd
92   -#define si_tid _sifields._timer._tid
93   -#define si_overrun _sifields._timer._overrun
94 26  
95 27 /* asm/sigcontext.h */
96 28 typedef union
arch/sparc/include/asm/compat.h
... ... @@ -36,6 +36,7 @@
36 36 typedef u32 compat_uint_t;
37 37 typedef u32 compat_ulong_t;
38 38 typedef u64 compat_u64;
  39 +typedef u32 compat_uptr_t;
39 40  
40 41 struct compat_timespec {
41 42 compat_time_t tv_sec;
... ... @@ -147,6 +148,65 @@
147 148  
148 149 typedef u32 compat_sigset_word;
149 150  
  151 +typedef union compat_sigval {
  152 + compat_int_t sival_int;
  153 + compat_uptr_t sival_ptr;
  154 +} compat_sigval_t;
  155 +
  156 +#define SI_PAD_SIZE32 (128/sizeof(int) - 3)
  157 +
  158 +typedef struct compat_siginfo {
  159 + int si_signo;
  160 + int si_errno;
  161 + int si_code;
  162 +
  163 + union {
  164 + int _pad[SI_PAD_SIZE32];
  165 +
  166 + /* kill() */
  167 + struct {
  168 + compat_pid_t _pid; /* sender's pid */
  169 + unsigned int _uid; /* sender's uid */
  170 + } _kill;
  171 +
  172 + /* POSIX.1b timers */
  173 + struct {
  174 + compat_timer_t _tid; /* timer id */
  175 + int _overrun; /* overrun count */
  176 + compat_sigval_t _sigval; /* same as below */
  177 + int _sys_private; /* not to be passed to user */
  178 + } _timer;
  179 +
  180 + /* POSIX.1b signals */
  181 + struct {
  182 + compat_pid_t _pid; /* sender's pid */
  183 + unsigned int _uid; /* sender's uid */
  184 + compat_sigval_t _sigval;
  185 + } _rt;
  186 +
  187 + /* SIGCHLD */
  188 + struct {
  189 + compat_pid_t _pid; /* which child */
  190 + unsigned int _uid; /* sender's uid */
  191 + int _status; /* exit code */
  192 + compat_clock_t _utime;
  193 + compat_clock_t _stime;
  194 + } _sigchld;
  195 +
  196 + /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGEMT */
  197 + struct {
  198 + u32 _addr; /* faulting insn/memory ref. */
  199 + int _trapno;
  200 + } _sigfault;
  201 +
  202 + /* SIGPOLL */
  203 + struct {
  204 + int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
  205 + int _fd;
  206 + } _sigpoll;
  207 + } _sifields;
  208 +} compat_siginfo_t;
  209 +
150 210 #define COMPAT_OFF_T_MAX 0x7fffffff
151 211 #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
152 212  
... ... @@ -156,7 +216,6 @@
156 216 * as pointers because the syscall entry code will have
157 217 * appropriately converted them already.
158 218 */
159   -typedef u32 compat_uptr_t;
160 219  
161 220 static inline void __user *compat_ptr(compat_uptr_t uptr)
162 221 {
arch/sparc/include/asm/siginfo.h
... ... @@ -3,7 +3,6 @@
3 3  
4 4 #if defined(__sparc__) && defined(__arch64__)
5 5  
6   -#define SI_PAD_SIZE32 ((SI_MAX_SIZE/sizeof(int)) - 3)
7 6 #define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
8 7 #define __ARCH_SI_BAND_T int
9 8  
arch/sparc/kernel/signal32.c
... ... @@ -54,58 +54,6 @@
54 54 /* __siginfo_rwin_t * */u32 rwin_save;
55 55 } __attribute__((aligned(8)));
56 56  
57   -typedef struct compat_siginfo{
58   - int si_signo;
59   - int si_errno;
60   - int si_code;
61   -
62   - union {
63   - int _pad[SI_PAD_SIZE32];
64   -
65   - /* kill() */
66   - struct {
67   - compat_pid_t _pid; /* sender's pid */
68   - unsigned int _uid; /* sender's uid */
69   - } _kill;
70   -
71   - /* POSIX.1b timers */
72   - struct {
73   - compat_timer_t _tid; /* timer id */
74   - int _overrun; /* overrun count */
75   - compat_sigval_t _sigval; /* same as below */
76   - int _sys_private; /* not to be passed to user */
77   - } _timer;
78   -
79   - /* POSIX.1b signals */
80   - struct {
81   - compat_pid_t _pid; /* sender's pid */
82   - unsigned int _uid; /* sender's uid */
83   - compat_sigval_t _sigval;
84   - } _rt;
85   -
86   - /* SIGCHLD */
87   - struct {
88   - compat_pid_t _pid; /* which child */
89   - unsigned int _uid; /* sender's uid */
90   - int _status; /* exit code */
91   - compat_clock_t _utime;
92   - compat_clock_t _stime;
93   - } _sigchld;
94   -
95   - /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGEMT */
96   - struct {
97   - u32 _addr; /* faulting insn/memory ref. */
98   - int _trapno;
99   - } _sigfault;
100   -
101   - /* SIGPOLL */
102   - struct {
103   - int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
104   - int _fd;
105   - } _sigpoll;
106   - } _sifields;
107   -}compat_siginfo_t;
108   -
109 57 struct rt_signal_frame32 {
110 58 struct sparc_stackf32 ss;
111 59 compat_siginfo_t info;
arch/tile/include/asm/compat.h
... ... @@ -110,6 +110,68 @@
110 110  
111 111 typedef u32 compat_sigset_word;
112 112  
  113 +typedef union compat_sigval {
  114 + compat_int_t sival_int;
  115 + compat_uptr_t sival_ptr;
  116 +} compat_sigval_t;
  117 +
  118 +#define COMPAT_SI_PAD_SIZE (128/sizeof(int) - 3)
  119 +
  120 +typedef struct compat_siginfo {
  121 + int si_signo;
  122 + int si_errno;
  123 + int si_code;
  124 +
  125 + union {
  126 + int _pad[COMPAT_SI_PAD_SIZE];
  127 +
  128 + /* kill() */
  129 + struct {
  130 + unsigned int _pid; /* sender's pid */
  131 + unsigned int _uid; /* sender's uid */
  132 + } _kill;
  133 +
  134 + /* POSIX.1b timers */
  135 + struct {
  136 + compat_timer_t _tid; /* timer id */
  137 + int _overrun; /* overrun count */
  138 + compat_sigval_t _sigval; /* same as below */
  139 + int _sys_private; /* not to be passed to user */
  140 + int _overrun_incr; /* amount to add to overrun */
  141 + } _timer;
  142 +
  143 + /* POSIX.1b signals */
  144 + struct {
  145 + unsigned int _pid; /* sender's pid */
  146 + unsigned int _uid; /* sender's uid */
  147 + compat_sigval_t _sigval;
  148 + } _rt;
  149 +
  150 + /* SIGCHLD */
  151 + struct {
  152 + unsigned int _pid; /* which child */
  153 + unsigned int _uid; /* sender's uid */
  154 + int _status; /* exit code */
  155 + compat_clock_t _utime;
  156 + compat_clock_t _stime;
  157 + } _sigchld;
  158 +
  159 + /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
  160 + struct {
  161 + unsigned int _addr; /* faulting insn/memory ref. */
  162 +#ifdef __ARCH_SI_TRAPNO
  163 + int _trapno; /* TRAP # which caused the signal */
  164 +#endif
  165 + } _sigfault;
  166 +
  167 + /* SIGPOLL */
  168 + struct {
  169 + int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
  170 + int _fd;
  171 + } _sigpoll;
  172 + } _sifields;
  173 +} compat_siginfo_t;
  174 +
113 175 #define COMPAT_OFF_T_MAX 0x7fffffff
114 176 #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
115 177  
arch/tile/kernel/compat_signal.c
... ... @@ -55,63 +55,6 @@
55 55 sigset_t uc_sigmask; /* mask last for extensibility */
56 56 };
57 57  
58   -#define COMPAT_SI_PAD_SIZE ((SI_MAX_SIZE - 3 * sizeof(int)) / sizeof(int))
59   -
60   -struct compat_siginfo {
61   - int si_signo;
62   - int si_errno;
63   - int si_code;
64   -
65   - union {
66   - int _pad[COMPAT_SI_PAD_SIZE];
67   -
68   - /* kill() */
69   - struct {
70   - unsigned int _pid; /* sender's pid */
71   - unsigned int _uid; /* sender's uid */
72   - } _kill;
73   -
74   - /* POSIX.1b timers */
75   - struct {
76   - compat_timer_t _tid; /* timer id */
77   - int _overrun; /* overrun count */
78   - compat_sigval_t _sigval; /* same as below */
79   - int _sys_private; /* not to be passed to user */
80   - int _overrun_incr; /* amount to add to overrun */
81   - } _timer;
82   -
83   - /* POSIX.1b signals */
84   - struct {
85   - unsigned int _pid; /* sender's pid */
86   - unsigned int _uid; /* sender's uid */
87   - compat_sigval_t _sigval;
88   - } _rt;
89   -
90   - /* SIGCHLD */
91   - struct {
92   - unsigned int _pid; /* which child */
93   - unsigned int _uid; /* sender's uid */
94   - int _status; /* exit code */
95   - compat_clock_t _utime;
96   - compat_clock_t _stime;
97   - } _sigchld;
98   -
99   - /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
100   - struct {
101   - unsigned int _addr; /* faulting insn/memory ref. */
102   -#ifdef __ARCH_SI_TRAPNO
103   - int _trapno; /* TRAP # which caused the signal */
104   -#endif
105   - } _sigfault;
106   -
107   - /* SIGPOLL */
108   - struct {
109   - int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
110   - int _fd;
111   - } _sigpoll;
112   - } _sifields;
113   -};
114   -
115 58 struct compat_rt_sigframe {
116 59 unsigned char save_area[C_ABI_SAVE_AREA_SIZE]; /* caller save area */
117 60 struct compat_siginfo info;
arch/x86/include/asm/compat.h
... ... @@ -41,6 +41,7 @@
41 41 typedef u32 compat_uint_t;
42 42 typedef u32 compat_ulong_t;
43 43 typedef u64 __attribute__((aligned(4))) compat_u64;
  44 +typedef u32 compat_uptr_t;
44 45  
45 46 struct compat_timespec {
46 47 compat_time_t tv_sec;
... ... @@ -124,6 +125,78 @@
124 125  
125 126 typedef u32 compat_sigset_word;
126 127  
  128 +typedef union compat_sigval {
  129 + compat_int_t sival_int;
  130 + compat_uptr_t sival_ptr;
  131 +} compat_sigval_t;
  132 +
  133 +typedef struct compat_siginfo {
  134 + int si_signo;
  135 + int si_errno;
  136 + int si_code;
  137 +
  138 + union {
  139 + int _pad[128/sizeof(int) - 3];
  140 +
  141 + /* kill() */
  142 + struct {
  143 + unsigned int _pid; /* sender's pid */
  144 + unsigned int _uid; /* sender's uid */
  145 + } _kill;
  146 +
  147 + /* POSIX.1b timers */
  148 + struct {
  149 + compat_timer_t _tid; /* timer id */
  150 + int _overrun; /* overrun count */
  151 + compat_sigval_t _sigval; /* same as below */
  152 + int _sys_private; /* not to be passed to user */
  153 + int _overrun_incr; /* amount to add to overrun */
  154 + } _timer;
  155 +
  156 + /* POSIX.1b signals */
  157 + struct {
  158 + unsigned int _pid; /* sender's pid */
  159 + unsigned int _uid; /* sender's uid */
  160 + compat_sigval_t _sigval;
  161 + } _rt;
  162 +
  163 + /* SIGCHLD */
  164 + struct {
  165 + unsigned int _pid; /* which child */
  166 + unsigned int _uid; /* sender's uid */
  167 + int _status; /* exit code */
  168 + compat_clock_t _utime;
  169 + compat_clock_t _stime;
  170 + } _sigchld;
  171 +
  172 + /* SIGCHLD (x32 version) */
  173 + struct {
  174 + unsigned int _pid; /* which child */
  175 + unsigned int _uid; /* sender's uid */
  176 + int _status; /* exit code */
  177 + compat_s64 _utime;
  178 + compat_s64 _stime;
  179 + } _sigchld_x32;
  180 +
  181 + /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
  182 + struct {
  183 + unsigned int _addr; /* faulting insn/memory ref. */
  184 + } _sigfault;
  185 +
  186 + /* SIGPOLL */
  187 + struct {
  188 + int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
  189 + int _fd;
  190 + } _sigpoll;
  191 +
  192 + struct {
  193 + unsigned int _call_addr; /* calling insn */
  194 + int _syscall; /* triggering system call number */
  195 + unsigned int _arch; /* AUDIT_ARCH_* of syscall */
  196 + } _sigsys;
  197 + } _sifields;
  198 +} compat_siginfo_t;
  199 +
127 200 #define COMPAT_OFF_T_MAX 0x7fffffff
128 201 #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
129 202  
... ... @@ -209,7 +282,6 @@
209 282 * as pointers because the syscall entry code will have
210 283 * appropriately converted them already.
211 284 */
212   -typedef u32 compat_uptr_t;
213 285  
214 286 static inline void __user *compat_ptr(compat_uptr_t uptr)
215 287 {
arch/x86/include/asm/ia32.h
... ... @@ -86,73 +86,6 @@
86 86 unsigned long long st_ino;
87 87 } __attribute__((packed));
88 88  
89   -typedef struct compat_siginfo {
90   - int si_signo;
91   - int si_errno;
92   - int si_code;
93   -
94   - union {
95   - int _pad[((128 / sizeof(int)) - 3)];
96   -
97   - /* kill() */
98   - struct {
99   - unsigned int _pid; /* sender's pid */
100   - unsigned int _uid; /* sender's uid */
101   - } _kill;
102   -
103   - /* POSIX.1b timers */
104   - struct {
105   - compat_timer_t _tid; /* timer id */
106   - int _overrun; /* overrun count */
107   - compat_sigval_t _sigval; /* same as below */
108   - int _sys_private; /* not to be passed to user */
109   - int _overrun_incr; /* amount to add to overrun */
110   - } _timer;
111   -
112   - /* POSIX.1b signals */
113   - struct {
114   - unsigned int _pid; /* sender's pid */
115   - unsigned int _uid; /* sender's uid */
116   - compat_sigval_t _sigval;
117   - } _rt;
118   -
119   - /* SIGCHLD */
120   - struct {
121   - unsigned int _pid; /* which child */
122   - unsigned int _uid; /* sender's uid */
123   - int _status; /* exit code */
124   - compat_clock_t _utime;
125   - compat_clock_t _stime;
126   - } _sigchld;
127   -
128   - /* SIGCHLD (x32 version) */
129   - struct {
130   - unsigned int _pid; /* which child */
131   - unsigned int _uid; /* sender's uid */
132   - int _status; /* exit code */
133   - compat_s64 _utime;
134   - compat_s64 _stime;
135   - } _sigchld_x32;
136   -
137   - /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
138   - struct {
139   - unsigned int _addr; /* faulting insn/memory ref. */
140   - } _sigfault;
141   -
142   - /* SIGPOLL */
143   - struct {
144   - int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
145   - int _fd;
146   - } _sigpoll;
147   -
148   - struct {
149   - unsigned int _call_addr; /* calling insn */
150   - int _syscall; /* triggering system call number */
151   - unsigned int _arch; /* AUDIT_ARCH_* of syscall */
152   - } _sigsys;
153   - } _sifields;
154   -} compat_siginfo_t;
155   -
156 89 #define IA32_STACK_TOP IA32_PAGE_OFFSET
157 90  
158 91 #ifdef __KERNEL__
include/linux/compat.h
... ... @@ -160,11 +160,6 @@
160 160 char f_fpack[6];
161 161 };
162 162  
163   -typedef union compat_sigval {
164   - compat_int_t sival_int;
165   - compat_uptr_t sival_ptr;
166   -} compat_sigval_t;
167   -
168 163 #define COMPAT_SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 3)
169 164  
170 165 typedef struct compat_sigevent {