signal: Remove task parameter from force_sigsegv

The function force_sigsegv is always called on the current task
so passing in current is redundant and not passing in current
makes this fact obvious.

This also makes it clear force_sigsegv always calls force_sig
on the current task.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
This commit is contained in:
Eric W. Biederman 2019-05-21 10:03:48 -05:00
parent 72abe3bcf0
commit cb44c9a0ab
12 changed files with 18 additions and 16 deletions

View File

@ -313,7 +313,7 @@ int elf_check_arch(const struct elf32_hdr *x)
eflags = x->e_flags; eflags = x->e_flags;
if ((eflags & EF_ARC_OSABI_MSK) != EF_ARC_OSABI_CURRENT) { if ((eflags & EF_ARC_OSABI_MSK) != EF_ARC_OSABI_CURRENT) {
pr_err("ABI mismatch - you need newer toolchain\n"); pr_err("ABI mismatch - you need newer toolchain\n");
force_sigsegv(SIGSEGV, current); force_sigsegv(SIGSEGV);
return 0; return 0;
} }

View File

@ -257,7 +257,7 @@ setup_frame(struct ksignal *ksig, sigset_t *set, struct sigscratch *scr)
*/ */
check_sp = (new_sp - sizeof(*frame)) & -STACK_ALIGN; check_sp = (new_sp - sizeof(*frame)) & -STACK_ALIGN;
if (!likely(on_sig_stack(check_sp))) { if (!likely(on_sig_stack(check_sp))) {
force_sigsegv(ksig->sig, current); force_sigsegv(ksig->sig);
return 1; return 1;
} }
} }
@ -265,7 +265,7 @@ setup_frame(struct ksignal *ksig, sigset_t *set, struct sigscratch *scr)
frame = (void __user *) ((new_sp - sizeof(*frame)) & -STACK_ALIGN); frame = (void __user *) ((new_sp - sizeof(*frame)) & -STACK_ALIGN);
if (!access_ok(frame, sizeof(*frame))) { if (!access_ok(frame, sizeof(*frame))) {
force_sigsegv(ksig->sig, current); force_sigsegv(ksig->sig);
return 1; return 1;
} }
@ -282,7 +282,7 @@ setup_frame(struct ksignal *ksig, sigset_t *set, struct sigscratch *scr)
err |= setup_sigcontext(&frame->sc, set, scr); err |= setup_sigcontext(&frame->sc, set, scr);
if (unlikely(err)) { if (unlikely(err)) {
force_sigsegv(ksig->sig, current); force_sigsegv(ksig->sig);
return 1; return 1;
} }

View File

@ -211,7 +211,7 @@ static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
return 0; return 0;
give_sigsegv: give_sigsegv:
force_sigsegv(ksig->sig, current); force_sigsegv(ksig->sig);
return -EFAULT; return -EFAULT;
} }

View File

@ -375,7 +375,7 @@ static int setup_frame32(struct ksignal *ksig, struct pt_regs *regs,
pr_info("%s[%d] bad frame in setup_frame32: %08lx TPC %08lx O7 %08lx\n", pr_info("%s[%d] bad frame in setup_frame32: %08lx TPC %08lx O7 %08lx\n",
current->comm, current->pid, (unsigned long)sf, current->comm, current->pid, (unsigned long)sf,
regs->tpc, regs->u_regs[UREG_I7]); regs->tpc, regs->u_regs[UREG_I7]);
force_sigsegv(ksig->sig, current); force_sigsegv(ksig->sig);
return -EINVAL; return -EINVAL;
} }
@ -509,7 +509,7 @@ static int setup_rt_frame32(struct ksignal *ksig, struct pt_regs *regs,
pr_info("%s[%d] bad frame in setup_rt_frame32: %08lx TPC %08lx O7 %08lx\n", pr_info("%s[%d] bad frame in setup_rt_frame32: %08lx TPC %08lx O7 %08lx\n",
current->comm, current->pid, (unsigned long)sf, current->comm, current->pid, (unsigned long)sf,
regs->tpc, regs->u_regs[UREG_I7]); regs->tpc, regs->u_regs[UREG_I7]);
force_sigsegv(ksig->sig, current); force_sigsegv(ksig->sig);
return -EINVAL; return -EINVAL;
} }

View File

@ -374,7 +374,7 @@ setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs)
pr_info("%s[%d] bad frame in setup_rt_frame: %016lx TPC %016lx O7 %016lx\n", pr_info("%s[%d] bad frame in setup_rt_frame: %016lx TPC %016lx O7 %016lx\n",
current->comm, current->pid, (unsigned long)sf, current->comm, current->pid, (unsigned long)sf,
regs->tpc, regs->u_regs[UREG_I7]); regs->tpc, regs->u_regs[UREG_I7]);
force_sigsegv(ksig->sig, current); force_sigsegv(ksig->sig);
return -EINVAL; return -EINVAL;
} }

