signal: Remove the task parameter from force_sig_fault

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" <ebiederm@xmission.com>
This commit is contained in:
Eric W. Biederman 2019-05-23 11:04:24 -05:00
parent 91ca180dbd
commit 2e1661d267
67 changed files with 137 additions and 151 deletions

View File

@ -402,7 +402,7 @@ do_entDbg(struct pt_regs *regs)
{ {
die_if_kernel("Instruction fault", regs, 0, NULL); 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);
} }

View File

@ -221,13 +221,13 @@ retry:
up_read(&mm->mmap_sem); up_read(&mm->mmap_sem);
/* Send a sigbus, regardless of whether we were in kernel /* Send a sigbus, regardless of whether we were in kernel
or user mode. */ 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)) if (!user_mode(regs))
goto no_context; goto no_context;
return; return;
do_sigsegv: do_sigsegv:
force_sig_fault(SIGSEGV, si_code, (void __user *) address, 0, current); force_sig_fault(SIGSEGV, si_code, (void __user *) address, 0);
return; return;
#ifdef CONFIG_ALPHA_LARGE_VMALLOC #ifdef CONFIG_ALPHA_LARGE_VMALLOC

View File

@ -50,7 +50,7 @@ unhandled_exception(const char *str, struct pt_regs *regs,
tsk->thread.fault_address = (__force unsigned int)addr; tsk->thread.fault_address = (__force unsigned int)addr;
force_sig_fault(signo, si_code, addr, current); force_sig_fault(signo, si_code, addr);
} else { } else {
/* If not due to copy_(to|from)_user, we are doomed */ /* If not due to copy_(to|from)_user, we are doomed */

View File

@ -202,7 +202,7 @@ bad_area_nosemaphore:
/* User mode accesses just cause a SIGSEGV */ /* User mode accesses just cause a SIGSEGV */
if (user_mode(regs)) { if (user_mode(regs)) {
tsk->thread.fault_address = address; 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; return;
} }
@ -237,5 +237,5 @@ do_sigbus:
goto no_context; goto no_context;
tsk->thread.fault_address = address; tsk->thread.fault_address = address;
force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address, current); force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address);
} }

View File

@ -204,7 +204,7 @@ void ptrace_disable(struct task_struct *child)
void ptrace_break(struct pt_regs *regs) void ptrace_break(struct pt_regs *regs)
{ {
force_sig_fault(SIGTRAP, TRAP_BRKPT, 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) static int break_trap(struct pt_regs *regs, unsigned int instr)

View File

@ -372,7 +372,7 @@ void arm_notify_die(const char *str, struct pt_regs *regs,
current->thread.error_code = err; current->thread.error_code = err;
current->thread.trap_no = trap; current->thread.trap_no = trap;
force_sig_fault(signo, si_code, addr, current); force_sig_fault(signo, si_code, addr);
} else { } else {
die(str, regs, err); die(str, regs, err);
} }

View File

@ -948,7 +948,7 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
goto fixup; goto fixup;
if (ai_usermode & UM_SIGNAL) { 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 { } else {
/* /*
* We're about to disable the alignment trap and return to * We're about to disable the alignment trap and return to

View File

@ -184,7 +184,7 @@ __do_user_fault(unsigned long addr, unsigned int fsr, unsigned int sig,
tsk->thread.address = addr; tsk->thread.address = addr;
tsk->thread.error_code = fsr; tsk->thread.error_code = fsr;
tsk->thread.trap_no = 14; 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) void do_bad_area(unsigned long addr, unsigned int fsr, struct pt_regs *regs)

View File

@ -259,7 +259,7 @@ void arm64_force_sig_fault(int signo, int code, void __user *addr,
if (signo == SIGKILL) if (signo == SIGKILL)
force_sig(SIGKILL); force_sig(SIGKILL);
else 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, void arm64_force_sig_mceerr(int code, void __user *addr, short lsb,

View File

@ -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); die_if_kernel(except_info->kernel_str, regs, addr);
force_sig_fault(except_info->signo, except_info->code, force_sig_fault(except_info->signo, except_info->code,
(void __user *)addr, current); (void __user *)addr);
} }
/* /*

View File

@ -283,7 +283,7 @@ bad_area:
do_exit(SIGKILL); 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] = { static struct ctl_table alignment_tbl[4] = {

View File

@ -124,7 +124,7 @@ void fpu_fpe(struct pt_regs *regs)
code = FPE_FLTRES; 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) \ #define FMFVR_FPU_REGS(vrx, vry) \

View File

@ -106,7 +106,7 @@ void buserr(struct pt_regs *regs)
pr_err("User mode Bus Error\n"); pr_err("User mode Bus Error\n");
show_regs(regs); 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 #define USR_BKPT 0x1464

View File

@ -179,7 +179,7 @@ bad_area:
bad_area_nosemaphore: bad_area_nosemaphore:
/* User mode accesses just cause a SIGSEGV */ /* User mode accesses just cause a SIGSEGV */
if (user_mode(regs)) { if (user_mode(regs)) {
force_sig_fault(SIGSEGV, si_code, (void __user *)address, current); force_sig_fault(SIGSEGV, si_code, (void __user *)address);
return; return;
} }
@ -212,5 +212,5 @@ do_sigbus:
if (!user_mode(regs)) if (!user_mode(regs))
goto no_context; goto no_context;
force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address, current); force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address);
} }

View File

@ -420,7 +420,7 @@ void do_trap0(struct pt_regs *regs)
* may want to use a different trap0 flavor. * may want to use a different trap0 flavor.
*/ */
force_sig_fault(SIGTRAP, TRAP_BRKPT, force_sig_fault(SIGTRAP, TRAP_BRKPT,
(void __user *) pt_elr(regs), current); (void __user *) pt_elr(regs));
} else { } else {
#ifdef CONFIG_KGDB #ifdef CONFIG_KGDB
kgdb_handle_exception(pt_cause(regs), SIGTRAP, kgdb_handle_exception(pt_cause(regs), SIGTRAP,

View File

@ -148,14 +148,14 @@ good_area:
si_signo = SIGSEGV; si_signo = SIGSEGV;
si_code = SEGV_ACCERR; 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; return;
bad_area: bad_area:
up_read(&mm->mmap_sem); up_read(&mm->mmap_sem);
if (user_mode(regs)) { if (user_mode(regs)) {
force_sig_fault(SIGSEGV, si_code, (void __user *)address, current); force_sig_fault(SIGSEGV, si_code, (void __user *)address);
return; return;
} }
/* Kernel-mode fault falls through */ /* Kernel-mode fault falls through */

View File

@ -197,21 +197,21 @@ ia64_emulate_brl (struct pt_regs *regs, unsigned long ar_ec)
*/ */
printk(KERN_DEBUG "Woah! Unimplemented Instruction Address Trap!\n"); printk(KERN_DEBUG "Woah! Unimplemented Instruction Address Trap!\n");
force_sig_fault(SIGILL, ILL_BADIADDR, (void __user *)NULL, force_sig_fault(SIGILL, ILL_BADIADDR, (void __user *)NULL,
0, 0, 0, current); 0, 0, 0);
} else if (ia64_psr(regs)->tb) { } else if (ia64_psr(regs)->tb) {
/* /*
* Branch Tracing is enabled. * Branch Tracing is enabled.
* Force a taken branch signal. * Force a taken branch signal.
*/ */
force_sig_fault(SIGTRAP, TRAP_BRANCH, (void __user *)NULL, force_sig_fault(SIGTRAP, TRAP_BRANCH, (void __user *)NULL,
0, 0, 0, current); 0, 0, 0);
} else if (ia64_psr(regs)->ss) { } else if (ia64_psr(regs)->ss) {
/* /*
* Single Step is enabled. * Single Step is enabled.
* Force a trace signal. * Force a trace signal.
*/ */
force_sig_fault(SIGTRAP, TRAP_TRACE, (void __user *)NULL, force_sig_fault(SIGTRAP, TRAP_TRACE, (void __user *)NULL,
0, 0, 0, current); 0, 0, 0);
} }
return rv; return rv;
} }

