From: Ingo Molnar Date: Fri, 12 Feb 2021 12:39:32 +0000 (+0100) Subject: Merge branch 'x86/cleanups' into x86/mm X-Git-Tag: accepted/tizen/unified/20230118.172025~7887^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=40c1fa52cdb7c13ef88232e374b4b8ac8d820c4f;p=platform%2Fkernel%2Flinux-rpi.git Merge branch 'x86/cleanups' into x86/mm Merge recent cleanups to the x86 MM code to resolve a conflict. Conflicts: arch/x86/mm/fault.c Signed-off-by: Ingo Molnar --- 40c1fa52cdb7c13ef88232e374b4b8ac8d820c4f diff --cc arch/x86/mm/fault.c index 7b3a125,106b22d..5251973 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c @@@ -1434,39 -1384,10 +1406,37 @@@ good_area } mmap_read_unlock(mm); - if (unlikely(fault & VM_FAULT_ERROR)) { - mm_fault_error(regs, hw_error_code, address, fault); + if (likely(!(fault & VM_FAULT_ERROR))) + return; + + if (fatal_signal_pending(current) && !user_mode(regs)) { + 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)) { + kernelmode_fixup_or_oops(regs, error_code, address, + SIGSEGV, SEGV_MAPERR); + return; + } + + /* + * We ran out of memory, call the OOM killer, and return the + * userspace (which will retry the fault, or kill us if we got + * oom-killed): + */ + pagefault_out_of_memory(); + } else { + if (fault & (VM_FAULT_SIGBUS|VM_FAULT_HWPOISON| + VM_FAULT_HWPOISON_LARGE)) + do_sigbus(regs, error_code, address, fault); + else if (fault & VM_FAULT_SIGSEGV) + bad_area_nosemaphore(regs, error_code, address); + else + BUG(); + } - - check_v8086_mode(regs, address, tsk); } NOKPROBE_SYMBOL(do_user_addr_fault);