Skip to content

Commit

Permalink
signal: Remove the task parameter from force_sig_fault
Browse files Browse the repository at this point in the history
As synchronous exceptions really only make sense against the current
task (otherwise how are you synchronous) remove the task parameter
from from force_sig_fault to make it explicit that is what is going
on.

The two known exceptions that deliver a synchronous exception to a
stopped ptraced task have already been changed to
force_sig_fault_to_task.

The callers have been changed with the following emacs regular expression
(with obvious variations on the architectures that take more arguments)
to avoid typos:

force_sig_fault[(]\([^,]+\)[,]\([^,]+\)[,]\([^,]+\)[,]\W+current[)]
->
force_sig_fault(\1,\2,\3)

Signed-off-by: "Eric W. Biederman" <[email protected]>
  • Loading branch information
ebiederm committed May 29, 2019
1 parent 91ca180 commit 2e1661d
Show file tree
Hide file tree
Showing 67 changed files with 137 additions and 151 deletions.
2 changes: 1 addition & 1 deletion arch/alpha/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ do_entDbg(struct pt_regs *regs)
{
die_if_kernel("Instruction fault", regs, 0, NULL);

force_sig_fault(SIGILL, ILL_ILLOPC, (void __user *)regs->pc, 0, current);
force_sig_fault(SIGILL, ILL_ILLOPC, (void __user *)regs->pc, 0);
}


Expand Down
4 changes: 2 additions & 2 deletions arch/alpha/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,13 @@ do_page_fault(unsigned long address, unsigned long mmcsr,
up_read(&mm->mmap_sem);
/* Send a sigbus, regardless of whether we were in kernel
or user mode. */
force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *) address, 0, current);
force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *) address, 0);
if (!user_mode(regs))
goto no_context;
return;

do_sigsegv:
force_sig_fault(SIGSEGV, si_code, (void __user *) address, 0, current);
force_sig_fault(SIGSEGV, si_code, (void __user *) address, 0);
return;

#ifdef CONFIG_ALPHA_LARGE_VMALLOC
Expand Down
2 changes: 1 addition & 1 deletion arch/arc/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ unhandled_exception(const char *str, struct pt_regs *regs,

tsk->thread.fault_address = (__force unsigned int)addr;

force_sig_fault(signo, si_code, addr, current);
force_sig_fault(signo, si_code, addr);

} else {
/* If not due to copy_(to|from)_user, we are doomed */
Expand Down
4 changes: 2 additions & 2 deletions arch/arc/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ void do_page_fault(unsigned long address, struct pt_regs *regs)
/* User mode accesses just cause a SIGSEGV */
if (user_mode(regs)) {
tsk->thread.fault_address = address;
force_sig_fault(SIGSEGV, si_code, (void __user *)address, current);
force_sig_fault(SIGSEGV, si_code, (void __user *)address);
return;
}

Expand Down Expand Up @@ -237,5 +237,5 @@ void do_page_fault(unsigned long address, struct pt_regs *regs)
goto no_context;

tsk->thread.fault_address = address;
force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address, current);
force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address);
}
2 changes: 1 addition & 1 deletion arch/arm/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ void ptrace_disable(struct task_struct *child)
void ptrace_break(struct pt_regs *regs)
{
force_sig_fault(SIGTRAP, TRAP_BRKPT,
(void __user *)instruction_pointer(regs), current);
(void __user *)instruction_pointer(regs));
}

static int break_trap(struct pt_regs *regs, unsigned int instr)
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ void arm_notify_die(const char *str, struct pt_regs *regs,
current->thread.error_code = err;
current->thread.trap_no = trap;

force_sig_fault(signo, si_code, addr, current);
force_sig_fault(signo, si_code, addr);
} else {
die(str, regs, err);
}
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mm/alignment.c
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
goto fixup;