View File

@ -176,7 +176,7 @@ __kprobes ia64_bad_break (unsigned long break_num, struct pt_regs *regs)
} }
force_sig_fault(sig, code, force_sig_fault(sig, code,
(void __user *) (regs->cr_iip + ia64_psr(regs)->ri), (void __user *) (regs->cr_iip + ia64_psr(regs)->ri),
break_num, 0 /* clear __ISR_VALID */, 0, current); break_num, 0 /* clear __ISR_VALID */, 0);
} }
/* /*
@ -353,7 +353,7 @@ handle_fpu_swa (int fp_fault, struct pt_regs *regs, unsigned long isr)
} }
force_sig_fault(SIGFPE, si_code, force_sig_fault(SIGFPE, si_code,
(void __user *) (regs->cr_iip + ia64_psr(regs)->ri), (void __user *) (regs->cr_iip + ia64_psr(regs)->ri),
0, __ISR_VALID, isr, current); 0, __ISR_VALID, isr);
} }
} else { } else {
if (exception == -1) { if (exception == -1) {
@ -373,7 +373,7 @@ handle_fpu_swa (int fp_fault, struct pt_regs *regs, unsigned long isr)
} }
force_sig_fault(SIGFPE, si_code, force_sig_fault(SIGFPE, si_code,
(void __user *) (regs->cr_iip + ia64_psr(regs)->ri), (void __user *) (regs->cr_iip + ia64_psr(regs)->ri),
0, __ISR_VALID, isr, current); 0, __ISR_VALID, isr);
} }
} }
return 0; return 0;
@ -408,7 +408,7 @@ ia64_illegal_op_fault (unsigned long ec, long arg1, long arg2, long arg3,
force_sig_fault(SIGILL, ILL_ILLOPC, force_sig_fault(SIGILL, ILL_ILLOPC,
(void __user *) (regs.cr_iip + ia64_psr(&regs)->ri), (void __user *) (regs.cr_iip + ia64_psr(&regs)->ri),
0, 0, 0, current); 0, 0, 0);
return rv; return rv;
} }
@ -483,7 +483,7 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
+ ia64_psr(&regs)->ri); + ia64_psr(&regs)->ri);
} }
force_sig_fault(sig, code, addr, force_sig_fault(sig, code, addr,
vector, __ISR_VALID, isr, current); vector, __ISR_VALID, isr);
return; return;
} else if (ia64_done_with_exception(&regs)) } else if (ia64_done_with_exception(&regs))
return; return;
@ -493,7 +493,7 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
case 31: /* Unsupported Data Reference */ case 31: /* Unsupported Data Reference */
if (user_mode(&regs)) { if (user_mode(&regs)) {
force_sig_fault(SIGILL, ILL_ILLOPN, (void __user *) iip, force_sig_fault(SIGILL, ILL_ILLOPN, (void __user *) iip,
vector, __ISR_VALID, isr, current); vector, __ISR_VALID, isr);
return; return;
} }
sprintf(buf, "Unsupported data reference"); sprintf(buf, "Unsupported data reference");
@ -542,7 +542,7 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
== NOTIFY_STOP) == NOTIFY_STOP)
return; return;
force_sig_fault(SIGTRAP, si_code, (void __user *) ifa, force_sig_fault(SIGTRAP, si_code, (void __user *) ifa,
0, __ISR_VALID, isr, current); 0, __ISR_VALID, isr);
return; return;
case 32: /* fp fault */ case 32: /* fp fault */
@ -550,7 +550,7 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
result = handle_fpu_swa((vector == 32) ? 1 : 0, &regs, isr); result = handle_fpu_swa((vector == 32) ? 1 : 0, &regs, isr);
if ((result < 0) || (current->thread.flags & IA64_THREAD_FPEMU_SIGFPE)) { if ((result < 0) || (current->thread.flags & IA64_THREAD_FPEMU_SIGFPE)) {
force_sig_fault(SIGFPE, FPE_FLTINV, (void __user *) iip, force_sig_fault(SIGFPE, FPE_FLTINV, (void __user *) iip,
0, __ISR_VALID, isr, current); 0, __ISR_VALID, isr);
} }
return; return;
@ -578,7 +578,7 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
if (user_mode(&regs)) { if (user_mode(&regs)) {
force_sig_fault(SIGILL, ILL_BADIADDR, force_sig_fault(SIGILL, ILL_BADIADDR,
(void __user *) iip, (void __user *) iip,
0, 0, 0, current); 0, 0, 0);
return; return;
} }
sprintf(buf, "Unimplemented Instruction Address fault"); sprintf(buf, "Unimplemented Instruction Address fault");

View File

@ -1537,6 +1537,6 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
} }
force_sigbus: force_sigbus:
force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *) ifa, force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *) ifa,
0, 0, 0, current); 0, 0, 0);
goto done; goto done;
} }

View File

@ -249,7 +249,7 @@ retry:
} }
if (user_mode(regs)) { if (user_mode(regs)) {
force_sig_fault(signal, code, (void __user *) address, force_sig_fault(signal, code, (void __user *) address,
0, __ISR_VALID, isr, current); 0, __ISR_VALID, isr);
return; return;
} }

View File

@ -1127,7 +1127,7 @@ asmlinkage void trap_c(struct frame *fp)
addr = (void __user*) fp->un.fmtb.daddr; addr = (void __user*) fp->un.fmtb.daddr;
break; 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) void die_if_kernel (char *str, struct pt_regs *fp, int nr)
@ -1159,6 +1159,6 @@ asmlinkage void fpsp040_die(void)
#ifdef CONFIG_M68KFPU_EMU #ifdef CONFIG_M68KFPU_EMU
asmlinkage void fpemu_signal(int signal, int code, void *addr) asmlinkage void fpemu_signal(int signal, int code, void *addr)
{ {
force_sig_fault(signal, code, addr, current); force_sig_fault(signal, code, addr);
} }
#endif #endif

View File

@ -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); pr_debug("send_fault_sig: %p,%d,%d\n", addr, signo, si_code);
if (user_mode(regs)) { if (user_mode(regs)) {
force_sig_fault(signo, si_code, addr, current); force_sig_fault(signo, si_code, addr);
} else { } else {
if (fixup_exception(regs)) if (fixup_exception(regs))
return -1; return -1;
//if (signo == SIGBUS) //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 * Oops. The kernel tried to access some bad page. We'll have to

View File

@ -63,7 +63,7 @@ void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr)
if (kernel_mode(regs)) if (kernel_mode(regs))
die("Exception in kernel mode", regs, signr); 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, asmlinkage void full_exception(struct pt_regs *regs, unsigned int type,

View File

@ -289,7 +289,7 @@ out_of_memory:
do_sigbus: do_sigbus:
up_read(&mm->mmap_sem); up_read(&mm->mmap_sem);
if (user_mode(regs)) { if (user_mode(regs)) {
force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address, current); force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address);
return; return;
} }
bad_page_fault(regs, address, SIGBUS); bad_page_fault(regs, address, SIGBUS);

View File

