Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ea536ad4 authored by Al Viro's avatar Al Viro
Browse files

mips: switch to generic sigaltstack



Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent c6489c14
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ config MIPS
	select HAVE_MOD_ARCH_SPECIFIC
	select MODULES_USE_ELF_REL if MODULES
	select MODULES_USE_ELF_RELA if MODULES && 64BIT
	select GENERIC_SIGALTSTACK

menu "Machine selection"

+8 −0
Original line number Diff line number Diff line
@@ -288,6 +288,14 @@ struct compat_shmid64_ds {
	compat_ulong_t	__unused2;
};

/* MIPS has unusual order of fields in stack_t */
typedef struct compat_sigaltstack {
	compat_uptr_t			ss_sp;
	compat_size_t			ss_size;
	int				ss_flags;
} compat_stack_t;
#define compat_sigaltstack compat_sigaltstack

static inline int is_compat_task(void)
{
	return test_thread_flag(TIF_32BIT_ADDR);
+1 −1
Original line number Diff line number Diff line
@@ -233,7 +233,7 @@ EXPORT(sysn32_call_table)
	PTR	compat_sys_rt_sigtimedwait
	PTR	sys_32_rt_sigqueueinfo
	PTR	sysn32_rt_sigsuspend
	PTR	sys32_sigaltstack
	PTR	compat_sys_sigaltstack
	PTR	compat_sys_utime		/* 6130 */
	PTR	sys_mknod
	PTR	sys_32_personality
+1 −1
Original line number Diff line number Diff line
@@ -398,7 +398,7 @@ sys_call_table:
	PTR	sys_getcwd
	PTR	sys_capget
	PTR	sys_capset			/* 4205 */
	PTR	sys32_sigaltstack
	PTR	compat_sys_sigaltstack
	PTR	sys_32_sendfile
	PTR	sys_ni_syscall
	PTR	sys_ni_syscall
+3 −18
Original line number Diff line number Diff line
@@ -313,15 +313,6 @@ SYSCALL_DEFINE3(sigaction, int, sig, const struct sigaction __user *, act,
}
#endif

asmlinkage int sys_sigaltstack(nabi_no_regargs struct pt_regs regs)
{
	const stack_t __user *uss = (const stack_t __user *) regs.regs[4];
	stack_t __user *uoss = (stack_t __user *) regs.regs[5];
	unsigned long usp = regs.regs[29];

	return do_sigaltstack(uss, uoss, usp);
}

#ifdef CONFIG_TRAD_SIGNALS
asmlinkage void sys_sigreturn(nabi_no_regargs struct pt_regs regs)
{
@@ -378,9 +369,8 @@ asmlinkage void sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
	else if (sig)
		force_sig(sig, current);

	/* It is more difficult to avoid calling this function than to
	   call it and ignore errors.  */
	do_sigaltstack(&frame->rs_uc.uc_stack, NULL, regs.regs[29]);
	if (restore_altstack(&frame->rs_uc.uc_stack))
		goto badframe;

	/*
	 * Don't let your children do this ...
@@ -457,12 +447,7 @@ static int setup_rt_frame(void *sig_return, struct k_sigaction *ka,
	/* Create the ucontext.  */
	err |= __put_user(0, &frame->rs_uc.uc_flags);
	err |= __put_user(NULL, &frame->rs_uc.uc_link);
	err |= __put_user((void __user *)current->sas_ss_sp,
	                  &frame->rs_uc.uc_stack.ss_sp);
	err |= __put_user(sas_ss_flags(regs->regs[29]),
	                  &frame->rs_uc.uc_stack.ss_flags);
	err |= __put_user(current->sas_ss_size,
	                  &frame->rs_uc.uc_stack.ss_size);
	err |= __save_altstack(&frame->rs_uc.uc_stack, regs->regs[29]);
	err |= setup_sigcontext(regs, &frame->rs_uc.uc_mcontext);
	err |= __copy_to_user(&frame->rs_uc.uc_sigmask, set, sizeof(*set));

Loading