s390: switch to generic sigaltstack
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
0aa0203fb4
commit
e214125aa8
|
@ -140,6 +140,7 @@ config S390
|
||||||
select HAVE_MOD_ARCH_SPECIFIC
|
select HAVE_MOD_ARCH_SPECIFIC
|
||||||
select MODULES_USE_ELF_RELA
|
select MODULES_USE_ELF_RELA
|
||||||
select CLONE_BACKWARDS2
|
select CLONE_BACKWARDS2
|
||||||
|
select GENERIC_SIGALTSTACK
|
||||||
|
|
||||||
config SCHED_OMIT_FRAME_POINTER
|
config SCHED_OMIT_FRAME_POINTER
|
||||||
def_bool y
|
def_bool y
|
||||||
|
|
|
@ -75,17 +75,11 @@ struct sigaction32 {
|
||||||
compat_sigset_t sa_mask; /* mask last for extensibility */
|
compat_sigset_t sa_mask; /* mask last for extensibility */
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
__u32 ss_sp; /* pointer */
|
|
||||||
int ss_flags;
|
|
||||||
compat_size_t ss_size;
|
|
||||||
} stack_t32;
|
|
||||||
|
|
||||||
/* asm/ucontext.h */
|
/* asm/ucontext.h */
|
||||||
struct ucontext32 {
|
struct ucontext32 {
|
||||||
__u32 uc_flags;
|
__u32 uc_flags;
|
||||||
__u32 uc_link; /* pointer */
|
__u32 uc_link; /* pointer */
|
||||||
stack_t32 uc_stack;
|
compat_stack_t uc_stack;
|
||||||
_sigregs32 uc_mcontext;
|
_sigregs32 uc_mcontext;
|
||||||
compat_sigset_t uc_sigmask; /* mask last for extensibility */
|
compat_sigset_t uc_sigmask; /* mask last for extensibility */
|
||||||
};
|
};
|
||||||
|
@ -153,5 +147,4 @@ long sys32_sigaction(int sig, const struct old_sigaction32 __user *act,
|
||||||
struct old_sigaction32 __user *oact);
|
struct old_sigaction32 __user *oact);
|
||||||
long sys32_rt_sigaction(int sig, const struct sigaction32 __user *act,
|
long sys32_rt_sigaction(int sig, const struct sigaction32 __user *act,
|
||||||
struct sigaction32 __user *oact, size_t sigsetsize);
|
struct sigaction32 __user *oact, size_t sigsetsize);
|
||||||
long sys32_sigaltstack(const stack_t32 __user *uss, stack_t32 __user *uoss);
|
|
||||||
#endif /* _ASM_S390X_S390_H */
|
#endif /* _ASM_S390X_S390_H */
|
||||||
|
|
|
@ -234,45 +234,6 @@ sys32_rt_sigaction(int sig, const struct sigaction32 __user *act,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
asmlinkage long
|
|
||||||
sys32_sigaltstack(const stack_t32 __user *uss, stack_t32 __user *uoss)
|
|
||||||
{
|
|
||||||
struct pt_regs *regs = task_pt_regs(current);
|
|
||||||
stack_t kss, koss;
|
|
||||||
unsigned long ss_sp;
|
|
||||||
int ret, err = 0;
|
|
||||||
mm_segment_t old_fs = get_fs();
|
|
||||||
|
|
||||||
if (uss) {
|
|
||||||
if (!access_ok(VERIFY_READ, uss, sizeof(*uss)))
|
|
||||||
return -EFAULT;
|
|
||||||
err |= __get_user(ss_sp, &uss->ss_sp);
|
|
||||||
err |= __get_user(kss.ss_size, &uss->ss_size);
|
|
||||||
err |= __get_user(kss.ss_flags, &uss->ss_flags);
|
|
||||||
if (err)
|
|
||||||
return -EFAULT;
|
|
||||||
kss.ss_sp = (void __user *) ss_sp;
|
|
||||||
}
|
|
||||||
|
|
||||||
set_fs (KERNEL_DS);
|
|
||||||
ret = do_sigaltstack((stack_t __force __user *) (uss ? &kss : NULL),
|
|
||||||
(stack_t __force __user *) (uoss ? &koss : NULL),
|
|
||||||
regs->gprs[15]);
|
|
||||||
set_fs (old_fs);
|
|
||||||
|
|
||||||
if (!ret && uoss) {
|
|
||||||
if (!access_ok(VERIFY_WRITE, uoss, sizeof(*uoss)))
|
|
||||||
return -EFAULT;
|
|
||||||
ss_sp = (unsigned long) koss.ss_sp;
|
|
||||||
err |= __put_user(ss_sp, &uoss->ss_sp);
|
|
||||||
err |= __put_user(koss.ss_size, &uoss->ss_size);
|
|
||||||
err |= __put_user(koss.ss_flags, &uoss->ss_flags);
|
|
||||||
if (err)
|
|
||||||
return -EFAULT;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int save_sigregs32(struct pt_regs *regs, _sigregs32 __user *sregs)
|
static int save_sigregs32(struct pt_regs *regs, _sigregs32 __user *sregs)
|
||||||
{
|
{
|
||||||
_s390_regs_common32 regs32;
|
_s390_regs_common32 regs32;
|
||||||
|
@ -380,10 +341,6 @@ asmlinkage long sys32_rt_sigreturn(void)
|
||||||
struct pt_regs *regs = task_pt_regs(current);
|
struct pt_regs *regs = task_pt_regs(current);
|
||||||
rt_sigframe32 __user *frame = (rt_sigframe32 __user *)regs->gprs[15];
|
rt_sigframe32 __user *frame = (rt_sigframe32 __user *)regs->gprs[15];
|
||||||
sigset_t set;
|
sigset_t set;
|
||||||
stack_t st;
|
|
||||||
__u32 ss_sp;
|
|
||||||
int err;
|
|
||||||
mm_segment_t old_fs = get_fs();
|
|
||||||
|
|
||||||
if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
|
if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
|
||||||
goto badframe;
|
goto badframe;
|
||||||
|
@ -394,15 +351,8 @@ asmlinkage long sys32_rt_sigreturn(void)
|
||||||
goto badframe;
|
goto badframe;
|
||||||
if (restore_sigregs_gprs_high(regs, frame->gprs_high))
|
if (restore_sigregs_gprs_high(regs, frame->gprs_high))
|
||||||
goto badframe;
|
goto badframe;
|
||||||
err = __get_user(ss_sp, &frame->uc.uc_stack.ss_sp);
|
if (compat_restore_altstack(&frame->uc.uc_stack))
|
||||||
st.ss_sp = compat_ptr(ss_sp);
|
|
||||||
err |= __get_user(st.ss_size, &frame->uc.uc_stack.ss_size);
|
|
||||||
err |= __get_user(st.ss_flags, &frame->uc.uc_stack.ss_flags);
|
|
||||||
if (err)
|
|
||||||
goto badframe;
|
goto badframe;
|
||||||
set_fs (KERNEL_DS);
|
|
||||||
do_sigaltstack((stack_t __force __user *)&st, NULL, regs->gprs[15]);
|
|
||||||
set_fs (old_fs);
|
|
||||||
return regs->gprs[2];
|
return regs->gprs[2];
|
||||||
badframe:
|
badframe:
|
||||||
force_sig(SIGSEGV, current);
|
force_sig(SIGSEGV, current);
|
||||||
|
@ -530,10 +480,7 @@ static int setup_rt_frame32(int sig, struct k_sigaction *ka, siginfo_t *info,
|
||||||
/* Create the ucontext. */
|
/* Create the ucontext. */
|
||||||
err |= __put_user(UC_EXTENDED, &frame->uc.uc_flags);
|
err |= __put_user(UC_EXTENDED, &frame->uc.uc_flags);
|
||||||
err |= __put_user(0, &frame->uc.uc_link);
|
err |= __put_user(0, &frame->uc.uc_link);
|
||||||
err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp);
|
err |= __compat_save_altstack(&frame->uc.uc_stack, regs->gprs[15]);
|
||||||
err |= __put_user(sas_ss_flags(regs->gprs[15]),
|
|
||||||
&frame->uc.uc_stack.ss_flags);
|
|
||||||
err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
|
|
||||||
err |= save_sigregs32(regs, &frame->uc.uc_mcontext);
|
err |= save_sigregs32(regs, &frame->uc.uc_mcontext);
|
||||||
err |= save_sigregs_gprs_high(regs, frame->gprs_high);
|
err |= save_sigregs_gprs_high(regs, frame->gprs_high);
|
||||||
err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
|
err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
|
||||||
|
|
|
@ -760,11 +760,6 @@ ENTRY(sys32_capset_wrapper)
|
||||||
llgtr %r3,%r3 # const cap_user_data_t
|
llgtr %r3,%r3 # const cap_user_data_t
|
||||||
jg sys_capset # branch to system call
|
jg sys_capset # branch to system call
|
||||||
|
|
||||||
ENTRY(sys32_sigaltstack_wrapper)
|
|
||||||
llgtr %r2,%r2 # const stack_emu31_t *
|
|
||||||
llgtr %r3,%r3 # stack_emu31_t *
|
|
||||||
jg sys32_sigaltstack
|
|
||||||
|
|
||||||
ENTRY(sys32_sendfile_wrapper)
|
ENTRY(sys32_sendfile_wrapper)
|
||||||
lgfr %r2,%r2 # int
|
lgfr %r2,%r2 # int
|
||||||
lgfr %r3,%r3 # int
|
lgfr %r3,%r3 # int
|
||||||
|
|
|
@ -76,7 +76,6 @@ long sys_s390_fallocate(int fd, int mode, loff_t offset, u32 len_high,
|
||||||
long sys_sigsuspend(int history0, int history1, old_sigset_t mask);
|
long sys_sigsuspend(int history0, int history1, old_sigset_t mask);
|
||||||
long sys_sigaction(int sig, const struct old_sigaction __user *act,
|
long sys_sigaction(int sig, const struct old_sigaction __user *act,
|
||||||
struct old_sigaction __user *oact);
|
struct old_sigaction __user *oact);
|
||||||
long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss);
|
|
||||||
long sys_sigreturn(void);
|
long sys_sigreturn(void);
|
||||||
long sys_rt_sigreturn(void);
|
long sys_rt_sigreturn(void);
|
||||||
long sys32_sigreturn(void);
|
long sys32_sigreturn(void);
|
||||||
|
|
|
@ -89,13 +89,6 @@ SYSCALL_DEFINE3(sigaction, int, sig, const struct old_sigaction __user *, act,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
SYSCALL_DEFINE2(sigaltstack, const stack_t __user *, uss,
|
|
||||||
stack_t __user *, uoss)
|
|
||||||
{
|
|
||||||
struct pt_regs *regs = task_pt_regs(current);
|
|
||||||
return do_sigaltstack(uss, uoss, regs->gprs[15]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Returns non-zero on fault. */
|
/* Returns non-zero on fault. */
|
||||||
static int save_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
|
static int save_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
|
||||||
{
|
{
|
||||||
|
@ -190,8 +183,7 @@ SYSCALL_DEFINE0(rt_sigreturn)
|
||||||
set_current_blocked(&set);
|
set_current_blocked(&set);
|
||||||
if (restore_sigregs(regs, &frame->uc.uc_mcontext))
|
if (restore_sigregs(regs, &frame->uc.uc_mcontext))
|
||||||
goto badframe;
|
goto badframe;
|
||||||
if (do_sigaltstack(&frame->uc.uc_stack, NULL,
|
if (restore_altstack(&frame->uc.uc_stack))
|
||||||
regs->gprs[15]) == -EFAULT)
|
|
||||||
goto badframe;
|
goto badframe;
|
||||||
return regs->gprs[2];
|
return regs->gprs[2];
|
||||||
badframe:
|
badframe:
|
||||||
|
@ -325,10 +317,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
|
||||||
/* Create the ucontext. */
|
/* Create the ucontext. */
|
||||||
err |= __put_user(0, &frame->uc.uc_flags);
|
err |= __put_user(0, &frame->uc.uc_flags);
|
||||||
err |= __put_user(NULL, &frame->uc.uc_link);
|
err |= __put_user(NULL, &frame->uc.uc_link);
|
||||||
err |= __put_user((void __user *)current->sas_ss_sp, &frame->uc.uc_stack.ss_sp);
|
err |= __save_altstack(&frame->uc.uc_stack, regs->gprs[15]);
|
||||||
err |= __put_user(sas_ss_flags(regs->gprs[15]),
|
|
||||||
&frame->uc.uc_stack.ss_flags);
|
|
||||||
err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
|
|
||||||
err |= save_sigregs(regs, &frame->uc.uc_mcontext);
|
err |= save_sigregs(regs, &frame->uc.uc_mcontext);
|
||||||
err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
|
err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
|
||||||
if (err)
|
if (err)
|
||||||
|
|
|
@ -194,7 +194,7 @@ SYSCALL(sys_chown16,sys_ni_syscall,sys32_chown16_wrapper) /* old chown16 syscall
|
||||||
SYSCALL(sys_getcwd,sys_getcwd,sys32_getcwd_wrapper)
|
SYSCALL(sys_getcwd,sys_getcwd,sys32_getcwd_wrapper)
|
||||||
SYSCALL(sys_capget,sys_capget,sys32_capget_wrapper)
|
SYSCALL(sys_capget,sys_capget,sys32_capget_wrapper)
|
||||||
SYSCALL(sys_capset,sys_capset,sys32_capset_wrapper) /* 185 */
|
SYSCALL(sys_capset,sys_capset,sys32_capset_wrapper) /* 185 */
|
||||||
SYSCALL(sys_sigaltstack,sys_sigaltstack,sys32_sigaltstack_wrapper)
|
SYSCALL(sys_sigaltstack,sys_sigaltstack,compat_sys_sigaltstack)
|
||||||
SYSCALL(sys_sendfile,sys_sendfile64,sys32_sendfile_wrapper)
|
SYSCALL(sys_sendfile,sys_sendfile64,sys32_sendfile_wrapper)
|
||||||
NI_SYSCALL /* streams1 */
|
NI_SYSCALL /* streams1 */
|
||||||
NI_SYSCALL /* streams2 */
|
NI_SYSCALL /* streams2 */
|
||||||
|
|
Loading…
Reference in New Issue