@ -705,7 +705,7 @@ asmlinkage void do_ov(struct pt_regs *regs)
prev_state = exception_enter(); prev_state = exception_enter();
die_if_kernel("Integer overflow", regs); die_if_kernel("Integer overflow", regs);
force_sig_fault(SIGFPE, FPE_INTOVF, (void __user *)regs->cp0_epc, current); force_sig_fault(SIGFPE, FPE_INTOVF, (void __user *)regs->cp0_epc);
exception_exit(prev_state); exception_exit(prev_state);
} }
@ -750,7 +750,7 @@ int process_fpemu_return(int sig, void __user *fault_addr, unsigned long fcr31)
return 1; return 1;
case SIGBUS: case SIGBUS:
force_sig_fault(SIGBUS, BUS_ADRERR, fault_addr, current); force_sig_fault(SIGBUS, BUS_ADRERR, fault_addr);
return 1; return 1;
case SIGSEGV: case SIGSEGV:
@ -761,7 +761,7 @@ int process_fpemu_return(int sig, void __user *fault_addr, unsigned long fcr31)
else else
si_code = SEGV_MAPERR; si_code = SEGV_MAPERR;
up_read(&current->mm->mmap_sem); up_read(&current->mm->mmap_sem);
force_sig_fault(SIGSEGV, si_code, fault_addr, current); force_sig_fault(SIGSEGV, si_code, fault_addr);
return 1; return 1;
default: default:
@ -943,7 +943,7 @@ void do_trap_or_bp(struct pt_regs *regs, unsigned int code, int si_code,
die_if_kernel(b, regs); die_if_kernel(b, regs);
force_sig_fault(SIGFPE, force_sig_fault(SIGFPE,
code == BRK_DIVZERO ? FPE_INTDIV : FPE_INTOVF, code == BRK_DIVZERO ? FPE_INTDIV : FPE_INTOVF,
(void __user *) regs->cp0_epc, current); (void __user *) regs->cp0_epc);
break; break;
case BRK_BUG: case BRK_BUG:
die_if_kernel("Kernel bug detected", regs); die_if_kernel("Kernel bug detected", regs);
@ -968,7 +968,7 @@ void do_trap_or_bp(struct pt_regs *regs, unsigned int code, int si_code,
scnprintf(b, sizeof(b), "%s instruction in kernel code", str); scnprintf(b, sizeof(b), "%s instruction in kernel code", str);
die_if_kernel(b, regs); die_if_kernel(b, regs);
if (si_code) { if (si_code) {
force_sig_fault(SIGTRAP, si_code, NULL, current); force_sig_fault(SIGTRAP, si_code, NULL);
} else { } else {
force_sig(SIGTRAP); force_sig(SIGTRAP);
} }
@ -1521,7 +1521,7 @@ asmlinkage void do_watch(struct pt_regs *regs)
if (test_tsk_thread_flag(current, TIF_LOAD_WATCH)) { if (test_tsk_thread_flag(current, TIF_LOAD_WATCH)) {
mips_read_watch_registers(); mips_read_watch_registers();
local_irq_enable(); local_irq_enable();
force_sig_fault(SIGTRAP, TRAP_HWBKPT, NULL, current); force_sig_fault(SIGTRAP, TRAP_HWBKPT, NULL);
} else { } else {
mips_clear_watch_registers(); mips_clear_watch_registers();
local_irq_enable(); local_irq_enable();

View File

@ -223,7 +223,7 @@ bad_area_nosemaphore:
pr_cont("\n"); pr_cont("\n");
} }
current->thread.trap_nr = (regs->cp0_cause >> 2) & 0x1f; current->thread.trap_nr = (regs->cp0_cause >> 2) & 0x1f;
force_sig_fault(SIGSEGV, si_code, (void __user *)address, current); force_sig_fault(SIGSEGV, si_code, (void __user *)address);
return; return;
} }
@ -279,7 +279,7 @@ do_sigbus:
#endif #endif
current->thread.trap_nr = (regs->cp0_cause >> 2) & 0x1f; current->thread.trap_nr = (regs->cp0_cause >> 2) & 0x1f;
tsk->thread.cp0_badvaddr = address; tsk->thread.cp0_badvaddr = address;
force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address, current); force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address);
return; return;
#ifndef CONFIG_64BIT #ifndef CONFIG_64BIT

View File

@ -246,7 +246,7 @@ inline void handle_fpu_exception(struct pt_regs *regs)
} }
force_sig_fault(si_signo, si_code, force_sig_fault(si_signo, si_code,
(void __user *)instruction_pointer(regs), current); (void __user *)instruction_pointer(regs));
done: done:
own_fpu(); own_fpu();
} }

View File

@ -205,7 +205,7 @@ int bad_syscall(int n, struct pt_regs *regs)
} }
force_sig_fault(SIGILL, ILL_ILLTRP, force_sig_fault(SIGILL, ILL_ILLTRP,
(void __user *)instruction_pointer(regs) - 4, current); (void __user *)instruction_pointer(regs) - 4);
die_if_kernel("Oops - bad syscall", regs, n); die_if_kernel("Oops - bad syscall", regs, n);
return regs->uregs[0]; return regs->uregs[0];
} }
@ -263,7 +263,7 @@ static void send_sigtrap(struct pt_regs *regs, int error_code, int si_code)
tsk->thread.error_code = error_code; tsk->thread.error_code = error_code;
force_sig_fault(SIGTRAP, si_code, force_sig_fault(SIGTRAP, si_code,
(void __user *)instruction_pointer(regs), current); (void __user *)instruction_pointer(regs));
} }
void do_debug_trap(unsigned long entry, unsigned long addr, void do_debug_trap(unsigned long entry, unsigned long addr,

View File

@ -271,7 +271,7 @@ bad_area_nosemaphore:
tsk->thread.address = addr; tsk->thread.address = addr;
tsk->thread.error_code = error_code; tsk->thread.error_code = error_code;
tsk->thread.trap_no = entry; tsk->thread.trap_no = entry;
force_sig_fault(SIGSEGV, si_code, (void __user *)addr, current); force_sig_fault(SIGSEGV, si_code, (void __user *)addr);
return; return;
} }
@ -340,7 +340,7 @@ do_sigbus:
tsk->thread.address = addr; tsk->thread.address = addr;
tsk->thread.error_code = error_code; tsk->thread.error_code = error_code;
tsk->thread.trap_no = entry; tsk->thread.trap_no = entry;
force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)addr, current); force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)addr);
return; return;

View File

@ -26,7 +26,7 @@ static DEFINE_SPINLOCK(die_lock);
static void _send_sig(int signo, int code, unsigned long addr) static void _send_sig(int signo, int code, unsigned long addr)
{ {
force_sig_fault(signo, code, (void __user *) addr, current); force_sig_fault(signo, code, (void __user *) addr);
} }
void die(const char *str, struct pt_regs *regs, long err) void die(const char *str, struct pt_regs *regs, long err)

View File

