Skip to content

Commit

Permalink
signal: Remove task parameter from force_sig
Browse files Browse the repository at this point in the history
All of the remaining callers pass current into force_sig so
remove the task parameter to make this obvious and to make
misuse more difficult in the future.

This also makes it clear force_sig passes current into force_sig_info.

Signed-off-by: "Eric W. Biederman" <[email protected]>
  • Loading branch information
ebiederm committed May 27, 2019
1 parent cb44c9a commit 3cf5d07
Show file tree
Hide file tree
Showing 76 changed files with 160 additions and 166 deletions.
4 changes: 2 additions & 2 deletions arch/alpha/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ do_sigreturn(struct sigcontext __user *sc)
return;

give_sigsegv:
force_sig(SIGSEGV, current);
force_sig(SIGSEGV);
}

asmlinkage void
Expand Down Expand Up @@ -253,7 +253,7 @@ do_rt_sigreturn(struct rt_sigframe __user *frame)
return;

give_sigsegv:
force_sig(SIGSEGV, current);
force_sig(SIGSEGV);
}


Expand Down
2 changes: 1 addition & 1 deletion arch/arc/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ SYSCALL_DEFINE3(arc_usr_cmpxchg, int *, uaddr, int, expected, int, new)
goto again;

fail:
force_sig(SIGSEGV, current);
force_sig(SIGSEGV);
return ret;
}

Expand Down
2 changes: 1 addition & 1 deletion arch/arc/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ SYSCALL_DEFINE0(rt_sigreturn)
return regs->r0;

badframe:
force_sig(SIGSEGV, current);
force_sig(SIGSEGV);
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions arch/arm/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ asmlinkage int sys_sigreturn(struct pt_regs *regs)
return regs->ARM_r0;

badframe:
force_sig(SIGSEGV, current);
force_sig(SIGSEGV);
return 0;
}

Expand Down Expand Up @@ -283,7 +283,7 @@ asmlinkage int sys_rt_sigreturn(struct pt_regs *regs)
return regs->ARM_r0;

badframe:
force_sig(SIGSEGV, current);
force_sig(SIGSEGV);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ void arm64_force_sig_fault(int signo, int code, void __user *addr,
{
arm64_show_signal(signo, str);
if (signo == SIGKILL)
force_sig(SIGKILL, current);
force_sig(SIGKILL);
else
force_sig_fault(signo, code, addr, current);
}
Expand Down
2 changes: 1 addition & 1 deletion arch/c6x/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ asmlinkage int do_rt_sigreturn(struct pt_regs *regs)
return regs->a4;

badframe:
force_sig(SIGSEGV, current);
force_sig(SIGSEGV);
return 0;
}

Expand Down
4 changes: 1 addition & 3 deletions arch/csky/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ SYSCALL_DEFINE0(rt_sigreturn)
{
struct pt_regs *regs = current_pt_regs();
struct rt_sigframe __user *frame;
struct task_struct *task;
sigset_t set;

/* Always make any pending restarted system calls return -EINTR */
Expand All @@ -86,8 +85,7 @@ SYSCALL_DEFINE0(rt_sigreturn)
return regs->a0;

badframe:
task = current;
force_sig(SIGSEGV, task);
force_sig(SIGSEGV);
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions arch/h8300/kernel/ptrace_h.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ asmlinkage void trace_trap(unsigned long bp)
{
if ((unsigned long)current->thread.breakinfo.addr == bp) {
user_disable_single_step(current);
force_sig(SIGTRAP, current);
force_sig(SIGTRAP);
} else
force_sig(SIGILL, current);
force_sig(SIGILL);
}
2 changes: 1 addition & 1 deletion arch/h8300/kernel/ptrace_s.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ void user_enable_single_step(struct task_struct *child)
asmlinkage void trace_trap(unsigned long bp)
{
(void)bp;
force_sig(SIGTRAP, current);
force_sig(SIGTRAP);
}
2 changes: 1 addition & 1 deletion arch/h8300/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ asmlinkage int sys_rt_sigreturn(void)
return er0;

badframe:
force_sig(SIGSEGV, current);
force_sig(SIGSEGV);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion arch/hexagon/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,6 @@ asmlinkage int sys_rt_sigreturn(void)
return regs->r00;

badframe:
force_sig(SIGSEGV, current);
force_sig(SIGSEGV);
return 0;
}
10 changes: 5 additions & 5 deletions arch/hexagon/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ int die_if_kernel(char *str, struct pt_regs *regs, long err)
static void misaligned_instruction(struct pt_regs *regs)
{
die_if_kernel("Misaligned Instruction", regs, 0);
force_sig(SIGBUS, current);
force_sig(SIGBUS);
}