if (ai_usermode & UM_SIGNAL) {
force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *)addr, current);
force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *)addr);
} else {
/*
* We're about to disable the alignment trap and return to
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ __do_user_fault(unsigned long addr, unsigned int fsr, unsigned int sig,
tsk->thread.address = addr;
tsk->thread.error_code = fsr;
tsk->thread.trap_no = 14;
force_sig_fault(sig, code, (void __user *)addr, current);
force_sig_fault(sig, code, (void __user *)addr);
}

void do_bad_area(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
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 @@ -259,7 +259,7 @@ void arm64_force_sig_fault(int signo, int code, void __user *addr,
if (signo == SIGKILL)
force_sig(SIGKILL);
else
force_sig_fault(signo, code, addr, current);
force_sig_fault(signo, code, addr);
}

void arm64_force_sig_mceerr(int code, void __user *addr, short lsb,
Expand Down
2 changes: 1 addition & 1 deletion arch/c6x/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ static void do_trap(struct exception_info *except_info, struct pt_regs *regs)
die_if_kernel(except_info->kernel_str, regs, addr);

force_sig_fault(except_info->signo, except_info->code,
(void __user *)addr, current);
(void __user *)addr);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion arch/csky/abiv1/alignment.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ void csky_alignment(struct pt_regs *regs)
do_exit(SIGKILL);
}

force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *)addr, current);
force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *)addr);
}

static struct ctl_table alignment_tbl[4] = {
Expand Down
2 changes: 1 addition & 1 deletion arch/csky/abiv2/fpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void fpu_fpe(struct pt_regs *regs)
code = FPE_FLTRES;
}

force_sig_fault(sig, code, (void __user *)regs->pc, current);
force_sig_fault(sig, code, (void __user *)regs->pc);
}

#define FMFVR_FPU_REGS(vrx, vry) \
Expand Down
2 changes: 1 addition & 1 deletion arch/csky/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void buserr(struct pt_regs *regs)
pr_err("User mode Bus Error\n");
show_regs(regs);

force_sig_fault(SIGSEGV, 0, (void __user *)regs->pc, current);
force_sig_fault(SIGSEGV, 0, (void __user *)regs->pc);
}

#define USR_BKPT 0x1464
Expand Down
4 changes: 2 additions & 2 deletions arch/csky/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write,
bad_area_nosemaphore:
/* User mode accesses just cause a SIGSEGV */
if (user_mode(regs)) {
force_sig_fault(SIGSEGV, si_code, (void __user *)address, current);
force_sig_fault(SIGSEGV, si_code, (void __user *)address);
return;
}

Expand Down Expand Up @@ -212,5 +212,5 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write,
if (!user_mode(regs))
goto no_context;

force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address, current);
force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address);
}
2 changes: 1 addition & 1 deletion arch/hexagon/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ void do_trap0(struct pt_regs *regs)
* may want to use a different trap0 flavor.
*/
force_sig_fault(SIGTRAP, TRAP_BRKPT,
(void __user *) pt_elr(regs), current);
(void __user *) pt_elr(regs));
} else {
#ifdef CONFIG_KGDB
kgdb_handle_exception(pt_cause(regs), SIGTRAP,
Expand Down
4 changes: 2 additions & 2 deletions arch/hexagon/mm/vm_fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,14 @@ void do_page_fault(unsigned long address, long cause, struct pt_regs *regs)
si_signo = SIGSEGV;
si_code = SEGV_ACCERR;
}
force_sig_fault(si_signo, si_code, (void __user *)address, current);
force_sig_fault(si_signo, si_code, (void __user *)address);
return;

bad_area:
up_read(&mm->mmap_sem);

if (user_mode(regs)) {
force_sig_fault(SIGSEGV, si_code, (void __user *)address, current);
force_sig_fault(SIGSEGV, si_code, (void __user *)address);
return;
}
/* Kernel-mode fault falls through */
Expand Down
6 changes: 3 additions & 3 deletions arch/ia64/kernel/brl_emu.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,21 +197,21 @@ ia64_emulate_brl (struct pt_regs *regs, unsigned long ar_ec)
*/
printk(KERN_DEBUG "Woah! Unimplemented Instruction Address Trap!\n");
force_sig_fault(SIGILL, ILL_BADIADDR, (void __user *)NULL,
0, 0, 0, current);
0, 0, 0);
} else if (ia64_psr(regs)->tb) {
/*
* Branch Tracing is enabled.
* Force a taken branch signal.
*/
force_sig_fault(SIGTRAP, TRAP_BRANCH, (void __user *)NULL,
0, 0, 0, current);
0, 0, 0);
} else if (ia64_psr(regs)->ss) {
/*
* Single Step is enabled.
* Force a trace signal.
*/
force_sig_fault(SIGTRAP, TRAP_TRACE, (void __user *)NULL,
0, 0, 0, current);
0, 0, 0);
}
return rv;
}
18 changes: 9 additions & 9 deletions arch/ia64/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ __kprobes ia64_bad_break (unsigned long break_num, struct pt_regs *regs)
}
force_sig_fault(sig, code,
(void __user *) (regs->cr_iip + ia64_psr(regs)->ri),
break_num, 0 /* clear __ISR_VALID */, 0, current);
break_num, 0 /* clear __ISR_VALID */, 0);
}