@ -249,7 +249,7 @@ void __init trap_init(void)
asmlinkage void do_trap(struct pt_regs *regs, unsigned long address) asmlinkage void do_trap(struct pt_regs *regs, unsigned long address)
{ {
force_sig_fault(SIGTRAP, TRAP_TRACE, (void __user *)address, current); force_sig_fault(SIGTRAP, TRAP_TRACE, (void __user *)address);
regs->pc += 4; regs->pc += 4;
} }
@ -258,7 +258,7 @@ asmlinkage void do_unaligned_access(struct pt_regs *regs, unsigned long address)
{ {
if (user_mode(regs)) { if (user_mode(regs)) {
/* Send a SIGBUS */ /* Send a SIGBUS */
force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *)address, current); force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *)address);
} else { } else {
printk("KERNEL: Unaligned Access 0x%.8lx\n", address); printk("KERNEL: Unaligned Access 0x%.8lx\n", address);
show_registers(regs); show_registers(regs);
@ -271,7 +271,7 @@ asmlinkage void do_bus_fault(struct pt_regs *regs, unsigned long address)
{ {
if (user_mode(regs)) { if (user_mode(regs)) {
/* Send a SIGBUS */ /* Send a SIGBUS */
force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address, current); force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address);
} else { /* Kernel mode */ } else { /* Kernel mode */
printk("KERNEL: Bus error (SIGBUS) 0x%.8lx\n", address); printk("KERNEL: Bus error (SIGBUS) 0x%.8lx\n", address);
show_registers(regs); show_registers(regs);
@ -466,7 +466,7 @@ asmlinkage void do_illegal_instruction(struct pt_regs *regs,
if (user_mode(regs)) { if (user_mode(regs)) {
/* Send a SIGILL */ /* Send a SIGILL */
force_sig_fault(SIGILL, ILL_ILLOPC, (void __user *)address, current); force_sig_fault(SIGILL, ILL_ILLOPC, (void __user *)address);
} else { /* Kernel mode */ } else { /* Kernel mode */
printk("KERNEL: Illegal instruction (SIGILL) 0x%.8lx\n", printk("KERNEL: Illegal instruction (SIGILL) 0x%.8lx\n",
address); address);

View File

@ -213,7 +213,7 @@ bad_area_nosemaphore:
/* User mode accesses just cause a SIGSEGV */ /* User mode accesses just cause a SIGSEGV */
if (user_mode(regs)) { if (user_mode(regs)) {
force_sig_fault(SIGSEGV, si_code, (void __user *)address, current); force_sig_fault(SIGSEGV, si_code, (void __user *)address);
return; return;
} }
@ -278,7 +278,7 @@ do_sigbus:
* Send a sigbus, regardless of whether we were in kernel * Send a sigbus, regardless of whether we were in kernel
* or user mode. * or user mode.
*/ */
force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address, current); force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address);
/* Kernel mode? Handle exceptions or die */ /* Kernel mode? Handle exceptions or die */
if (!user_mode(regs)) if (!user_mode(regs))

View File

@ -275,7 +275,7 @@ void die_if_kernel(char *str, struct pt_regs *regs, long err)
static void handle_gdb_break(struct pt_regs *regs, int wot) static void handle_gdb_break(struct pt_regs *regs, int wot)
{ {
force_sig_fault(SIGTRAP, wot, force_sig_fault(SIGTRAP, wot,
(void __user *) (regs->iaoq[0] & ~3), current); (void __user *) (regs->iaoq[0] & ~3));
} }
static void handle_break(struct pt_regs *regs) static void handle_break(struct pt_regs *regs)
@ -609,13 +609,13 @@ void notrace handle_interruption(int code, struct pt_regs *regs)
si_code = ILL_PRVREG; si_code = ILL_PRVREG;
give_sigill: give_sigill:
force_sig_fault(SIGILL, si_code, force_sig_fault(SIGILL, si_code,
(void __user *) regs->iaoq[0], current); (void __user *) regs->iaoq[0]);
return; return;
case 12: case 12:
/* Overflow Trap, let the userland signal handler do the cleanup */ /* Overflow Trap, let the userland signal handler do the cleanup */
force_sig_fault(SIGFPE, FPE_INTOVF, force_sig_fault(SIGFPE, FPE_INTOVF,
(void __user *) regs->iaoq[0], current); (void __user *) regs->iaoq[0]);
return; return;
case 13: case 13:
@ -627,7 +627,7 @@ void notrace handle_interruption(int code, struct pt_regs *regs)
* to by si_addr. * to by si_addr.
*/ */
force_sig_fault(SIGFPE, FPE_CONDTRAP, force_sig_fault(SIGFPE, FPE_CONDTRAP,
(void __user *) regs->iaoq[0], current); (void __user *) regs->iaoq[0]);
return; return;
} }
/* The kernel doesn't want to handle condition codes */ /* The kernel doesn't want to handle condition codes */
@ -739,7 +739,7 @@ void notrace handle_interruption(int code, struct pt_regs *regs)
force_sig_fault(SIGSEGV, SEGV_MAPERR, force_sig_fault(SIGSEGV, SEGV_MAPERR,
(code == 7)? (code == 7)?
((void __user *) regs->iaoq[0]) : ((void __user *) regs->iaoq[0]) :
((void __user *) regs->ior), current); ((void __user *) regs->ior));
return; return;
case 28: case 28:
@ -754,7 +754,7 @@ void notrace handle_interruption(int code, struct pt_regs *regs)
task_pid_nr(current), current->comm); task_pid_nr(current), current->comm);
/* SIGBUS, for lack of a better one. */ /* SIGBUS, for lack of a better one. */
force_sig_fault(SIGBUS, BUS_OBJERR, force_sig_fault(SIGBUS, BUS_OBJERR,
(void __user *)regs->ior, current); (void __user *)regs->ior);
return; return;
} }
pdc_chassis_send_status(PDC_CHASSIS_DIRECT_PANIC); pdc_chassis_send_status(PDC_CHASSIS_DIRECT_PANIC);
@ -770,7 +770,7 @@ void notrace handle_interruption(int code, struct pt_regs *regs)
code, fault_space, code, fault_space,
task_pid_nr(current), current->comm); task_pid_nr(current), current->comm);
force_sig_fault(SIGSEGV, SEGV_MAPERR, force_sig_fault(SIGSEGV, SEGV_MAPERR,
(void __user *)regs->ior, current); (void __user *)regs->ior);
return; return;
} }
} }

View File

@ -690,14 +690,14 @@ void handle_unaligned(struct pt_regs *regs)
if (ret == ERR_PAGEFAULT) if (ret == ERR_PAGEFAULT)
{ {
force_sig_fault(SIGSEGV, SEGV_MAPERR, force_sig_fault(SIGSEGV, SEGV_MAPERR,
(void __user *)regs->ior, current); (void __user *)regs->ior);
} }
else else
{ {
force_sigbus: force_sigbus:
/* couldn't handle it ... */ /* couldn't handle it ... */
force_sig_fault(SIGBUS, BUS_ADRALN, force_sig_fault(SIGBUS, BUS_ADRALN,
(void __user *)regs->ior, current); (void __user *)regs->ior);
} }
return; return;

View File

@ -117,7 +117,7 @@ handle_fpe(struct pt_regs *regs)
memcpy(regs->fr, frcopy, sizeof regs->fr); memcpy(regs->fr, frcopy, sizeof regs->fr);
if (signalcode != 0) { if (signalcode != 0) {
force_sig_fault(signalcode >> 24, signalcode & 0xffffff, force_sig_fault(signalcode >> 24, signalcode & 0xffffff,
(void __user *) regs->iaoq[0], current); (void __user *) regs->iaoq[0]);
return -1; return -1;
} }

View File

@ -409,7 +409,7 @@ bad_area:
#endif #endif
show_signal_msg(regs, code, address, tsk, vma); show_signal_msg(regs, code, address, tsk, vma);
force_sig_fault(signo, si_code, (void __user *) address, current); force_sig_fault(signo, si_code, (void __user *) address);
return; return;
} }

View File

@ -643,7 +643,7 @@ void do_break (struct pt_regs *regs, unsigned long address,
hw_breakpoint_disable(); hw_breakpoint_disable();
/* Deliver the signal to userspace */ /* Deliver the signal to userspace */
force_sig_fault(SIGTRAP, TRAP_HWBKPT, (void __user *)address, current); force_sig_fault(SIGTRAP, TRAP_HWBKPT, (void __user *)address);
} }
#endif /* CONFIG_PPC_ADV_DEBUG_REGS */ #endif /* CONFIG_PPC_ADV_DEBUG_REGS */

View File

@ -301,7 +301,7 @@ NOKPROBE_SYMBOL(die);
void user_single_step_report(struct pt_regs *regs) void user_single_step_report(struct pt_regs *regs)
{ {
force_sig_fault(SIGTRAP, TRAP_TRACE, (void __user *)regs->nip, current); force_sig_fault(SIGTRAP, TRAP_TRACE, (void __user *)regs->nip);
} }
static void show_signal_msg(int signr, struct pt_regs *regs, int code, static void show_signal_msg(int signr, struct pt_regs *regs, int code,
@ -367,7 +367,7 @@ void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr)
if (!exception_common(signr, regs, code, addr)) if (!exception_common(signr, regs, code, addr))
return; return;
force_sig_fault(signr, code, (void __user *)addr, current); force_sig_fault(signr, code, (void __user *)addr);
} }
/* /*

View File

@ -187,7 +187,7 @@ static int do_sigbus(struct pt_regs *regs, unsigned long address,
} }
#endif #endif
force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address, current); force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address);
return 0; return 0;
} }

View File

@ -44,22 +44,21 @@ static void spufs_handle_event(struct spu_context *ctx,
switch (type) { switch (type) {
case SPE_EVENT_INVALID_DMA: case SPE_EVENT_INVALID_DMA:
force_sig_fault(SIGBUS, BUS_OBJERR, NULL, current); force_sig_fault(SIGBUS, BUS_OBJERR, NULL);
break; break;
case SPE_EVENT_SPE_DATA_STORAGE: case SPE_EVENT_SPE_DATA_STORAGE:
ctx->ops->restart_dma(ctx); ctx->ops->restart_dma(ctx);
force_sig_fault(SIGSEGV, SEGV_ACCERR, (void __user *)ea, force_sig_fault(SIGSEGV, SEGV_ACCERR, (void __user *)ea);
current);
break; break;
case SPE_EVENT_DMA_ALIGNMENT: case SPE_EVENT_DMA_ALIGNMENT:
/* DAR isn't set for an alignment fault :( */ /* DAR isn't set for an alignment fault :( */
force_sig_fault(SIGBUS, BUS_ADRALN, NULL, current); force_sig_fault(SIGBUS, BUS_ADRALN, NULL);
break; break;
case SPE_EVENT_SPE_ERROR: case SPE_EVENT_SPE_ERROR:
force_sig_fault( force_sig_fault(
SIGILL, ILL_ILLOPC, SIGILL, ILL_ILLOPC,
(void __user *)(unsigned long) (void __user *)(unsigned long)
ctx->ops->npc_read(ctx) - 4, current); ctx->ops->npc_read(ctx) - 4);
break; break;
} }
} }

