}
static noinline void
-no_context(struct pt_regs *regs, unsigned long error_code,
- unsigned long address, int signal, int si_code)
+kernelmode_fixup_or_oops(struct pt_regs *regs, unsigned long error_code,
+ unsigned long address, int signal, int si_code)
{
- if (user_mode(regs)) {
- /*
- * This is an implicit supervisor-mode access from user
- * mode. Bypass all the kernel-mode recovery code and just
- * OOPS.
- */
- goto oops;
- }
+ WARN_ON_ONCE(user_mode(regs));
/* Are we prepared to handle this kernel fault? */
if (fixup_exception(regs, X86_TRAP_PF, error_code, address)) {
if (is_prefetch(regs, error_code, address))
return;
-oops:
page_fault_oops(regs, error_code, address);
}
struct task_struct *tsk = current;
if (!user_mode(regs)) {
- no_context(regs, error_code, address, pkey, si_code);
+ kernelmode_fixup_or_oops(regs, error_code, address, pkey, si_code);
return;
}
{
/* Kernel mode? Handle exceptions or die: */
if (!user_mode(regs)) {
- no_context(regs, error_code, address, SIGBUS, BUS_ADRERR);
+ kernelmode_fixup_or_oops(regs, error_code, address, SIGBUS, BUS_ADRERR);
return;
}
* has unlocked the mm for us if we get here.
*/
if (!user_mode(regs))
- no_context(regs, error_code, address, SIGBUS,
- BUS_ADRERR);
+ kernelmode_fixup_or_oops(regs, error_code, address,
+ SIGBUS, BUS_ADRERR);
return;
}
return;
if (fatal_signal_pending(current) && !user_mode(regs)) {
- no_context(regs, error_code, address, 0, 0);
+ kernelmode_fixup_or_oops(regs, error_code, address, 0, 0);
return;
}
if (fault & VM_FAULT_OOM) {
/* Kernel mode? Handle exceptions or die: */
if (!user_mode(regs)) {
- no_context(regs, error_code, address,
- SIGSEGV, SEGV_MAPERR);
+ kernelmode_fixup_or_oops(regs, error_code, address,
+ SIGSEGV, SEGV_MAPERR);
return;
}