fault.c (29ec39fcf11e4583eb8d5174f756ea109c77cc44) fault.c (36ef159f4408b08eae7f2af6d62bedd3f4343758)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * PowerPC version
4 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
5 *
6 * Derived from "arch/i386/mm/fault.c"
7 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
8 *

--- 21 unchanged lines hidden (view full) ---

30#include <linux/perf_event.h>
31#include <linux/ratelimit.h>
32#include <linux/context_tracking.h>
33#include <linux/hugetlb.h>
34#include <linux/uaccess.h>
35#include <linux/kfence.h>
36#include <linux/pkeys.h>
37
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * PowerPC version
4 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
5 *
6 * Derived from "arch/i386/mm/fault.c"
7 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
8 *

--- 21 unchanged lines hidden (view full) ---

30#include <linux/perf_event.h>
31#include <linux/ratelimit.h>
32#include <linux/context_tracking.h>
33#include <linux/hugetlb.h>
34#include <linux/uaccess.h>
35#include <linux/kfence.h>
36#include <linux/pkeys.h>
37
38#include <asm/asm-prototypes.h>
39#include <asm/firmware.h>
40#include <asm/interrupt.h>
41#include <asm/page.h>
42#include <asm/mmu.h>
43#include <asm/mmu_context.h>
44#include <asm/siginfo.h>
45#include <asm/debug.h>
46#include <asm/kup.h>

--- 465 unchanged lines hidden (view full) ---

512 if (fault_signal_pending(fault, regs))
513 return user_mode(regs) ? 0 : SIGBUS;
514
515 /*
516 * Handle the retry right now, the mmap_lock has been released in that
517 * case.
518 */
519 if (unlikely(fault & VM_FAULT_RETRY)) {
38#include <asm/firmware.h>
39#include <asm/interrupt.h>
40#include <asm/page.h>
41#include <asm/mmu.h>
42#include <asm/mmu_context.h>
43#include <asm/siginfo.h>
44#include <asm/debug.h>
45#include <asm/kup.h>

--- 465 unchanged lines hidden (view full) ---

511 if (fault_signal_pending(fault, regs))
512 return user_mode(regs) ? 0 : SIGBUS;
513
514 /*
515 * Handle the retry right now, the mmap_lock has been released in that
516 * case.
517 */
518 if (unlikely(fault & VM_FAULT_RETRY)) {
520 if (flags & FAULT_FLAG_ALLOW_RETRY) {
521 flags |= FAULT_FLAG_TRIED;
522 goto retry;
523 }
519 flags |= FAULT_FLAG_TRIED;
520 goto retry;
524 }
525
526 mmap_read_unlock(current->mm);
527
528 if (unlikely(fault & VM_FAULT_ERROR))
529 return mm_fault_error(regs, address, fault);
530
531 /*

--- 84 unchanged lines hidden (view full) ---

616 __bad_page_fault(regs, sig);
617}
618
619#ifdef CONFIG_PPC_BOOK3S_64
620DEFINE_INTERRUPT_HANDLER(do_bad_page_fault_segv)
621{
622 bad_page_fault(regs, SIGSEGV);
623}
521 }
522
523 mmap_read_unlock(current->mm);
524
525 if (unlikely(fault & VM_FAULT_ERROR))
526 return mm_fault_error(regs, address, fault);
527
528 /*

--- 84 unchanged lines hidden (view full) ---

613 __bad_page_fault(regs, sig);
614}
615
616#ifdef CONFIG_PPC_BOOK3S_64
617DEFINE_INTERRUPT_HANDLER(do_bad_page_fault_segv)
618{
619 bad_page_fault(regs, SIGSEGV);
620}
624
625/*
626 * In radix, segment interrupts indicate the EA is not addressable by the
627 * page table geometry, so they are always sent here.
628 *
629 * In hash, this is called if do_slb_fault returns error. Typically it is
630 * because the EA was outside the region allowed by software.
631 */
632DEFINE_INTERRUPT_HANDLER(do_bad_segment_interrupt)
633{
634 int err = regs->result;
635
636 if (err == -EFAULT) {
637 if (user_mode(regs))
638 _exception(SIGSEGV, regs, SEGV_BNDERR, regs->dar);
639 else
640 bad_page_fault(regs, SIGSEGV);
641 } else if (err == -EINVAL) {
642 unrecoverable_exception(regs);
643 } else {
644 BUG();
645 }
646}
647#endif
621#endif