View File

@ -76,7 +76,7 @@ void do_trap(struct pt_regs *regs, int signo, int code, unsigned long addr)
show_regs(regs); show_regs(regs);
} }
force_sig_fault(signo, code, (void __user *)addr, current); force_sig_fault(signo, code, (void __user *)addr);
} }
static void do_trap_error(struct pt_regs *regs, int signo, int code, static void do_trap_error(struct pt_regs *regs, int signo, int code,
@ -149,7 +149,7 @@ asmlinkage void do_trap_break(struct pt_regs *regs)
} }
#endif /* CONFIG_GENERIC_BUG */ #endif /* CONFIG_GENERIC_BUG */
force_sig_fault(SIGTRAP, TRAP_BRKPT, (void __user *)(regs->sepc), current); force_sig_fault(SIGTRAP, TRAP_BRKPT, (void __user *)(regs->sepc));
} }
#ifdef CONFIG_GENERIC_BUG #ifdef CONFIG_GENERIC_BUG

View File

@ -45,7 +45,7 @@ int is_valid_bugaddr(unsigned long addr)
void do_report_trap(struct pt_regs *regs, int si_signo, int si_code, char *str) void do_report_trap(struct pt_regs *regs, int si_signo, int si_code, char *str)
{ {
if (user_mode(regs)) { if (user_mode(regs)) {
force_sig_fault(si_signo, si_code, get_trap_ip(regs), current); force_sig_fault(si_signo, si_code, get_trap_ip(regs));
report_user_fault(regs, si_signo, 0); report_user_fault(regs, si_signo, 0);
} else { } else {
const struct exception_table_entry *fixup; const struct exception_table_entry *fixup;
@ -79,7 +79,7 @@ void do_per_trap(struct pt_regs *regs)
if (!current->ptrace) if (!current->ptrace)
return; return;
force_sig_fault(SIGTRAP, TRAP_HWBKPT, force_sig_fault(SIGTRAP, TRAP_HWBKPT,
(void __force __user *) current->thread.per_event.address, current); (void __force __user *) current->thread.per_event.address);
} }
NOKPROBE_SYMBOL(do_per_trap); NOKPROBE_SYMBOL(do_per_trap);
@ -165,7 +165,7 @@ void illegal_op(struct pt_regs *regs)
return; return;
if (*((__u16 *) opcode) == S390_BREAKPOINT_U16) { if (*((__u16 *) opcode) == S390_BREAKPOINT_U16) {
if (current->ptrace) if (current->ptrace)
force_sig_fault(SIGTRAP, TRAP_BRKPT, location, current); force_sig_fault(SIGTRAP, TRAP_BRKPT, location);
else else
signal = SIGILL; signal = SIGILL;
#ifdef CONFIG_UPROBES #ifdef CONFIG_UPROBES

View File

@ -243,8 +243,7 @@ static noinline void do_sigsegv(struct pt_regs *regs, int si_code)
{ {
report_user_fault(regs, SIGSEGV, 1); report_user_fault(regs, SIGSEGV, 1);
force_sig_fault(SIGSEGV, si_code, force_sig_fault(SIGSEGV, si_code,
(void __user *)(regs->int_parm_long & __FAIL_ADDR_MASK), (void __user *)(regs->int_parm_long & __FAIL_ADDR_MASK));
current);
} }
const struct exception_table_entry *s390_search_extables(unsigned long addr) const struct exception_table_entry *s390_search_extables(unsigned long addr)
@ -305,8 +304,7 @@ static noinline void do_sigbus(struct pt_regs *regs)
* or user mode. * or user mode.
*/ */
force_sig_fault(SIGBUS, BUS_ADRERR, force_sig_fault(SIGBUS, BUS_ADRERR,
(void __user *)(regs->int_parm_long & __FAIL_ADDR_MASK), (void __user *)(regs->int_parm_long & __FAIL_ADDR_MASK));
current);
} }
static noinline int signal_return(struct pt_regs *regs) static noinline int signal_return(struct pt_regs *regs)

View File

@ -338,7 +338,7 @@ static int __kprobes hw_breakpoint_handler(struct die_args *args)
/* Deliver the signal to userspace */ /* Deliver the signal to userspace */
if (!arch_check_bp_in_kernelspace(&bp->hw.info)) { if (!arch_check_bp_in_kernelspace(&bp->hw.info)) {
force_sig_fault(SIGTRAP, TRAP_HWBKPT, force_sig_fault(SIGTRAP, TRAP_HWBKPT,
(void __user *)NULL, current); (void __user *)NULL);
} }
rcu_read_unlock(); rcu_read_unlock();

View File

@ -533,7 +533,7 @@ uspace_segv:
"access (PC %lx PR %lx)\n", current->comm, regs->pc, "access (PC %lx PR %lx)\n", current->comm, regs->pc,
regs->pr); regs->pr);
force_sig_fault(SIGBUS, si_code, (void __user *)address, current); force_sig_fault(SIGBUS, si_code, (void __user *)address);
} else { } else {
inc_unaligned_kernel_access(); inc_unaligned_kernel_access();
@ -603,7 +603,7 @@ asmlinkage void do_divide_error(unsigned long r4)
/* Let gcc know unhandled cases don't make it past here */ /* Let gcc know unhandled cases don't make it past here */
return; return;
} }
force_sig_fault(SIGFPE, code, NULL, current); force_sig_fault(SIGFPE, code, NULL);
} }
#endif #endif

View File

@ -560,7 +560,7 @@ static int ieee_fpe_handler(struct pt_regs *regs)
task_thread_info(tsk)->status |= TS_USEDFPU; task_thread_info(tsk)->status |= TS_USEDFPU;
} else { } else {
force_sig_fault(SIGFPE, FPE_FLTINV, force_sig_fault(SIGFPE, FPE_FLTINV,
(void __user *)regs->pc, current); (void __user *)regs->pc);
} }
regs->pc = nextpc; regs->pc = nextpc;

View File

