parisc: switch to generic sigaltstack

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2012-12-23 03:22:04 -05:00
parent 0aa0203fb4
commit 6e26aab98c
6 changed files with 6 additions and 97 deletions

View File

@ -23,6 +23,7 @@ config PARISC
select HAVE_MOD_ARCH_SPECIFIC
select MODULES_USE_ELF_RELA
select CLONE_BACKWARDS
select GENERIC_SIGALTSTACK
help
The PA-RISC microprocessor is designed by Hewlett-Packard and used

View File

@ -1748,44 +1748,6 @@ ENTRY(sys_rt_sigreturn_wrapper)
LDREG PT_GR28(%r1),%r28 /* reload original r28 for syscall_exit */
ENDPROC(sys_rt_sigreturn_wrapper)
ENTRY(sys_sigaltstack_wrapper)
/* Get the user stack pointer */
LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1
ldo TASK_REGS(%r1),%r24 /* get pt regs */
LDREG TASK_PT_GR30(%r24),%r24
STREG %r2, -RP_OFFSET(%r30)
#ifdef CONFIG_64BIT
ldo FRAME_SIZE(%r30), %r30
BL do_sigaltstack,%r2
ldo -16(%r30),%r29 /* Reference param save area */
#else
BL do_sigaltstack,%r2
ldo FRAME_SIZE(%r30), %r30
#endif
ldo -FRAME_SIZE(%r30), %r30
LDREG -RP_OFFSET(%r30), %r2
bv %r0(%r2)
nop
ENDPROC(sys_sigaltstack_wrapper)
#ifdef CONFIG_64BIT
ENTRY(sys32_sigaltstack_wrapper)
/* Get the user stack pointer */
LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r24
LDREG TASK_PT_GR30(%r24),%r24
STREG %r2, -RP_OFFSET(%r30)
ldo FRAME_SIZE(%r30), %r30
BL do_sigaltstack32,%r2
ldo -16(%r30),%r29 /* Reference param save area */
ldo -FRAME_SIZE(%r30), %r30
LDREG -RP_OFFSET(%r30), %r2
bv %r0(%r2)
nop
ENDPROC(sys32_sigaltstack_wrapper)
#endif
ENTRY(syscall_exit)
/* NOTE: HP-UX syscalls also come through here
* after hpux_syscall_exit fixes up return

View File

@ -143,7 +143,7 @@ sys_rt_sigreturn(struct pt_regs *regs, int in_syscall)
goto give_sigsegv;
DBG(1,"sys_rt_sigreturn: usp %#08lx stack 0x%p\n",
usp, &compat_frame->uc.uc_stack);
if (do_sigaltstack32(&compat_frame->uc.uc_stack, NULL, usp) == -EFAULT)
if (compat_restore_altstack(&compat_frame->uc.uc_stack))
goto give_sigsegv;
} else
#endif
@ -154,7 +154,7 @@ sys_rt_sigreturn(struct pt_regs *regs, int in_syscall)
goto give_sigsegv;
DBG(1,"sys_rt_sigreturn: usp %#08lx stack 0x%p\n",
usp, &frame->uc.uc_stack);
if (do_sigaltstack(&frame->uc.uc_stack, NULL, usp) == -EFAULT)
if (restore_altstack(&frame->uc.uc_stack))
goto give_sigsegv;
}
@ -260,15 +260,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
if (is_compat_task()) {
DBG(1,"setup_rt_frame: frame->info = 0x%p\n", &compat_frame->info);
err |= copy_siginfo_to_user32(&compat_frame->info, info);
DBG(1,"SETUP_RT_FRAME: 1\n");
compat_val = (compat_int_t)current->sas_ss_sp;
err |= __put_user(compat_val, &compat_frame->uc.uc_stack.ss_sp);
DBG(1,"SETUP_RT_FRAME: 2\n");
compat_val = (compat_int_t)current->sas_ss_size;
err |= __put_user(compat_val, &compat_frame->uc.uc_stack.ss_size);
DBG(1,"SETUP_RT_FRAME: 3\n");
compat_val = sas_ss_flags(regs->gr[30]);
err |= __put_user(compat_val, &compat_frame->uc.uc_stack.ss_flags);
err |= __compat_save_altstack( &compat_frame->uc.uc_stack, regs->gr[30]);
DBG(1,"setup_rt_frame: frame->uc = 0x%p\n", &compat_frame->uc);
DBG(1,"setup_rt_frame: frame->uc.uc_mcontext = 0x%p\n", &compat_frame->uc.uc_mcontext);
err |= setup_sigcontext32(&compat_frame->uc.uc_mcontext,
@ -280,10 +272,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
{
DBG(1,"setup_rt_frame: frame->info = 0x%p\n", &frame->info);
err |= copy_siginfo_to_user(&frame->info, info);
err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp);
err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
err |= __put_user(sas_ss_flags(regs->gr[30]),
&frame->uc.uc_stack.ss_flags);
err |= __save_altstack(&frame->uc.uc_stack, regs->gr[30]);
DBG(1,"setup_rt_frame: frame->uc = 0x%p\n", &frame->uc);
DBG(1,"setup_rt_frame: frame->uc.uc_mcontext = 0x%p\n", &frame->uc.uc_mcontext);
err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, in_syscall);

View File

@ -148,41 +148,6 @@ sys32_rt_sigaction(int sig, const struct sigaction32 __user *act, struct sigacti
return ret;
}
int
do_sigaltstack32 (const compat_stack_t __user *uss32, compat_stack_t __user *uoss32, unsigned long sp)
{
compat_stack_t ss32, oss32;
stack_t ss, oss;
stack_t *ssp = NULL, *ossp = NULL;
int ret;
if (uss32) {
if (copy_from_user(&ss32, uss32, sizeof ss32))
return -EFAULT;
ss.ss_sp = (void __user *)(unsigned long)ss32.ss_sp;
ss.ss_flags = ss32.ss_flags;
ss.ss_size = ss32.ss_size;
ssp = &ss;
}
if (uoss32)
ossp = &oss;
KERNEL_SYSCALL(ret, do_sigaltstack, (const stack_t __user *)ssp, (stack_t __user *)ossp, sp);
if (!ret && uoss32) {
oss32.ss_sp = (unsigned int)(unsigned long)oss.ss_sp;
oss32.ss_flags = oss.ss_flags;
oss32.ss_size = oss.ss_size;
if (copy_to_user(uoss32, &oss32, sizeof *uoss32))
return -EFAULT;
}
return ret;
}
long
restore_sigcontext32(struct compat_sigcontext __user *sc, struct compat_regfile __user * rf,
struct pt_regs *regs)

View File

@ -23,12 +23,6 @@
typedef compat_uptr_t compat_sighandler_t;
typedef struct compat_sigaltstack {
compat_uptr_t ss_sp;
compat_int_t ss_flags;
compat_size_t ss_size;
} compat_stack_t;
/* Most things should be clean enough to redefine this at will, if care
is taken to make libc match. */
@ -102,8 +96,6 @@ struct compat_rt_sigframe {
void sigset_32to64(sigset_t *s64, compat_sigset_t *s32);
void sigset_64to32(compat_sigset_t *s32, sigset_t *s64);
int do_sigaltstack32 (const compat_stack_t __user *uss32,
compat_stack_t __user *uoss32, unsigned long sp);
long restore_sigcontext32(struct compat_sigcontext __user *sc,
struct compat_regfile __user *rf,
struct pt_regs *regs);

View File

@ -255,7 +255,7 @@
ENTRY_SAME(mremap)
ENTRY_SAME(setresuid)
ENTRY_SAME(getresuid) /* 165 */
ENTRY_DIFF(sigaltstack_wrapper)
ENTRY_COMP(sigaltstack)
ENTRY_SAME(ni_syscall) /* query_module */
ENTRY_SAME(poll)
/* structs contain pointers and an in_addr... */