1b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0 21d18c47cSCatalin Marinas /* 31d18c47cSCatalin Marinas * Based on arch/arm/mm/extable.c 41d18c47cSCatalin Marinas */ 51d18c47cSCatalin Marinas 60edfa839SPaul Gortmaker #include <linux/extable.h> 71d18c47cSCatalin Marinas #include <linux/uaccess.h> 81d18c47cSCatalin Marinas 91d18c47cSCatalin Marinas int fixup_exception(struct pt_regs *regs) 101d18c47cSCatalin Marinas { 111d18c47cSCatalin Marinas const struct exception_table_entry *fixup; 121d18c47cSCatalin Marinas 131d18c47cSCatalin Marinas fixup = search_exception_tables(instruction_pointer(regs)); 14*80083428SJean-Philippe Brucker if (!fixup) 15*80083428SJean-Philippe Brucker return 0; 161d18c47cSCatalin Marinas 17*80083428SJean-Philippe Brucker if (IS_ENABLED(CONFIG_BPF_JIT) && 18*80083428SJean-Philippe Brucker regs->pc >= BPF_JIT_REGION_START && 19*80083428SJean-Philippe Brucker regs->pc < BPF_JIT_REGION_END) 20*80083428SJean-Philippe Brucker return arm64_bpf_fixup_exception(fixup, regs); 21*80083428SJean-Philippe Brucker 22*80083428SJean-Philippe Brucker regs->pc = (unsigned long)&fixup->fixup + fixup->fixup; 23*80083428SJean-Philippe Brucker return 1; 241d18c47cSCatalin Marinas } 25