@ -41,7 +41,7 @@ static inline int notify_page_fault(struct pt_regs *regs, int trap)
static void static void
force_sig_info_fault(int si_signo, int si_code, unsigned long address) force_sig_info_fault(int si_signo, int si_code, unsigned long address)
{ {
force_sig_fault(si_signo, si_code, (void __user *)address, current); force_sig_fault(si_signo, si_code, (void __user *)address);
} }
/* /*

View File

@ -519,7 +519,7 @@ void synchronize_user_stack(void)
static void stack_unaligned(unsigned long sp) static void stack_unaligned(unsigned long sp)
{ {
force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *) sp, 0, current); force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *) sp, 0);
} }
static const char uwfault32[] = KERN_INFO \ static const char uwfault32[] = KERN_INFO \

View File

@ -151,7 +151,7 @@ sparc_breakpoint (struct pt_regs *regs)
#ifdef DEBUG_SPARC_BREAKPOINT #ifdef DEBUG_SPARC_BREAKPOINT
printk ("TRAP: Entering kernel PC=%x, nPC=%x\n", regs->pc, regs->npc); printk ("TRAP: Entering kernel PC=%x, nPC=%x\n", regs->pc, regs->npc);
#endif #endif
force_sig_fault(SIGTRAP, TRAP_BRKPT, (void __user *)regs->pc, 0, current); force_sig_fault(SIGTRAP, TRAP_BRKPT, (void __user *)regs->pc, 0);
#ifdef DEBUG_SPARC_BREAKPOINT #ifdef DEBUG_SPARC_BREAKPOINT
printk ("TRAP: Returning to space: PC=%x nPC=%x\n", regs->pc, regs->npc); printk ("TRAP: Returning to space: PC=%x nPC=%x\n", regs->pc, regs->npc);

View File

@ -511,7 +511,7 @@ asmlinkage void sparc_breakpoint(struct pt_regs *regs)
#ifdef DEBUG_SPARC_BREAKPOINT #ifdef DEBUG_SPARC_BREAKPOINT
printk ("TRAP: Entering kernel PC=%lx, nPC=%lx\n", regs->tpc, regs->tnpc); printk ("TRAP: Entering kernel PC=%lx, nPC=%lx\n", regs->tpc, regs->tnpc);
#endif #endif
force_sig_fault(SIGTRAP, TRAP_BRKPT, (void __user *)regs->tpc, 0, current); force_sig_fault(SIGTRAP, TRAP_BRKPT, (void __user *)regs->tpc, 0);
#ifdef DEBUG_SPARC_BREAKPOINT #ifdef DEBUG_SPARC_BREAKPOINT
printk ("TRAP: Returning to space: PC=%lx nPC=%lx\n", regs->tpc, regs->tnpc); printk ("TRAP: Returning to space: PC=%lx nPC=%lx\n", regs->tpc, regs->tnpc);
#endif #endif

View File

@ -103,7 +103,7 @@ void do_hw_interrupt(struct pt_regs *regs, unsigned long type)
die_if_kernel("Kernel bad trap", regs); die_if_kernel("Kernel bad trap", regs);
force_sig_fault(SIGILL, ILL_ILLTRP, force_sig_fault(SIGILL, ILL_ILLTRP,
(void __user *)regs->pc, type - 0x80, current); (void __user *)regs->pc, type - 0x80);
} }
void do_illegal_instruction(struct pt_regs *regs, unsigned long pc, unsigned long npc, void do_illegal_instruction(struct pt_regs *regs, unsigned long pc, unsigned long npc,
@ -327,7 +327,7 @@ void handle_reg_access(struct pt_regs *regs, unsigned long pc, unsigned long npc
printk("Register Access Exception at PC %08lx NPC %08lx PSR %08lx\n", printk("Register Access Exception at PC %08lx NPC %08lx PSR %08lx\n",
pc, npc, psr); pc, npc, psr);
#endif #endif
force_sig_fault(SIGBUS, BUS_OBJERR, (void __user *)pc, 0, current); force_sig_fault(SIGBUS, BUS_OBJERR, (void __user *)pc, 0);
} }
void handle_cp_disabled(struct pt_regs *regs, unsigned long pc, unsigned long npc, void handle_cp_disabled(struct pt_regs *regs, unsigned long pc, unsigned long npc,

View File

@ -107,7 +107,7 @@ void bad_trap(struct pt_regs *regs, long lvl)
regs->tnpc &= 0xffffffff; regs->tnpc &= 0xffffffff;
} }
force_sig_fault(SIGILL, ILL_ILLTRP, force_sig_fault(SIGILL, ILL_ILLTRP,
(void __user *)regs->tpc, lvl, current); (void __user *)regs->tpc, lvl);
} }
void bad_trap_tl1(struct pt_regs *regs, long lvl) void bad_trap_tl1(struct pt_regs *regs, long lvl)
@ -201,7 +201,7 @@ void spitfire_insn_access_exception(struct pt_regs *regs, unsigned long sfsr, un
regs->tnpc &= 0xffffffff; regs->tnpc &= 0xffffffff;
} }
force_sig_fault(SIGSEGV, SEGV_MAPERR, force_sig_fault(SIGSEGV, SEGV_MAPERR,
(void __user *)regs->tpc, 0, current); (void __user *)regs->tpc, 0);
out: out:
exception_exit(prev_state); exception_exit(prev_state);
} }
@ -236,7 +236,7 @@ void sun4v_insn_access_exception(struct pt_regs *regs, unsigned long addr, unsig
regs->tpc &= 0xffffffff; regs->tpc &= 0xffffffff;
regs->tnpc &= 0xffffffff; regs->tnpc &= 0xffffffff;
} }
force_sig_fault(SIGSEGV, SEGV_MAPERR, (void __user *) addr, 0, current); force_sig_fault(SIGSEGV, SEGV_MAPERR, (void __user *) addr, 0);
} }
void sun4v_insn_access_exception_tl1(struct pt_regs *regs, unsigned long addr, unsigned long type_ctx) void sun4v_insn_access_exception_tl1(struct pt_regs *regs, unsigned long addr, unsigned long type_ctx)
@ -321,7 +321,7 @@ void spitfire_data_access_exception(struct pt_regs *regs, unsigned long sfsr, un
if (is_no_fault_exception(regs)) if (is_no_fault_exception(regs))
return; return;
force_sig_fault(SIGSEGV, SEGV_MAPERR, (void __user *)sfar, 0, current); force_sig_fault(SIGSEGV, SEGV_MAPERR, (void __user *)sfar, 0);
out: out:
exception_exit(prev_state); exception_exit(prev_state);
} }
@ -385,16 +385,13 @@ void sun4v_data_access_exception(struct pt_regs *regs, unsigned long addr, unsig
*/ */
switch (type) { switch (type) {
case HV_FAULT_TYPE_INV_ASI: case HV_FAULT_TYPE_INV_ASI:
force_sig_fault(SIGILL, ILL_ILLADR, (void __user *)addr, 0, force_sig_fault(SIGILL, ILL_ILLADR, (void __user *)addr, 0);
current);
break; break;
case HV_FAULT_TYPE_MCD_DIS: case HV_FAULT_TYPE_MCD_DIS:
force_sig_fault(SIGSEGV, SEGV_ACCADI, (void __user *)addr, 0, force_sig_fault(SIGSEGV, SEGV_ACCADI, (void __user *)addr, 0);
current);
break; break;
default: default:
force_sig_fault(SIGSEGV, SEGV_MAPERR, (void __user *)addr, 0, force_sig_fault(SIGSEGV, SEGV_MAPERR, (void __user *)addr, 0);
current);
break; break;
} }
} }
@ -571,7 +568,7 @@ static void spitfire_ue_log(unsigned long afsr, unsigned long afar, unsigned lon
regs->tpc &= 0xffffffff; regs->tpc &= 0xffffffff;
regs->tnpc &= 0xffffffff; regs->tnpc &= 0xffffffff;
} }
force_sig_fault(SIGBUS, BUS_OBJERR, (void *)0, 0, current); force_sig_fault(SIGBUS, BUS_OBJERR, (void *)0, 0);
} }
void spitfire_access_error(struct pt_regs *regs, unsigned long status_encoded, unsigned long afar) void spitfire_access_error(struct pt_regs *regs, unsigned long status_encoded, unsigned long afar)
@ -2073,7 +2070,7 @@ void do_mcd_err(struct pt_regs *regs, struct sun4v_error_entry ent)
* code * code
*/ */
force_sig_fault(SIGSEGV, SEGV_ADIDERR, (void __user *)ent.err_raddr, force_sig_fault(SIGSEGV, SEGV_ADIDERR, (void __user *)ent.err_raddr,
0, current); 0);
} }
/* We run with %pil set to PIL_NORMAL_MAX and PSTATE_IE enabled in %pstate. /* We run with %pil set to PIL_NORMAL_MAX and PSTATE_IE enabled in %pstate.
@ -2187,7 +2184,7 @@ bool sun4v_nonresum_error_user_handled(struct pt_regs *regs,
} }
if (attrs & SUN4V_ERR_ATTRS_PIO) { if (attrs & SUN4V_ERR_ATTRS_PIO) {
force_sig_fault(SIGBUS, BUS_ADRERR, force_sig_fault(SIGBUS, BUS_ADRERR,
(void __user *)sun4v_get_vaddr(regs), 0, current); (void __user *)sun4v_get_vaddr(regs), 0);
return true; return true;
} }
@ -2344,7 +2341,7 @@ static void do_fpe_common(struct pt_regs *regs)
code = FPE_FLTRES; code = FPE_FLTRES;
} }
force_sig_fault(SIGFPE, code, force_sig_fault(SIGFPE, code,
(void __user *)regs->tpc, 0, current); (void __user *)regs->tpc, 0);
} }
} }
@ -2399,7 +2396,7 @@ void do_tof(struct pt_regs *regs)
regs->tnpc &= 0xffffffff; regs->tnpc &= 0xffffffff;
} }
force_sig_fault(SIGEMT, EMT_TAGOVF, force_sig_fault(SIGEMT, EMT_TAGOVF,
(void __user *)regs->tpc, 0, current); (void __user *)regs->tpc, 0);
out: out:
exception_exit(prev_state); exception_exit(prev_state);
} }
@ -2419,7 +2416,7 @@ void do_div0(struct pt_regs *regs)
regs->tnpc &= 0xffffffff; regs->tnpc &= 0xffffffff;
} }
force_sig_fault(SIGFPE, FPE_INTDIV, force_sig_fault(SIGFPE, FPE_INTDIV,
(void __user *)regs->tpc, 0, current); (void __user *)regs->tpc, 0);
out: out:
exception_exit(prev_state); exception_exit(prev_state);
} }
@ -2615,7 +2612,7 @@ void do_illegal_instruction(struct pt_regs *regs)
} }
} }
} }
force_sig_fault(SIGILL, ILL_ILLOPC, (void __user *)pc, 0, current); force_sig_fault(SIGILL, ILL_ILLOPC, (void __user *)pc, 0);
out: out:
exception_exit(prev_state); exception_exit(prev_state);
} }
@ -2635,7 +2632,7 @@ void mem_address_unaligned(struct pt_regs *regs, unsigned long sfar, unsigned lo
if (is_no_fault_exception(regs)) if (is_no_fault_exception(regs))
return; return;
force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *)sfar, 0, current); force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *)sfar, 0);
out: out:
exception_exit(prev_state); exception_exit(prev_state);
} }
@ -2653,7 +2650,7 @@ void sun4v_do_mna(struct pt_regs *regs, unsigned long addr, unsigned long type_c
if (is_no_fault_exception(regs)) if (is_no_fault_exception(regs))
return; return;
force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *) addr, 0, current); force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *) addr, 0);
} }
/* sun4v_mem_corrupt_detect_precise() - Handle precise exception on an ADI /* sun4v_mem_corrupt_detect_precise() - Handle precise exception on an ADI
@ -2700,7 +2697,7 @@ void sun4v_mem_corrupt_detect_precise(struct pt_regs *regs, unsigned long addr,
regs->tpc &= 0xffffffff; regs->tpc &= 0xffffffff;
regs->tnpc &= 0xffffffff; regs->tnpc &= 0xffffffff;
} }
force_sig_fault(SIGSEGV, SEGV_ADIPERR, (void __user *)addr, 0, current); force_sig_fault(SIGSEGV, SEGV_ADIPERR, (void __user *)addr, 0);
} }
void do_privop(struct pt_regs *regs) void do_privop(struct pt_regs *regs)
@ -2716,7 +2713,7 @@ void do_privop(struct pt_regs *regs)
regs->tnpc &= 0xffffffff; regs->tnpc &= 0xffffffff;
} }
force_sig_fault(SIGILL, ILL_PRVOPC, force_sig_fault(SIGILL, ILL_PRVOPC,
(void __user *)regs->tpc, 0, current); (void __user *)regs->tpc, 0);
out: out:
exception_exit(prev_state); exception_exit(prev_state);
} }

View File

@ -131,7 +131,7 @@ static void __do_fault_siginfo(int code, int sig, struct pt_regs *regs,
show_signal_msg(regs, sig, code, show_signal_msg(regs, sig, code,
addr, current); addr, current);
force_sig_fault(sig, code, (void __user *) addr, 0, current); force_sig_fault(sig, code, (void __user *) addr, 0);
} }
static unsigned long compute_si_addr(struct pt_regs *regs, int text_fault) static unsigned long compute_si_addr(struct pt_regs *regs, int text_fault)

View File

@ -187,7 +187,7 @@ static void do_fault_siginfo(int code, int sig, struct pt_regs *regs,
if (unlikely(show_unhandled_signals)) if (unlikely(show_unhandled_signals))
show_signal_msg(regs, sig, code, addr, current); show_signal_msg(regs, sig, code, addr, current);
force_sig_fault(sig, code, (void __user *) addr, 0, current); force_sig_fault(sig, code, (void __user *) addr, 0);
} }
static unsigned int get_fault_insn(struct pt_regs *regs, unsigned int insn) static unsigned int get_fault_insn(struct pt_regs *regs, unsigned int insn)

View File

@ -117,8 +117,7 @@ static void send_sigtrap(struct uml_pt_regs *regs, int error_code)
/* Send us the fake SIGTRAP */ /* Send us the fake SIGTRAP */
force_sig_fault(SIGTRAP, TRAP_BRKPT, force_sig_fault(SIGTRAP, TRAP_BRKPT,
/* User-mode eip? */ /* User-mode eip? */
UPT_IS_USER(regs) ? (void __user *) UPT_IP(regs) : NULL, UPT_IS_USER(regs) ? (void __user *) UPT_IP(regs) : NULL);
current);
} }
/* /*

View File

@ -163,8 +163,7 @@ static void show_segv_info(struct uml_pt_regs *regs)
static void bad_segv(struct faultinfo fi, unsigned long ip) static void bad_segv(struct faultinfo fi, unsigned long ip)
{ {
current->thread.arch.faultinfo = fi; current->thread.arch.faultinfo = fi;
force_sig_fault(SIGSEGV, SEGV_ACCERR, (void __user *) FAULT_ADDRESS(fi), force_sig_fault(SIGSEGV, SEGV_ACCERR, (void __user *) FAULT_ADDRESS(fi));
current);
} }
void fatal_sigsegv(void) void fatal_sigsegv(void)
@ -268,13 +267,11 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user,
if (err == -EACCES) { if (err == -EACCES) {
current->thread.arch.faultinfo = fi; current->thread.arch.faultinfo = fi;
force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address, force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address);
current);
} else { } else {
BUG_ON(err != -EFAULT); BUG_ON(err != -EFAULT);
current->thread.arch.faultinfo = fi; current->thread.arch.faultinfo = fi;
force_sig_fault(SIGSEGV, si_code, (void __user *) address, force_sig_fault(SIGSEGV, si_code, (void __user *) address);
current);
} }
out: out:
@ -304,8 +301,7 @@ void relay_signal(int sig, struct siginfo *si, struct uml_pt_regs *regs)
if ((err == 0) && (siginfo_layout(sig, code) == SIL_FAULT)) { if ((err == 0) && (siginfo_layout(sig, code) == SIL_FAULT)) {
struct faultinfo *fi = UPT_FAULTINFO(regs); struct faultinfo *fi = UPT_FAULTINFO(regs);
current->thread.arch.faultinfo = *fi; current->thread.arch.faultinfo = *fi;
force_sig_fault(sig, code, (void __user *)FAULT_ADDRESS(*fi), force_sig_fault(sig, code, (void __user *)FAULT_ADDRESS(*fi));
current);
} else { } else {
printk(KERN_ERR "Attempted to relay unknown signal %d (si_code = %d) with errno %d\n", printk(KERN_ERR "Attempted to relay unknown signal %d (si_code = %d) with errno %d\n",
sig, code, err); sig, code, err);

View File

@ -248,7 +248,7 @@ void uc32_notify_die(const char *str, struct pt_regs *regs,
current->thread.error_code = err; current->thread.error_code = err;
current->thread.trap_no = trap; current->thread.trap_no = trap;
force_sig_fault(sig, code, addr, current); force_sig_fault(sig, code, addr);
} else } else
die(str, regs, err); die(str, regs, err);
} }

View File

@ -124,7 +124,7 @@ static void __do_user_fault(unsigned long addr, unsigned int fsr,
tsk->thread.address = addr; tsk->thread.address = addr;
tsk->thread.error_code = fsr; tsk->thread.error_code = fsr;
tsk->thread.trap_no = 14; 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) void do_bad_area(unsigned long addr, unsigned int fsr, struct pt_regs *regs)

View File

@ -106,7 +106,7 @@ static bool write_ok_or_segv(unsigned long ptr, size_t size)
thread->cr2 = ptr; thread->cr2 = ptr;
thread->trap_nr = X86_TRAP_PF; thread->trap_nr = X86_TRAP_PF;
force_sig_fault(SIGSEGV, SEGV_MAPERR, (void __user *)ptr, current); force_sig_fault(SIGSEGV, SEGV_MAPERR, (void __user *)ptr);
return false; return false;
} else { } else {
return true; return true;

View File

@ -1369,7 +1369,7 @@ void send_sigtrap(struct pt_regs *regs, int error_code, int si_code)
/* Send us the fake SIGTRAP */ /* Send us the fake SIGTRAP */
force_sig_fault(SIGTRAP, si_code, force_sig_fault(SIGTRAP, si_code,
user_mode(regs) ? (void __user *)regs->ip : NULL, current); user_mode(regs) ? (void __user *)regs->ip : NULL);
} }
void user_single_step_report(struct pt_regs *regs) void user_single_step_report(struct pt_regs *regs)