/*
Expand Down Expand Up @@ -353,7 +353,7 @@ handle_fpu_swa (int fp_fault, struct pt_regs *regs, unsigned long isr)
}
force_sig_fault(SIGFPE, si_code,
(void __user *) (regs->cr_iip + ia64_psr(regs)->ri),
0, __ISR_VALID, isr, current);
0, __ISR_VALID, isr);
}
} else {
if (exception == -1) {
Expand All @@ -373,7 +373,7 @@ handle_fpu_swa (int fp_fault, struct pt_regs *regs, unsigned long isr)
}
force_sig_fault(SIGFPE, si_code,
(void __user *) (regs->cr_iip + ia64_psr(regs)->ri),
0, __ISR_VALID, isr, current);
0, __ISR_VALID, isr);
}
}
return 0;
Expand Down Expand Up @@ -408,7 +408,7 @@ ia64_illegal_op_fault (unsigned long ec, long arg1, long arg2, long arg3,

force_sig_fault(SIGILL, ILL_ILLOPC,
(void __user *) (regs.cr_iip + ia64_psr(&regs)->ri),
0, 0, 0, current);
0, 0, 0);
return rv;
}

Expand Down Expand Up @@ -483,7 +483,7 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
+ ia64_psr(&regs)->ri);
}
force_sig_fault(sig, code, addr,
vector, __ISR_VALID, isr, current);
vector, __ISR_VALID, isr);
return;
} else if (ia64_done_with_exception(&regs))
return;
Expand All @@ -493,7 +493,7 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
case 31: /* Unsupported Data Reference */
if (user_mode(&regs)) {
force_sig_fault(SIGILL, ILL_ILLOPN, (void __user *) iip,
vector, __ISR_VALID, isr, current);
vector, __ISR_VALID, isr);
return;
}
sprintf(buf, "Unsupported data reference");
Expand Down Expand Up @@ -542,15 +542,15 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
== NOTIFY_STOP)
return;
force_sig_fault(SIGTRAP, si_code, (void __user *) ifa,
0, __ISR_VALID, isr, current);
0, __ISR_VALID, isr);
return;

case 32: /* fp fault */
case 33: /* fp trap */
result = handle_fpu_swa((vector == 32) ? 1 : 0, &regs, isr);
if ((result < 0) || (current->thread.flags & IA64_THREAD_FPEMU_SIGFPE)) {
force_sig_fault(SIGFPE, FPE_FLTINV, (void __user *) iip,
0, __ISR_VALID, isr, current);
0, __ISR_VALID, isr);
}
return;

Expand Down Expand Up @@ -578,7 +578,7 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
if (user_mode(&regs)) {
force_sig_fault(SIGILL, ILL_BADIADDR,
(void __user *) iip,
0, 0, 0, current);
0, 0, 0);
return;
}
sprintf(buf, "Unimplemented Instruction Address fault");
Expand Down
2 changes: 1 addition & 1 deletion arch/ia64/kernel/unaligned.c
Original file line number Diff line number Diff line change
Expand Up @@ -1537,6 +1537,6 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
}
force_sigbus:
force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *) ifa,
0, 0, 0, current);
0, 0, 0);
goto done;
}
2 changes: 1 addition & 1 deletion arch/ia64/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re
}
if (user_mode(regs)) {
force_sig_fault(signal, code, (void __user *) address,
0, __ISR_VALID, isr, current);
0, __ISR_VALID, isr);
return;
}

Expand Down
4 changes: 2 additions & 2 deletions arch/m68k/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,7 @@ asmlinkage void trap_c(struct frame *fp)
addr = (void __user*) fp->un.fmtb.daddr;
break;
}
force_sig_fault(sig, si_code, addr, current);
force_sig_fault(sig, si_code, addr);
}

void die_if_kernel (char *str, struct pt_regs *fp, int nr)
Expand Down Expand Up @@ -1159,6 +1159,6 @@ asmlinkage void fpsp040_die(void)
#ifdef CONFIG_M68KFPU_EMU
asmlinkage void fpemu_signal(int signal, int code, void *addr)
{
force_sig_fault(signal, code, addr, current);
force_sig_fault(signal, code, addr);
}
#endif
4 changes: 2 additions & 2 deletions arch/m68k/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ int send_fault_sig(struct pt_regs *regs)
pr_debug("send_fault_sig: %p,%d,%d\n", addr, signo, si_code);

if (user_mode(regs)) {
force_sig_fault(signo, si_code, addr, current);
force_sig_fault(signo, si_code, addr);
} else {
if (fixup_exception(regs))
return -1;

//if (signo == SIGBUS)
// force_sig_fault(si_signo, si_code, addr, current);
// force_sig_fault(si_signo, si_code, addr);

/*
* Oops. The kernel tried to access some bad page. We'll have to
Expand Down
2 changes: 1 addition & 1 deletion arch/microblaze/kernel/exceptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr)
if (kernel_mode(regs))
die("Exception in kernel mode", regs, signr);

force_sig_fault(signr, code, (void __user *)addr, current);
force_sig_fault(signr, code, (void __user *)addr);
}

asmlinkage void full_exception(struct pt_regs *regs, unsigned int type,
Expand Down
2 changes: 1 addition & 1 deletion arch/microblaze/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long address,
do_sigbus:
up_read(&mm->mmap_sem);
if (user_mode(regs)) {
force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address, current);
force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address);
return;
}
bad_page_fault(regs, address, SIGBUS);
Expand Down
Loading

0 comments on commit 2e1661d

Please sign in to comment.