diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-12-23 01:56:45 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-02-14 09:17:29 -0500 |
commit | 207bdae452e6d3eeba19cc3912e5dfb088adc376 (patch) | |
tree | b2a11a7ba5ee7152d0a9e9f9d42a5dc02c48ed57 /arch/arm64 | |
parent | 0aa0203fb43f04714004b2c4ad33b858e240555d (diff) |
arm64: switch to generic sigaltstack
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/arm64')
-rw-r--r-- | arch/arm64/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm64/include/asm/syscalls.h | 2 | ||||
-rw-r--r-- | arch/arm64/include/asm/unistd32.h | 2 | ||||
-rw-r--r-- | arch/arm64/kernel/entry.S | 5 | ||||
-rw-r--r-- | arch/arm64/kernel/signal.c | 17 | ||||
-rw-r--r-- | arch/arm64/kernel/signal32.c | 53 | ||||
-rw-r--r-- | arch/arm64/kernel/sys.c | 1 | ||||
-rw-r--r-- | arch/arm64/kernel/sys32.S | 5 |
8 files changed, 6 insertions, 80 deletions
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index f8f362aafee9..d9c901dd3fdb 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig | |||
@@ -10,6 +10,7 @@ config ARM64 | |||
10 | select GENERIC_IOMAP | 10 | select GENERIC_IOMAP |
11 | select GENERIC_IRQ_PROBE | 11 | select GENERIC_IRQ_PROBE |
12 | select GENERIC_IRQ_SHOW | 12 | select GENERIC_IRQ_SHOW |
13 | select GENERIC_SIGALTSTACK | ||
13 | select GENERIC_SMP_IDLE_THREAD | 14 | select GENERIC_SMP_IDLE_THREAD |
14 | select GENERIC_TIME_VSYSCALL | 15 | select GENERIC_TIME_VSYSCALL |
15 | select HARDIRQS_SW_RESEND | 16 | select HARDIRQS_SW_RESEND |
diff --git a/arch/arm64/include/asm/syscalls.h b/arch/arm64/include/asm/syscalls.h index 20d63b290665..48fe7c600e98 100644 --- a/arch/arm64/include/asm/syscalls.h +++ b/arch/arm64/include/asm/syscalls.h | |||
@@ -24,8 +24,6 @@ | |||
24 | * System call wrappers implemented in kernel/entry.S. | 24 | * System call wrappers implemented in kernel/entry.S. |
25 | */ | 25 | */ |
26 | asmlinkage long sys_rt_sigreturn_wrapper(void); | 26 | asmlinkage long sys_rt_sigreturn_wrapper(void); |
27 | asmlinkage long sys_sigaltstack_wrapper(const stack_t __user *uss, | ||
28 | stack_t __user *uoss); | ||
29 | 27 | ||
30 | #include <asm-generic/syscalls.h> | 28 | #include <asm-generic/syscalls.h> |
31 | 29 | ||
diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h index 5ef47ba3ed45..008406aff09f 100644 --- a/arch/arm64/include/asm/unistd32.h +++ b/arch/arm64/include/asm/unistd32.h | |||
@@ -207,7 +207,7 @@ __SYSCALL(182, sys_chown16) | |||
207 | __SYSCALL(183, sys_getcwd) | 207 | __SYSCALL(183, sys_getcwd) |
208 | __SYSCALL(184, sys_capget) | 208 | __SYSCALL(184, sys_capget) |
209 | __SYSCALL(185, sys_capset) | 209 | __SYSCALL(185, sys_capset) |
210 | __SYSCALL(186, compat_sys_sigaltstack_wrapper) | 210 | __SYSCALL(186, compat_sys_sigaltstack) |
211 | __SYSCALL(187, compat_sys_sendfile) | 211 | __SYSCALL(187, compat_sys_sendfile) |
212 | __SYSCALL(188, sys_ni_syscall) /* 188 reserved */ | 212 | __SYSCALL(188, sys_ni_syscall) /* 188 reserved */ |
213 | __SYSCALL(189, sys_ni_syscall) /* 189 reserved */ | 213 | __SYSCALL(189, sys_ni_syscall) /* 189 reserved */ |
diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 9c94f404ded6..514d6098dbee 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S | |||
@@ -677,10 +677,5 @@ ENTRY(sys_rt_sigreturn_wrapper) | |||
677 | b sys_rt_sigreturn | 677 | b sys_rt_sigreturn |
678 | ENDPROC(sys_rt_sigreturn_wrapper) | 678 | ENDPROC(sys_rt_sigreturn_wrapper) |
679 | 679 | ||
680 | ENTRY(sys_sigaltstack_wrapper) | ||
681 | ldr x2, [sp, #S_SP] | ||
682 | b sys_sigaltstack | ||
683 | ENDPROC(sys_sigaltstack_wrapper) | ||
684 | |||
685 | ENTRY(handle_arch_irq) | 680 | ENTRY(handle_arch_irq) |
686 | .quad 0 | 681 | .quad 0 |
diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c index abd756315cb5..890a591f75dd 100644 --- a/arch/arm64/kernel/signal.c +++ b/arch/arm64/kernel/signal.c | |||
@@ -149,8 +149,7 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs *regs) | |||
149 | if (restore_sigframe(regs, frame)) | 149 | if (restore_sigframe(regs, frame)) |
150 | goto badframe; | 150 | goto badframe; |
151 | 151 | ||
152 | if (do_sigaltstack(&frame->uc.uc_stack, | 152 | if (restore_altstack(&frame->uc.uc_stack)) |
153 | NULL, regs->sp) == -EFAULT) | ||
154 | goto badframe; | 153 | goto badframe; |
155 | 154 | ||
156 | return regs->regs[0]; | 155 | return regs->regs[0]; |
@@ -164,12 +163,6 @@ badframe: | |||
164 | return 0; | 163 | return 0; |
165 | } | 164 | } |
166 | 165 | ||
167 | asmlinkage long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, | ||
168 | unsigned long sp) | ||
169 | { | ||
170 | return do_sigaltstack(uss, uoss, sp); | ||
171 | } | ||
172 | |||
173 | static int setup_sigframe(struct rt_sigframe __user *sf, | 166 | static int setup_sigframe(struct rt_sigframe __user *sf, |
174 | struct pt_regs *regs, sigset_t *set) | 167 | struct pt_regs *regs, sigset_t *set) |
175 | { | 168 | { |
@@ -250,7 +243,6 @@ static int setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info, | |||
250 | sigset_t *set, struct pt_regs *regs) | 243 | sigset_t *set, struct pt_regs *regs) |
251 | { | 244 | { |
252 | struct rt_sigframe __user *frame; | 245 | struct rt_sigframe __user *frame; |
253 | stack_t stack; | ||
254 | int err = 0; | 246 | int err = 0; |
255 | 247 | ||
256 | frame = get_sigframe(ka, regs); | 248 | frame = get_sigframe(ka, regs); |
@@ -260,12 +252,7 @@ static int setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info, | |||
260 | __put_user_error(0, &frame->uc.uc_flags, err); | 252 | __put_user_error(0, &frame->uc.uc_flags, err); |
261 | __put_user_error(NULL, &frame->uc.uc_link, err); | 253 | __put_user_error(NULL, &frame->uc.uc_link, err); |
262 | 254 | ||
263 | memset(&stack, 0, sizeof(stack)); | 255 | err |= __save_altstack(&frame->uc.uc_stack, regs->sp); |
264 | stack.ss_sp = (void __user *)current->sas_ss_sp; | ||
265 | stack.ss_flags = sas_ss_flags(regs->sp); | ||
266 | stack.ss_size = current->sas_ss_size; | ||
267 | err |= __copy_to_user(&frame->uc.uc_stack, &stack, sizeof(stack)); | ||
268 | |||
269 | err |= setup_sigframe(frame, regs, set); | 256 | err |= setup_sigframe(frame, regs, set); |
270 | if (err == 0) { | 257 | if (err == 0) { |
271 | setup_return(regs, ka, frame, usig); | 258 | setup_return(regs, ka, frame, usig); |
diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c index a4db3d22aac4..54920c5342b2 100644 --- a/arch/arm64/kernel/signal32.c +++ b/arch/arm64/kernel/signal32.c | |||
@@ -42,12 +42,6 @@ struct compat_old_sigaction { | |||
42 | compat_uptr_t sa_restorer; | 42 | compat_uptr_t sa_restorer; |
43 | }; | 43 | }; |
44 | 44 | ||
45 | typedef struct compat_sigaltstack { | ||
46 | compat_uptr_t ss_sp; | ||
47 | int ss_flags; | ||
48 | compat_size_t ss_size; | ||
49 | } compat_stack_t; | ||
50 | |||
51 | struct compat_sigcontext { | 45 | struct compat_sigcontext { |
52 | /* We always set these two fields to 0 */ | 46 | /* We always set these two fields to 0 */ |
53 | compat_ulong_t trap_no; | 47 | compat_ulong_t trap_no; |
@@ -423,43 +417,6 @@ asmlinkage int compat_sys_rt_sigaction(int sig, | |||
423 | return ret; | 417 | return ret; |
424 | } | 418 | } |
425 | 419 | ||
426 | int compat_do_sigaltstack(compat_uptr_t compat_uss, compat_uptr_t compat_uoss, | ||
427 | compat_ulong_t sp) | ||
428 | { | ||
429 | compat_stack_t __user *newstack = compat_ptr(compat_uss); | ||
430 | compat_stack_t __user *oldstack = compat_ptr(compat_uoss); | ||
431 | compat_uptr_t ss_sp; | ||
432 | int ret; | ||
433 | mm_segment_t old_fs; | ||
434 | stack_t uss, uoss; | ||
435 | |||
436 | /* Marshall the compat new stack into a stack_t */ | ||
437 | if (newstack) { | ||
438 | if (get_user(ss_sp, &newstack->ss_sp) || | ||
439 | __get_user(uss.ss_flags, &newstack->ss_flags) || | ||
440 | __get_user(uss.ss_size, &newstack->ss_size)) | ||
441 | return -EFAULT; | ||
442 | uss.ss_sp = compat_ptr(ss_sp); | ||
443 | } | ||
444 | |||
445 | old_fs = get_fs(); | ||
446 | set_fs(KERNEL_DS); | ||
447 | /* The __user pointer casts are valid because of the set_fs() */ | ||
448 | ret = do_sigaltstack( | ||
449 | newstack ? (stack_t __user *) &uss : NULL, | ||
450 | oldstack ? (stack_t __user *) &uoss : NULL, | ||
451 | (unsigned long)sp); | ||
452 | set_fs(old_fs); | ||
453 | |||
454 | /* Convert the old stack_t into a compat stack. */ | ||
455 | if (!ret && oldstack && | ||
456 | (put_user(ptr_to_compat(uoss.ss_sp), &oldstack->ss_sp) || | ||
457 | __put_user(uoss.ss_flags, &oldstack->ss_flags) || | ||
458 | __put_user(uoss.ss_size, &oldstack->ss_size))) | ||
459 | return -EFAULT; | ||
460 | return ret; | ||
461 | } | ||
462 | |||
463 | static int compat_restore_sigframe(struct pt_regs *regs, | 420 | static int compat_restore_sigframe(struct pt_regs *regs, |
464 | struct compat_sigframe __user *sf) | 421 | struct compat_sigframe __user *sf) |
465 | { | 422 | { |
@@ -562,9 +519,7 @@ asmlinkage int compat_sys_rt_sigreturn(struct pt_regs *regs) | |||
562 | if (compat_restore_sigframe(regs, &frame->sig)) | 519 | if (compat_restore_sigframe(regs, &frame->sig)) |
563 | goto badframe; | 520 | goto badframe; |
564 | 521 | ||
565 | if (compat_do_sigaltstack(ptr_to_compat(&frame->sig.uc.uc_stack), | 522 | if (compat_restore_altstack(&frame->sig.uc.uc_stack)) |
566 | ptr_to_compat((void __user *)NULL), | ||
567 | regs->compat_sp) == -EFAULT) | ||
568 | goto badframe; | 523 | goto badframe; |
569 | 524 | ||
570 | return regs->regs[0]; | 525 | return regs->regs[0]; |
@@ -705,11 +660,7 @@ int compat_setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info, | |||
705 | __put_user_error(0, &frame->sig.uc.uc_flags, err); | 660 | __put_user_error(0, &frame->sig.uc.uc_flags, err); |
706 | __put_user_error(NULL, &frame->sig.uc.uc_link, err); | 661 | __put_user_error(NULL, &frame->sig.uc.uc_link, err); |
707 | 662 | ||
708 | memset(&stack, 0, sizeof(stack)); | 663 | err |= __compat_save_altstack(&frame->sig.uc.uc_stack, regs->compat_sp); |
709 | stack.ss_sp = (compat_uptr_t)current->sas_ss_sp; | ||
710 | stack.ss_flags = sas_ss_flags(regs->compat_sp); | ||
711 | stack.ss_size = current->sas_ss_size; | ||
712 | err |= __copy_to_user(&frame->sig.uc.uc_stack, &stack, sizeof(stack)); | ||
713 | 664 | ||
714 | err |= compat_setup_sigframe(&frame->sig, regs, set); | 665 | err |= compat_setup_sigframe(&frame->sig, regs, set); |
715 | 666 | ||
diff --git a/arch/arm64/kernel/sys.c b/arch/arm64/kernel/sys.c index 8292a9b090f8..3fa98ff14f0e 100644 --- a/arch/arm64/kernel/sys.c +++ b/arch/arm64/kernel/sys.c | |||
@@ -40,7 +40,6 @@ asmlinkage long sys_mmap(unsigned long addr, unsigned long len, | |||
40 | * Wrappers to pass the pt_regs argument. | 40 | * Wrappers to pass the pt_regs argument. |
41 | */ | 41 | */ |
42 | #define sys_rt_sigreturn sys_rt_sigreturn_wrapper | 42 | #define sys_rt_sigreturn sys_rt_sigreturn_wrapper |
43 | #define sys_sigaltstack sys_sigaltstack_wrapper | ||
44 | 43 | ||
45 | #include <asm/syscalls.h> | 44 | #include <asm/syscalls.h> |
46 | 45 | ||
diff --git a/arch/arm64/kernel/sys32.S b/arch/arm64/kernel/sys32.S index 7ef59e9245ef..6abb05721614 100644 --- a/arch/arm64/kernel/sys32.S +++ b/arch/arm64/kernel/sys32.S | |||
@@ -39,11 +39,6 @@ compat_sys_rt_sigreturn_wrapper: | |||
39 | b compat_sys_rt_sigreturn | 39 | b compat_sys_rt_sigreturn |
40 | ENDPROC(compat_sys_rt_sigreturn_wrapper) | 40 | ENDPROC(compat_sys_rt_sigreturn_wrapper) |
41 | 41 | ||
42 | compat_sys_sigaltstack_wrapper: | ||
43 | ldr x2, [sp, #S_COMPAT_SP] | ||
44 | b compat_do_sigaltstack | ||
45 | ENDPROC(compat_sys_sigaltstack_wrapper) | ||
46 | |||
47 | compat_sys_statfs64_wrapper: | 42 | compat_sys_statfs64_wrapper: |
48 | mov w3, #84 | 43 | mov w3, #84 |
49 | cmp w1, #88 | 44 | cmp w1, #88 |