View File

@ -256,7 +256,7 @@ do_trap(int trapnr, int signr, char *str, struct pt_regs *regs,
if (!sicode) if (!sicode)
force_sig(signr); force_sig(signr);
else else
force_sig_fault(signr, sicode, addr, current); force_sig_fault(signr, sicode, addr);
} }
NOKPROBE_SYMBOL(do_trap); NOKPROBE_SYMBOL(do_trap);
@ -856,7 +856,7 @@ static void math_error(struct pt_regs *regs, int error_code, int trapnr)
return; return;
force_sig_fault(SIGFPE, si_code, force_sig_fault(SIGFPE, si_code,
(void __user *)uprobe_get_trap_addr(regs), current); (void __user *)uprobe_get_trap_addr(regs));
} }
dotraplinkage void do_coprocessor_error(struct pt_regs *regs, long error_code) dotraplinkage void do_coprocessor_error(struct pt_regs *regs, long error_code)

View File

@ -277,7 +277,7 @@ static void force_sig_info_umip_fault(void __user *addr, struct pt_regs *regs)
tsk->thread.error_code = X86_PF_USER | X86_PF_WRITE; tsk->thread.error_code = X86_PF_USER | X86_PF_WRITE;
tsk->thread.trap_nr = X86_TRAP_PF; tsk->thread.trap_nr = X86_TRAP_PF;
force_sig_fault(SIGSEGV, SEGV_MAPERR, addr, current); force_sig_fault(SIGSEGV, SEGV_MAPERR, addr);
if (!(show_unhandled_signals && unhandled_signal(tsk, SIGSEGV))) if (!(show_unhandled_signals && unhandled_signal(tsk, SIGSEGV)))
return; return;