View File

@ -119,7 +119,7 @@ void uml_setup_stubs(struct mm_struct *mm)
return; return;
out: out:
force_sigsegv(SIGSEGV, current); force_sigsegv(SIGSEGV);
} }
void arch_exit_mmap(struct mm_struct *mm) void arch_exit_mmap(struct mm_struct *mm)

View File

@ -169,7 +169,7 @@ static void bad_segv(struct faultinfo fi, unsigned long ip)
void fatal_sigsegv(void) void fatal_sigsegv(void)
{ {
force_sigsegv(SIGSEGV, current); force_sigsegv(SIGSEGV);
do_signal(&current->thread.regs); do_signal(&current->thread.regs);
/* /*
* This is to tell gcc that we're not returning - do_signal * This is to tell gcc that we're not returning - do_signal

View File

@ -386,7 +386,7 @@ static void do_signal(struct pt_regs *regs, int syscall)
regs->UCreg_pc = KERN_RESTART_CODE; regs->UCreg_pc = KERN_RESTART_CODE;
} else { } else {
regs->UCreg_sp += 4; regs->UCreg_sp += 4;
force_sigsegv(0, current); force_sigsegv(0);
} }
} }
if (regs->UCreg_00 == -ERESTARTNOHAND || if (regs->UCreg_00 == -ERESTARTNOHAND ||

View File

@ -1662,7 +1662,7 @@ int search_binary_handler(struct linux_binprm *bprm)
if (retval < 0 && !bprm->mm) { if (retval < 0 && !bprm->mm) {
/* we got to flush_old_exec() and failed after it */ /* we got to flush_old_exec() and failed after it */
read_unlock(&binfmt_lock); read_unlock(&binfmt_lock);
force_sigsegv(SIGSEGV, current); force_sigsegv(SIGSEGV);
return retval; return retval;
} }
if (retval != -ENOEXEC || !bprm->file) { if (retval != -ENOEXEC || !bprm->file) {

View File

@ -325,7 +325,7 @@ int force_sig_pkuerr(void __user *addr, u32 pkey);
int force_sig_ptrace_errno_trap(int errno, void __user *addr); int force_sig_ptrace_errno_trap(int errno, void __user *addr);
extern int send_sig_info(int, struct kernel_siginfo *, struct task_struct *); extern int send_sig_info(int, struct kernel_siginfo *, struct task_struct *);
extern void force_sigsegv(int sig, struct task_struct *p); extern void force_sigsegv(int sig);
extern int force_sig_info(int, struct kernel_siginfo *, struct task_struct *); extern int force_sig_info(int, struct kernel_siginfo *, struct task_struct *);
extern int __kill_pgrp_info(int sig, struct kernel_siginfo *info, struct pid *pgrp); extern int __kill_pgrp_info(int sig, struct kernel_siginfo *info, struct pid *pgrp);
extern int kill_pid_info(int sig, struct kernel_siginfo *info, struct pid *pid); extern int kill_pid_info(int sig, struct kernel_siginfo *info, struct pid *pid);

View File

@ -277,7 +277,7 @@ void __rseq_handle_notify_resume(struct ksignal *ksig, struct pt_regs *regs)
error: error:
sig = ksig ? ksig->sig : 0; sig = ksig ? ksig->sig : 0;
force_sigsegv(sig, t); force_sigsegv(sig);
} }
#ifdef CONFIG_DEBUG_RSEQ #ifdef CONFIG_DEBUG_RSEQ

View File

@ -1607,8 +1607,10 @@ EXPORT_SYMBOL(force_sig);
* the problem was already a SIGSEGV, we'll want to * the problem was already a SIGSEGV, we'll want to
* make sure we don't even try to deliver the signal.. * make sure we don't even try to deliver the signal..
*/ */
void force_sigsegv(int sig, struct task_struct *p) void force_sigsegv(int sig)
{ {
struct task_struct *p = current;
if (sig == SIGSEGV) { if (sig == SIGSEGV) {
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&p->sighand->siglock, flags); spin_lock_irqsave(&p->sighand->siglock, flags);
@ -2717,7 +2719,7 @@ static void signal_delivered(struct ksignal *ksig, int stepping)
void signal_setup_done(int failed, struct ksignal *ksig, int stepping) void signal_setup_done(int failed, struct ksignal *ksig, int stepping)
{ {
if (failed) if (failed)
force_sigsegv(ksig->sig, current); force_sigsegv(ksig->sig);
else else
signal_delivered(ksig, stepping); signal_delivered(ksig, stepping);
} }