/*
Expand All @@ -263,19 +263,19 @@ static void misaligned_instruction(struct pt_regs *regs)
static void misaligned_data_load(struct pt_regs *regs)
{
die_if_kernel("Misaligned Data Load", regs, 0);
force_sig(SIGBUS, current);
force_sig(SIGBUS);
}

static void misaligned_data_store(struct pt_regs *regs)
{
die_if_kernel("Misaligned Data Store", regs, 0);
force_sig(SIGBUS, current);
force_sig(SIGBUS);
}

static void illegal_instruction(struct pt_regs *regs)
{
die_if_kernel("Illegal Instruction", regs, 0);
force_sig(SIGILL, current);
force_sig(SIGILL);
}

/*
Expand All @@ -285,7 +285,7 @@ static void illegal_instruction(struct pt_regs *regs)
static void precise_bus_error(struct pt_regs *regs)
{
die_if_kernel("Precise Bus Error", regs, 0);
force_sig(SIGBUS, current);
force_sig(SIGBUS);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion arch/ia64/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ ia64_rt_sigreturn (struct sigscratch *scr)
return retval;

give_sigsegv:
force_sig(SIGSEGV, current);
force_sig(SIGSEGV);
return retval;
}

Expand Down
6 changes: 3 additions & 3 deletions arch/ia64/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -589,14 +589,14 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
printk(KERN_ERR "Unexpected IA-32 exception (Trap 45)\n");
printk(KERN_ERR " iip - 0x%lx, ifa - 0x%lx, isr - 0x%lx\n",
iip, ifa, isr);
force_sig(SIGSEGV, current);
force_sig(SIGSEGV);
return;

case 46:
printk(KERN_ERR "Unexpected IA-32 intercept trap (Trap 46)\n");
printk(KERN_ERR " iip - 0x%lx, ifa - 0x%lx, isr - 0x%lx, iim - 0x%lx\n",
iip, ifa, isr, iim);
force_sig(SIGSEGV, current);
force_sig(SIGSEGV);
return;

case 47:
Expand All @@ -608,5 +608,5 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
break;
}
if (!die_if_kernel(buf, &regs, error))
force_sig(SIGILL, current);
force_sig(SIGILL);
}
4 changes: 2 additions & 2 deletions arch/m68k/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ asmlinkage int do_sigreturn(struct pt_regs *regs, struct switch_stack *sw)
return regs->d0;

badframe:
force_sig(SIGSEGV, current);
force_sig(SIGSEGV);
return 0;
}

Expand All @@ -825,7 +825,7 @@ asmlinkage int do_rt_sigreturn(struct pt_regs *regs, struct switch_stack *sw)
return regs->d0;

badframe:
force_sig(SIGSEGV, current);
force_sig(SIGSEGV);
return 0;
}

Expand Down
16 changes: 8 additions & 8 deletions arch/m68k/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ static inline void bus_error030 (struct frame *fp)
pr_err("BAD KERNEL BUSERR\n");

die_if_kernel("Oops", &fp->ptregs,0);
force_sig(SIGKILL, current);
force_sig(SIGKILL);
return;
}
} else {
Expand Down Expand Up @@ -463,7 +463,7 @@ static inline void bus_error030 (struct frame *fp)
!(ssw & RW) ? "write" : "read", addr,
fp->ptregs.pc);
die_if_kernel ("Oops", &fp->ptregs, buserr_type);
force_sig (SIGBUS, current);
force_sig (SIGBUS);
return;
}

Expand Down Expand Up @@ -493,7 +493,7 @@ static inline void bus_error030 (struct frame *fp)
do_page_fault (&fp->ptregs, addr, 0);
} else {
pr_debug("protection fault on insn access (segv).\n");
force_sig (SIGSEGV, current);
force_sig (SIGSEGV);
}
}
#else
Expand Down Expand Up @@ -571,7 +571,7 @@ static inline void bus_error030 (struct frame *fp)
!(ssw & RW) ? "write" : "read", addr,
fp->ptregs.pc);
die_if_kernel("Oops",&fp->ptregs,mmusr);
force_sig(SIGSEGV, current);
force_sig(SIGSEGV);
return;
} else {
#if 0
Expand All @@ -598,7 +598,7 @@ static inline void bus_error030 (struct frame *fp)
#endif
pr_debug("Unknown SIGSEGV - 1\n");
die_if_kernel("Oops",&fp->ptregs,mmusr);
force_sig(SIGSEGV, current);
force_sig(SIGSEGV);
return;
}

Expand All @@ -621,7 +621,7 @@ static inline void bus_error030 (struct frame *fp)
buserr:
pr_err("BAD KERNEL BUSERR\n");
die_if_kernel("Oops",&fp->ptregs,0);
force_sig(SIGKILL, current);
force_sig(SIGKILL);
return;
}

Expand Down Expand Up @@ -660,7 +660,7 @@ static inline void bus_error030 (struct frame *fp)
addr, fp->ptregs.pc);
pr_debug("Unknown SIGSEGV - 2\n");
die_if_kernel("Oops",&fp->ptregs,mmusr);
force_sig(SIGSEGV, current);
force_sig(SIGSEGV);
return;
}

Expand Down Expand Up @@ -804,7 +804,7 @@ asmlinkage void buserr_c(struct frame *fp)
default:
die_if_kernel("bad frame format",&fp->ptregs,0);
pr_debug("Unknown SIGSEGV - 4\n");
force_sig(SIGSEGV, current);
force_sig(SIGSEGV);
}
}

Expand Down
2 changes: 1 addition & 1 deletion arch/microblaze/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
return rval;

badframe:
force_sig(SIGSEGV, current);
force_sig(SIGSEGV);
return 0;
}

Expand Down
18 changes: 9 additions & 9 deletions arch/mips/kernel/branch.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ int __isa_exception_epc(struct pt_regs *regs)
/* Calculate exception PC in branch delay slot. */
if (__get_user(inst, (u16 __user *) msk_isa16_mode(epc))) {
/* This should never happen because delay slot was checked. */
force_sig(SIGSEGV, current);
force_sig(SIGSEGV);
return epc;
}
if (cpu_has_mips16) {
Expand Down Expand Up @@ -305,7 +305,7 @@ int __microMIPS_compute_return_epc(struct pt_regs *regs)
return 0;

sigsegv:
force_sig(SIGSEGV, current);
force_sig(SIGSEGV);
return -EFAULT;
}