View File

@ -756,8 +756,7 @@ no_context(struct pt_regs *regs, unsigned long error_code,
set_signal_archinfo(address, error_code); set_signal_archinfo(address, error_code);
/* XXX: hwpoison faults will set the wrong code. */ /* XXX: hwpoison faults will set the wrong code. */
force_sig_fault(signal, si_code, (void __user *)address, force_sig_fault(signal, si_code, (void __user *)address);
current);
} }
/* /*
@ -918,7 +917,7 @@ __bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code,
if (si_code == SEGV_PKUERR) if (si_code == SEGV_PKUERR)
force_sig_pkuerr((void __user *)address, pkey); force_sig_pkuerr((void __user *)address, pkey);
force_sig_fault(SIGSEGV, si_code, (void __user *)address, current); force_sig_fault(SIGSEGV, si_code, (void __user *)address);
return; return;
} }
@ -1044,7 +1043,7 @@ do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address,
return; return;
} }
#endif #endif
force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address, current); force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address);
} }
static noinline void static noinline void

View File

@ -330,7 +330,7 @@ do_unaligned_user (struct pt_regs *regs)
"(pid = %d, pc = %#010lx)\n", "(pid = %d, pc = %#010lx)\n",
regs->excvaddr, current->comm, regs->excvaddr, current->comm,
task_pid_nr(current), regs->pc); task_pid_nr(current), regs->pc);
force_sig_fault(SIGBUS, BUS_ADRALN, (void *) regs->excvaddr, current); force_sig_fault(SIGBUS, BUS_ADRALN, (void *) regs->excvaddr);
} }
#endif #endif

View File

@ -157,7 +157,7 @@ bad_area:
if (user_mode(regs)) { if (user_mode(regs)) {
current->thread.bad_vaddr = address; current->thread.bad_vaddr = address;
current->thread.error_code = is_write; current->thread.error_code = is_write;
force_sig_fault(SIGSEGV, code, (void *) address, current); force_sig_fault(SIGSEGV, code, (void *) address);
return; return;
} }
bad_page_fault(regs, address, SIGSEGV); bad_page_fault(regs, address, SIGSEGV);
@ -182,7 +182,7 @@ do_sigbus:
* or user mode. * or user mode.
*/ */
current->thread.bad_vaddr = address; current->thread.bad_vaddr = address;
force_sig_fault(SIGBUS, BUS_ADRERR, (void *) address, current); force_sig_fault(SIGBUS, BUS_ADRERR, (void *) address);
/* Kernel mode? Handle exceptions or die */ /* Kernel mode? Handle exceptions or die */
if (!user_mode(regs)) if (!user_mode(regs))

View File

@ -313,8 +313,7 @@ int force_sig_fault_to_task(int sig, int code, void __user *addr
, struct task_struct *t); , struct task_struct *t);
int force_sig_fault(int sig, int code, void __user *addr int force_sig_fault(int sig, int code, void __user *addr
___ARCH_SI_TRAPNO(int trapno) ___ARCH_SI_TRAPNO(int trapno)
___ARCH_SI_IA64(int imm, unsigned int flags, unsigned long isr) ___ARCH_SI_IA64(int imm, unsigned int flags, unsigned long isr));
, struct task_struct *t);
int send_sig_fault(int sig, int code, void __user *addr int send_sig_fault(int sig, int code, void __user *addr
___ARCH_SI_TRAPNO(int trapno) ___ARCH_SI_TRAPNO(int trapno)
___ARCH_SI_IA64(int imm, unsigned int flags, unsigned long isr) ___ARCH_SI_IA64(int imm, unsigned int flags, unsigned long isr)

View File

@ -1645,12 +1645,11 @@ int force_sig_fault_to_task(int sig, int code, void __user *addr
int force_sig_fault(int sig, int code, void __user *addr int force_sig_fault(int sig, int code, void __user *addr
___ARCH_SI_TRAPNO(int trapno) ___ARCH_SI_TRAPNO(int trapno)
___ARCH_SI_IA64(int imm, unsigned int flags, unsigned long isr) ___ARCH_SI_IA64(int imm, unsigned int flags, unsigned long isr))
, struct task_struct *t)
{ {
return force_sig_fault_to_task(sig, code, addr return force_sig_fault_to_task(sig, code, addr
___ARCH_SI_TRAPNO(trapno) ___ARCH_SI_TRAPNO(trapno)
___ARCH_SI_IA64(imm, flags, isr), t); ___ARCH_SI_IA64(imm, flags, isr), current);
} }
int send_sig_fault(int sig, int code, void __user *addr int send_sig_fault(int sig, int code, void __user *addr