|
@@ -626,7 +626,7 @@ pgtable_bad(struct pt_regs *regs, unsigned long error_code,
|
|
|
|
|
|
static noinline void
|
|
static noinline void
|
|
no_context(struct pt_regs *regs, unsigned long error_code,
|
|
no_context(struct pt_regs *regs, unsigned long error_code,
|
|
- unsigned long address)
|
|
|
|
|
|
+ unsigned long address, int signal, int si_code)
|
|
{
|
|
{
|
|
struct task_struct *tsk = current;
|
|
struct task_struct *tsk = current;
|
|
unsigned long *stackend;
|
|
unsigned long *stackend;
|
|
@@ -634,8 +634,17 @@ no_context(struct pt_regs *regs, unsigned long error_code,
|
|
int sig;
|
|
int sig;
|
|
|
|
|
|
/* Are we prepared to handle this kernel fault? */
|
|
/* Are we prepared to handle this kernel fault? */
|
|
- if (fixup_exception(regs))
|
|
|
|
|
|
+ if (fixup_exception(regs)) {
|
|
|
|
+ if (current_thread_info()->sig_on_uaccess_error && signal) {
|
|
|
|
+ tsk->thread.trap_no = 14;
|
|
|
|
+ tsk->thread.error_code = error_code | PF_USER;
|
|
|
|
+ tsk->thread.cr2 = address;
|
|
|
|
+
|
|
|
|
+ /* XXX: hwpoison faults will set the wrong code. */
|
|
|
|
+ force_sig_info_fault(signal, si_code, address, tsk, 0);
|
|
|
|
+ }
|
|
return;
|
|
return;
|
|
|
|
+ }
|
|
|
|
|
|
/*
|
|
/*
|
|
* 32-bit:
|
|
* 32-bit:
|
|
@@ -755,7 +764,7 @@ __bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code,
|
|
if (is_f00f_bug(regs, address))
|
|
if (is_f00f_bug(regs, address))
|
|
return;
|
|
return;
|
|
|
|
|
|
- no_context(regs, error_code, address);
|
|
|
|
|
|
+ no_context(regs, error_code, address, SIGSEGV, si_code);
|
|
}
|
|
}
|
|
|
|
|
|
static noinline void
|
|
static noinline void
|
|
@@ -819,7 +828,7 @@ do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address,
|
|
|
|
|
|
/* Kernel mode? Handle exceptions or die: */
|
|
/* Kernel mode? Handle exceptions or die: */
|
|
if (!(error_code & PF_USER)) {
|
|
if (!(error_code & PF_USER)) {
|
|
- no_context(regs, error_code, address);
|
|
|
|
|
|
+ no_context(regs, error_code, address, SIGBUS, BUS_ADRERR);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -854,7 +863,7 @@ mm_fault_error(struct pt_regs *regs, unsigned long error_code,
|
|
if (!(fault & VM_FAULT_RETRY))
|
|
if (!(fault & VM_FAULT_RETRY))
|
|
up_read(¤t->mm->mmap_sem);
|
|
up_read(¤t->mm->mmap_sem);
|
|
if (!(error_code & PF_USER))
|
|
if (!(error_code & PF_USER))
|
|
- no_context(regs, error_code, address);
|
|
|
|
|
|
+ no_context(regs, error_code, address, 0, 0);
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|
|
if (!(fault & VM_FAULT_ERROR))
|
|
if (!(fault & VM_FAULT_ERROR))
|
|
@@ -864,7 +873,8 @@ mm_fault_error(struct pt_regs *regs, unsigned long error_code,
|
|
/* Kernel mode? Handle exceptions or die: */
|
|
/* Kernel mode? Handle exceptions or die: */
|
|
if (!(error_code & PF_USER)) {
|
|
if (!(error_code & PF_USER)) {
|
|
up_read(¤t->mm->mmap_sem);
|
|
up_read(¤t->mm->mmap_sem);
|
|
- no_context(regs, error_code, address);
|
|
|
|
|
|
+ no_context(regs, error_code, address,
|
|
|
|
+ SIGSEGV, SEGV_MAPERR);
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
|