diff options
| author | Al Viro <viro@zeniv.linux.org.uk> | 2012-12-25 18:42:26 -0500 |
|---|---|---|
| committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-02-03 18:16:26 -0500 |
| commit | 29fd448084e2da6d19ab675cf01d4a65fe2fcc44 (patch) | |
| tree | f5e04e60b38704b30a83e6665e10b475a4ec1f43 | |
| parent | d7c43e4afb411db68bcf652c96e4206c6085f5e8 (diff) | |
x86: switch to generic compat rt_sigaction()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| -rw-r--r-- | arch/x86/Kconfig | 1 | ||||
| -rw-r--r-- | arch/x86/ia32/sys_ia32.c | 76 | ||||
| -rw-r--r-- | arch/x86/include/asm/ia32.h | 8 | ||||
| -rw-r--r-- | arch/x86/include/asm/sys_ia32.h | 3 | ||||
| -rw-r--r-- | arch/x86/syscalls/syscall_32.tbl | 2 | ||||
| -rw-r--r-- | arch/x86/syscalls/syscall_64.tbl | 2 |
6 files changed, 3 insertions, 89 deletions
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 5bda2d7f1b69..0271a1411af3 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
| @@ -114,6 +114,7 @@ config X86 | |||
| 114 | select MODULES_USE_ELF_RELA if X86_64 | 114 | select MODULES_USE_ELF_RELA if X86_64 |
| 115 | select CLONE_BACKWARDS if X86_32 | 115 | select CLONE_BACKWARDS if X86_32 |
| 116 | select GENERIC_SIGALTSTACK | 116 | select GENERIC_SIGALTSTACK |
| 117 | select GENERIC_COMPAT_RT_SIGACTION | ||
| 117 | select GENERIC_COMPAT_RT_SIGQUEUEINFO | 118 | select GENERIC_COMPAT_RT_SIGQUEUEINFO |
| 118 | select GENERIC_COMPAT_RT_SIGPENDING | 119 | select GENERIC_COMPAT_RT_SIGPENDING |
| 119 | select OLD_SIGSUSPEND3 if X86_32 || IA32_EMULATION | 120 | select OLD_SIGSUSPEND3 if X86_32 || IA32_EMULATION |
diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c index cdf22ba9fa3a..ffe9751b1486 100644 --- a/arch/x86/ia32/sys_ia32.c +++ b/arch/x86/ia32/sys_ia32.c | |||
| @@ -172,82 +172,6 @@ asmlinkage long sys32_mprotect(unsigned long start, size_t len, | |||
| 172 | return sys_mprotect(start, len, prot); | 172 | return sys_mprotect(start, len, prot); |
| 173 | } | 173 | } |
| 174 | 174 | ||
| 175 | asmlinkage long sys32_rt_sigaction(int sig, struct sigaction32 __user *act, | ||
| 176 | struct sigaction32 __user *oact, | ||
| 177 | unsigned int sigsetsize) | ||
| 178 | { | ||
| 179 | struct k_sigaction new_ka, old_ka; | ||
| 180 | int ret; | ||
| 181 | compat_sigset_t set32; | ||
| 182 | |||
| 183 | /* XXX: Don't preclude handling different sized sigset_t's. */ | ||
| 184 | if (sigsetsize != sizeof(compat_sigset_t)) | ||
| 185 | return -EINVAL; | ||
| 186 | |||
| 187 | if (act) { | ||
| 188 | compat_uptr_t handler, restorer; | ||
| 189 | |||
| 190 | if (!access_ok(VERIFY_READ, act, sizeof(*act)) || | ||
| 191 | __get_user(handler, &act->sa_handler) || | ||
| 192 | __get_user(new_ka.sa.sa_flags, &act->sa_flags) || | ||
| 193 | __get_user(restorer, &act->sa_restorer) || | ||
| 194 | __copy_from_user(&set32, &act->sa_mask, | ||
| 195 | sizeof(compat_sigset_t))) | ||
| 196 | return -EFAULT; | ||
| 197 | new_ka.sa.sa_handler = compat_ptr(handler); | ||
| 198 | new_ka.sa.sa_restorer = compat_ptr(restorer); | ||
| 199 | |||
| 200 | /* | ||
| 201 | * FIXME: here we rely on _COMPAT_NSIG_WORS to be >= | ||
| 202 | * than _NSIG_WORDS << 1 | ||
| 203 | */ | ||
| 204 | switch (_NSIG_WORDS) { | ||
| 205 | case 4: new_ka.sa.sa_mask.sig[3] = set32.sig[6] | ||
| 206 | | (((long)set32.sig[7]) << 32); | ||
| 207 | case 3: new_ka.sa.sa_mask.sig[2] = set32.sig[4] | ||
| 208 | | (((long)set32.sig[5]) << 32); | ||
| 209 | case 2: new_ka.sa.sa_mask.sig[1] = set32.sig[2] | ||
| 210 | | (((long)set32.sig[3]) << 32); | ||
| 211 | case 1: new_ka.sa.sa_mask.sig[0] = set32.sig[0] | ||
| 212 | | (((long)set32.sig[1]) << 32); | ||
| 213 | } | ||
| 214 | } | ||
| 215 | |||
| 216 | ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); | ||
| 217 | |||
| 218 | if (!ret && oact) { | ||
| 219 | /* | ||
| 220 | * FIXME: here we rely on _COMPAT_NSIG_WORS to be >= | ||
| 221 | * than _NSIG_WORDS << 1 | ||
| 222 | */ | ||
| 223 | switch (_NSIG_WORDS) { | ||
| 224 | case 4: | ||
| 225 | set32.sig[7] = (old_ka.sa.sa_mask.sig[3] >> 32); | ||
| 226 | set32.sig[6] = old_ka.sa.sa_mask.sig[3]; | ||
| 227 | case 3: | ||
| 228 | set32.sig[5] = (old_ka.sa.sa_mask.sig[2] >> 32); | ||
| 229 | set32.sig[4] = old_ka.sa.sa_mask.sig[2]; | ||
| 230 | case 2: | ||
| 231 | set32.sig[3] = (old_ka.sa.sa_mask.sig[1] >> 32); | ||
| 232 | set32.sig[2] = old_ka.sa.sa_mask.sig[1]; | ||
| 233 | case 1: | ||
| 234 | set32.sig[1] = (old_ka.sa.sa_mask.sig[0] >> 32); | ||
| 235 | set32.sig[0] = old_ka.sa.sa_mask.sig[0]; | ||
| 236 | } | ||
| 237 | if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) || | ||
| 238 | __put_user(ptr_to_compat(old_ka.sa.sa_handler), | ||
| 239 | &oact->sa_handler) || | ||
| 240 | __put_user(ptr_to_compat(old_ka.sa.sa_restorer), | ||
| 241 | &oact->sa_restorer) || | ||
| 242 | __put_user(old_ka.sa.sa_flags, &oact->sa_flags) || | ||
| 243 | __copy_to_user(&oact->sa_mask, &set32, | ||
| 244 | sizeof(compat_sigset_t))) | ||
| 245 | return -EFAULT; | ||
| 246 | } | ||
| 247 | |||
| 248 | return ret; | ||
| 249 | } | ||
| 250 | |||
| 251 | asmlinkage long sys32_sigaction(int sig, struct old_sigaction32 __user *act, | 175 | asmlinkage long sys32_sigaction(int sig, struct old_sigaction32 __user *act, |
| 252 | struct old_sigaction32 __user *oact) | 176 | struct old_sigaction32 __user *oact) |
| 253 | { | 177 | { |
diff --git a/arch/x86/include/asm/ia32.h b/arch/x86/include/asm/ia32.h index 4c6da2e4bb1d..259372d1ee96 100644 --- a/arch/x86/include/asm/ia32.h +++ b/arch/x86/include/asm/ia32.h | |||
| @@ -13,14 +13,6 @@ | |||
| 13 | #include <asm/sigcontext32.h> | 13 | #include <asm/sigcontext32.h> |
| 14 | 14 | ||
| 15 | /* signal.h */ | 15 | /* signal.h */ |
| 16 | struct sigaction32 { | ||
| 17 | unsigned int sa_handler; /* Really a pointer, but need to deal | ||
| 18 | with 32 bits */ | ||
| 19 | unsigned int sa_flags; | ||
| 20 | unsigned int sa_restorer; /* Another 32 bit pointer */ | ||
| 21 | compat_sigset_t sa_mask; /* A 32 bit mask */ | ||
| 22 | }; | ||
| 23 | |||
| 24 | struct old_sigaction32 { | 16 | struct old_sigaction32 { |
| 25 | unsigned int sa_handler; /* Really a pointer, but need to deal | 17 | unsigned int sa_handler; /* Really a pointer, but need to deal |
| 26 | with 32 bits */ | 18 | with 32 bits */ |
diff --git a/arch/x86/include/asm/sys_ia32.h b/arch/x86/include/asm/sys_ia32.h index c603c8f7d6d5..2bf18f1158bc 100644 --- a/arch/x86/include/asm/sys_ia32.h +++ b/arch/x86/include/asm/sys_ia32.h | |||
| @@ -32,10 +32,7 @@ struct mmap_arg_struct32; | |||
| 32 | asmlinkage long sys32_mmap(struct mmap_arg_struct32 __user *); | 32 | asmlinkage long sys32_mmap(struct mmap_arg_struct32 __user *); |
| 33 | asmlinkage long sys32_mprotect(unsigned long, size_t, unsigned long); | 33 | asmlinkage long sys32_mprotect(unsigned long, size_t, unsigned long); |
| 34 | 34 | ||
| 35 | struct sigaction32; | ||
| 36 | struct old_sigaction32; | 35 | struct old_sigaction32; |
| 37 | asmlinkage long sys32_rt_sigaction(int, struct sigaction32 __user *, | ||
| 38 | struct sigaction32 __user *, unsigned int); | ||
| 39 | asmlinkage long sys32_sigaction(int, struct old_sigaction32 __user *, | 36 | asmlinkage long sys32_sigaction(int, struct old_sigaction32 __user *, |
| 40 | struct old_sigaction32 __user *); | 37 | struct old_sigaction32 __user *); |
| 41 | asmlinkage long sys32_alarm(unsigned int); | 38 | asmlinkage long sys32_alarm(unsigned int); |
diff --git a/arch/x86/syscalls/syscall_32.tbl b/arch/x86/syscalls/syscall_32.tbl index f6006b2c1936..2fada84c16ab 100644 --- a/arch/x86/syscalls/syscall_32.tbl +++ b/arch/x86/syscalls/syscall_32.tbl | |||
| @@ -180,7 +180,7 @@ | |||
| 180 | 171 i386 getresgid sys_getresgid16 | 180 | 171 i386 getresgid sys_getresgid16 |
| 181 | 172 i386 prctl sys_prctl | 181 | 172 i386 prctl sys_prctl |
| 182 | 173 i386 rt_sigreturn sys_rt_sigreturn stub32_rt_sigreturn | 182 | 173 i386 rt_sigreturn sys_rt_sigreturn stub32_rt_sigreturn |
| 183 | 174 i386 rt_sigaction sys_rt_sigaction sys32_rt_sigaction | 183 | 174 i386 rt_sigaction sys_rt_sigaction compat_sys_rt_sigaction |
| 184 | 175 i386 rt_sigprocmask sys_rt_sigprocmask | 184 | 175 i386 rt_sigprocmask sys_rt_sigprocmask |
| 185 | 176 i386 rt_sigpending sys_rt_sigpending compat_sys_rt_sigpending | 185 | 176 i386 rt_sigpending sys_rt_sigpending compat_sys_rt_sigpending |
| 186 | 177 i386 rt_sigtimedwait sys_rt_sigtimedwait compat_sys_rt_sigtimedwait | 186 | 177 i386 rt_sigtimedwait sys_rt_sigtimedwait compat_sys_rt_sigtimedwait |
diff --git a/arch/x86/syscalls/syscall_64.tbl b/arch/x86/syscalls/syscall_64.tbl index 6ceaa636e808..38ae65dfd14f 100644 --- a/arch/x86/syscalls/syscall_64.tbl +++ b/arch/x86/syscalls/syscall_64.tbl | |||
| @@ -325,7 +325,7 @@ | |||
| 325 | # x32-specific system call numbers start at 512 to avoid cache impact | 325 | # x32-specific system call numbers start at 512 to avoid cache impact |
| 326 | # for native 64-bit operation. | 326 | # for native 64-bit operation. |
| 327 | # | 327 | # |
| 328 | 512 x32 rt_sigaction sys32_rt_sigaction | 328 | 512 x32 rt_sigaction compat_sys_rt_sigaction |
| 329 | 513 x32 rt_sigreturn stub_x32_rt_sigreturn | 329 | 513 x32 rt_sigreturn stub_x32_rt_sigreturn |
| 330 | 514 x32 ioctl compat_sys_ioctl | 330 | 514 x32 ioctl compat_sys_ioctl |
| 331 | 515 x32 readv compat_sys_readv | 331 | 515 x32 readv compat_sys_readv |
