fault.c (0db5e0223035b2c84e6186831fc27511270af812) fault.c (d44f1b8dd7e66d80cc4205809e5ace866bd851da)
1/*
2 * Based on arch/arm/mm/fault.c
3 *
4 * Copyright (C) 1995 Linus Torvalds
5 * Copyright (C) 1995-2004 Russell King
6 * Copyright (C) 2012 ARM Ltd.
7 *
8 * This program is free software; you can redistribute it and/or modify

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

13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
1/*
2 * Based on arch/arm/mm/fault.c
3 *
4 * Copyright (C) 1995 Linus Torvalds
5 * Copyright (C) 1995-2004 Russell King
6 * Copyright (C) 2012 ARM Ltd.
7 *
8 * This program is free software; you can redistribute it and/or modify

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

13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#include <linux/acpi.h>
21#include <linux/extable.h>
22#include <linux/signal.h>
23#include <linux/mm.h>
24#include <linux/hardirq.h>
25#include <linux/init.h>
26#include <linux/kprobes.h>
27#include <linux/uaccess.h>
28#include <linux/page-flags.h>
29#include <linux/sched/signal.h>
30#include <linux/sched/debug.h>
31#include <linux/highmem.h>
32#include <linux/perf_event.h>
33#include <linux/preempt.h>
34#include <linux/hugetlb.h>
35
22#include <linux/extable.h>
23#include <linux/signal.h>
24#include <linux/mm.h>
25#include <linux/hardirq.h>
26#include <linux/init.h>
27#include <linux/kprobes.h>
28#include <linux/uaccess.h>
29#include <linux/page-flags.h>
30#include <linux/sched/signal.h>
31#include <linux/sched/debug.h>
32#include <linux/highmem.h>
33#include <linux/perf_event.h>
34#include <linux/preempt.h>
35#include <linux/hugetlb.h>
36
37#include <asm/acpi.h>
36#include <asm/bug.h>
37#include <asm/cmpxchg.h>
38#include <asm/cpufeature.h>
39#include <asm/exception.h>
40#include <asm/daifflags.h>
41#include <asm/debug-monitors.h>
42#include <asm/esr.h>
43#include <asm/kasan.h>
44#include <asm/sysreg.h>
45#include <asm/system_misc.h>
46#include <asm/pgtable.h>
47#include <asm/tlbflush.h>
48#include <asm/traps.h>
49
38#include <asm/bug.h>
39#include <asm/cmpxchg.h>
40#include <asm/cpufeature.h>
41#include <asm/exception.h>
42#include <asm/daifflags.h>
43#include <asm/debug-monitors.h>
44#include <asm/esr.h>
45#include <asm/kasan.h>
46#include <asm/sysreg.h>
47#include <asm/system_misc.h>
48#include <asm/pgtable.h>
49#include <asm/tlbflush.h>
50#include <asm/traps.h>
51
50#include <acpi/ghes.h>
51
52struct fault_info {
53 int (*fn)(unsigned long addr, unsigned int esr,
54 struct pt_regs *regs);
55 int sig;
56 int code;
57 const char *name;
58};
59

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

638static int do_sea(unsigned long addr, unsigned int esr, struct pt_regs *regs)
639{
640 const struct fault_info *inf;
641 void __user *siaddr;
642
643 inf = esr_to_fault_info(esr);
644
645 /*
52struct fault_info {
53 int (*fn)(unsigned long addr, unsigned int esr,
54 struct pt_regs *regs);
55 int sig;
56 int code;
57 const char *name;
58};
59

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

638static int do_sea(unsigned long addr, unsigned int esr, struct pt_regs *regs)
639{
640 const struct fault_info *inf;
641 void __user *siaddr;
642
643 inf = esr_to_fault_info(esr);
644
645 /*
646 * Synchronous aborts may interrupt code which had interrupts masked.
647 * Before calling out into the wider kernel tell the interested
648 * subsystems.
646 * Return value ignored as we rely on signal merging.
647 * Future patches will make this more robust.
649 */
648 */
650 if (IS_ENABLED(CONFIG_ACPI_APEI_SEA)) {
651 if (interrupts_enabled(regs))
652 nmi_enter();
649 apei_claim_sea(regs);
653
650
654 ghes_notify_sea();
655
656 if (interrupts_enabled(regs))
657 nmi_exit();
658 }
659
660 if (esr & ESR_ELx_FnV)
661 siaddr = NULL;
662 else
663 siaddr = (void __user *)addr;
664 arm64_notify_die(inf->name, regs, inf->sig, inf->code, siaddr, esr);
665
666 return 0;
667}

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

728 { do_bad, SIGKILL, SI_KERNEL, "unknown 58" },
729 { do_bad, SIGKILL, SI_KERNEL, "unknown 59" },
730 { do_bad, SIGKILL, SI_KERNEL, "unknown 60" },
731 { do_bad, SIGKILL, SI_KERNEL, "section domain fault" },
732 { do_bad, SIGKILL, SI_KERNEL, "page domain fault" },
733 { do_bad, SIGKILL, SI_KERNEL, "unknown 63" },
734};
735
651 if (esr & ESR_ELx_FnV)
652 siaddr = NULL;
653 else
654 siaddr = (void __user *)addr;
655 arm64_notify_die(inf->name, regs, inf->sig, inf->code, siaddr, esr);
656
657 return 0;
658}

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

719 { do_bad, SIGKILL, SI_KERNEL, "unknown 58" },
720 { do_bad, SIGKILL, SI_KERNEL, "unknown 59" },
721 { do_bad, SIGKILL, SI_KERNEL, "unknown 60" },
722 { do_bad, SIGKILL, SI_KERNEL, "section domain fault" },
723 { do_bad, SIGKILL, SI_KERNEL, "page domain fault" },
724 { do_bad, SIGKILL, SI_KERNEL, "unknown 63" },
725};
726
736int kvm_handle_guest_sea(phys_addr_t addr, unsigned int esr)
737{
738 return ghes_notify_sea();
739}
740
741asmlinkage void __exception do_mem_abort(unsigned long addr, unsigned int esr,
742 struct pt_regs *regs)
743{
744 const struct fault_info *inf = esr_to_fault_info(esr);
745
746 if (!inf->fn(addr, esr, regs))
747 return;
748

--- 109 unchanged lines hidden ---
727asmlinkage void __exception do_mem_abort(unsigned long addr, unsigned int esr,
728 struct pt_regs *regs)
729{
730 const struct fault_info *inf = esr_to_fault_info(esr);
731
732 if (!inf->fn(addr, esr, regs))
733 return;
734

--- 109 unchanged lines hidden ---