Expand All @@ -328,7 +328,7 @@ int __MIPS16e_compute_return_epc(struct pt_regs *regs)
/* Read the instruction. */
addr = (u16 __user *)msk_isa16_mode(epc);
if (__get_user(inst.full, addr)) {
force_sig(SIGSEGV, current);
force_sig(SIGSEGV);
return -EFAULT;
}

Expand All @@ -343,7 +343,7 @@ int __MIPS16e_compute_return_epc(struct pt_regs *regs)
case MIPS16e_jal_op:
addr += 1;
if (__get_user(inst2, addr)) {
force_sig(SIGSEGV, current);
force_sig(SIGSEGV);
return -EFAULT;
}
fullinst = ((unsigned)inst.full << 16) | inst2;
Expand Down Expand Up @@ -829,17 +829,17 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
sigill_dsp:
pr_debug("%s: DSP branch but not DSP ASE - sending SIGILL.\n",
current->comm);
force_sig(SIGILL, current);
force_sig(SIGILL);
return -EFAULT;
sigill_r2r6:
pr_debug("%s: R2 branch but r2-to-r6 emulator is not present - sending SIGILL.\n",
current->comm);
force_sig(SIGILL, current);
force_sig(SIGILL);
return -EFAULT;
sigill_r6:
pr_debug("%s: R6 branch but no MIPSr6 ISA support - sending SIGILL.\n",
current->comm);
force_sig(SIGILL, current);
force_sig(SIGILL);
return -EFAULT;
}
EXPORT_SYMBOL_GPL(__compute_return_epc_for_insn);
Expand All @@ -859,15 +859,15 @@ int __compute_return_epc(struct pt_regs *regs)
*/
addr = (unsigned int __user *) epc;
if (__get_user(insn.word, addr)) {
force_sig(SIGSEGV, current);
force_sig(SIGSEGV);
return -EFAULT;
}

return __compute_return_epc_for_insn(regs, insn);

unaligned:
printk("%s: unaligned epc - sending SIGBUS.\n", current->comm);
force_sig(SIGBUS, current);
force_sig(SIGBUS);
return -EFAULT;
}

Expand Down
2 changes: 1 addition & 1 deletion arch/mips/kernel/kprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ static int evaluate_branch_instruction(struct kprobe *p, struct pt_regs *regs,

unaligned:
pr_notice("%s: unaligned epc - sending SIGBUS.\n", current->comm);
force_sig(SIGBUS, current);
force_sig(SIGBUS);
return -EFAULT;

}
Expand Down
Loading

0 comments on commit 3cf5d07

Please sign in to comment.