linux/arch/x86/kernel
Jann Horn e3e4d5019c x86/kprobes: Stop calling fixup_exception() from kprobe_fault_handler()
This removes the call into exception fixup that was added in commit
c28f896634 ("[PATCH] kprobes: fix broken fault handling for x86_64").

On X86, kprobe_fault_handler() is called from two places:
do_general_protection() (for #GP) and kprobes_fault() (for #PF).  In both
paths, the fixup_exception() call in the kprobe fault handler is redundant.

In case of #GP, fixup_exception() is called immediately before
kprobe_fault_handler() is invoked, so no need to try that again. This
assumes that the kprobe's fault handler isn't going to do something crazy
like changing RIP so that it suddenly points to an instruction that does
userspace access.

For #PF on a kernel address from kernel space, after the kprobe fault
handler has run, no_context() is invoked, which calls fixup_exception().

Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Kees Cook <keescook@chromium.org>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: kernel-hardening@lists.openwall.com
Cc: linux-kernel@vger.kernel.org
Cc: dvyukov@google.com
Cc: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org
Cc: Borislav Petkov <bp@alien8.de>
Link: https://lkml.kernel.org/r/20180828201421.157735-4-jannh@google.com
2018-09-03 15:12:08 +02:00
..
acpi x86/ACPI/cstate: Make APCI C1 FFH MWAIT C-state description vendor-neutral 2018-08-15 00:19:38 +02:00
apic x86/smp: fix non-SMP broken build due to redefinition of apic_id_is_primary_thread 2018-08-14 15:00:00 -07:00
cpu x86/speculation/l1tf: Increase l1tf memory limit for Nehalem+ 2018-08-27 10:29:14 +02:00
fpu x86: Don't include linux/irq.h from asm/hardirq.h 2018-08-05 09:53:13 +02:00
kprobes x86/kprobes: Stop calling fixup_exception() from kprobe_fault_handler() 2018-09-03 15:12:08 +02:00
.gitignore
alternative.c x86/alternatives: Lockdep-enforce text_mutex in text_poke*() 2018-08-30 13:02:30 +02:00
amd_gart_64.c x86/dma/amd_gart: Use dma_direct_{alloc,free}() 2018-03-20 10:01:57 +01:00
amd_nb.c x86/amd_nb: Add support for Raven Ridge CPUs 2018-05-13 09:00:27 -07:00
apb_timer.c
aperture_64.c
apm_32.c x86/apm: Don't access __preempt_count with zeroed fs 2018-07-16 17:59:57 +02:00
asm-offsets_32.c x86/entry/32: Load task stack from x86_tss.sp1 in SYSENTER handler 2018-07-20 01:11:36 +02:00
asm-offsets_64.c x86/asm-offsets: Move TSS_sp0 and TSS_sp1 to asm-offsets.c 2018-07-20 01:11:35 +02:00
asm-offsets.c x86/entry/32: Enter the kernel via trampoline stack 2018-07-20 01:11:37 +02:00
audit_64.c
bootflag.c
check.c
cpuid.c x86/cpuid: Allow cpuid_read() to schedule 2018-03-27 12:01:48 +02:00
crash_dump_32.c
crash_dump_64.c
crash.c kexec_file, x86: move re-factored code to generic side 2018-04-13 17:10:27 -07:00
devicetree.c Merge branch 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2018-04-02 16:15:32 -07:00
doublefault.c
dumpstack_32.c
dumpstack_64.c
dumpstack.c x86/dumpstack: Don't dump kernel memory based on usermode RIP 2018-08-31 17:08:22 +02:00
e820.c x86/e820: put !E820_TYPE_RAM regions into memblock.reserved 2018-06-28 11:16:44 -07:00
early_printk.c
early-quirks.c On GEM side: 2018-07-20 12:29:24 +10:00
ebda.c
eisa.c
espfix_64.c x86/espfix: Document use of _PAGE_GLOBAL 2018-04-09 18:27:33 +02:00
ftrace_32.S
ftrace_64.S
ftrace.c
head32.c
head64.c Revert "x86/mm: Mark __pgtable_l5_enabled __initdata" 2018-06-23 14:20:37 +02:00
head_32.S x86/pgtable/32: Allocate 8k page-tables when PTI is enabled 2018-07-20 01:11:41 +02:00
head_64.S x86/asm/64: Use 32-bit XOR to zero registers 2018-07-03 09:59:29 +02:00
hpet.c x86: Don't include linux/irq.h from asm/hardirq.h 2018-08-05 09:53:13 +02:00
hw_breakpoint.c perf/arch/x86: Implement hw_breakpoint_arch_parse() 2018-06-26 09:07:55 +02:00
i8237.c x86/i8237: Register device based on FADT legacy boot flag 2018-04-27 16:44:29 +02:00
i8253.c
i8259.c x86: Don't include linux/irq.h from asm/hardirq.h 2018-08-05 09:53:13 +02:00
idt.c x86: Don't include linux/irq.h from asm/hardirq.h 2018-08-05 09:53:13 +02:00
io_delay.c
ioport.c x86/ioport: add ksys_ioperm() helper; remove in-kernel calls to sys_ioperm() 2018-04-02 20:16:12 +02:00
irq_32.c x86: Don't include linux/irq.h from asm/hardirq.h 2018-08-05 09:53:13 +02:00
irq_64.c x86: Don't include linux/irq.h from asm/hardirq.h 2018-08-05 09:53:13 +02:00
irq_work.c
irq.c x86: Don't include linux/irq.h from asm/hardirq.h 2018-08-05 09:53:13 +02:00
irqflags.S x86/paravirt: Make native_save_fl() extern inline 2018-07-03 10:56:27 +02:00
irqinit.c x86: Don't include linux/irq.h from asm/hardirq.h 2018-08-05 09:53:13 +02:00
itmt.c
jailhouse.c x86: Convert x86_platform_ops to timespec64 2018-05-19 14:03:14 +02:00
jump_label.c x86/alternatives, jumplabel: Use text_poke_early() before mm_init() 2018-07-20 00:02:38 +02:00
kdebugfs.c
kexec-bzimage64.c Fix kexec forbidding kernels signed with keys in the secondary keyring to boot 2018-08-16 09:57:20 -07:00
kgdb.c
ksysfs.c treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00
kvm.c x86/mm: Only use tlb_remove_table() for paravirt 2018-08-23 11:56:31 -07:00
kvmclock.c Merge branch 'l1tf-final' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2018-08-14 09:46:06 -07:00
ldt.c x86/ldt: Enable LDT user-mapping for PAE 2018-07-20 01:11:48 +02:00
livepatch.c
machine_kexec_32.c x86/kexec: Allocate 8k PGDs for PTI 2018-07-30 13:53:48 +02:00
machine_kexec_64.c x86/mm: Stop pretending pgtable_l5_enabled is a variable 2018-05-19 11:56:57 +02:00
Makefile x86/paravirt: Make native_save_fl() extern inline 2018-07-03 10:56:27 +02:00
mmconf-fam10h_64.c
module.c
mpparse.c
msr.c
nmi_selftest.c
nmi.c
paravirt_patch_32.c
paravirt_patch_64.c x86/asm/64: Use 32-bit XOR to zero registers 2018-07-03 09:59:29 +02:00
paravirt-spinlocks.c
paravirt.c x86/mm: Only use tlb_remove_table() for paravirt 2018-08-23 11:56:31 -07:00
pci-calgary_64.c x86/dma: Remove dma_alloc_coherent_gfp_flags() 2018-03-20 10:01:58 +01:00
pci-dma.c IOMMU Update for Linux v4.19 2018-08-24 13:10:38 -07:00
pci-iommu_table.c x86/iommu: Use NULL instead of 0 2018-08-02 14:33:19 +02:00
pci-swiotlb.c x86/dma: Use generic swiotlb_ops 2018-03-20 10:01:57 +01:00
pcspeaker.c x86/platform/pcspeaker: Use PTR_ERR_OR_ZERO() to fix ptr_ret.cocci warning 2018-07-24 09:46:42 +02:00
perf_regs.c perf/x86: Store user space frame-pointer value on a sample 2018-05-25 08:11:12 +02:00
platform-quirks.c x86/i8237: Register device based on FADT legacy boot flag 2018-04-27 16:44:29 +02:00
pmem.c
probe_roms.c
process_32.c x86/entry: Rename update_sp0 to update_task_stack 2018-07-20 01:11:40 +02:00
process_64.c x86/process: Re-export start_thread() 2018-08-20 18:04:42 +02:00
process.c x86/entry/32: Enter the kernel via trampoline stack 2018-07-20 01:11:37 +02:00
ptrace.c signal: Ensure every siginfo we send has all bits initialized 2018-04-25 10:40:51 -05:00
pvclock.c x86: Convert x86_platform_ops to timespec64 2018-05-19 14:03:14 +02:00
quirks.c x86/mce: Check for alternate indication of machine check recovery on Skylake 2018-06-07 22:22:12 +02:00
reboot_fixups_32.c
reboot.c
relocate_kernel_32.S
relocate_kernel_64.S
resource.c
rtc.c x86: Convert x86_platform_ops to timespec64 2018-05-19 14:03:14 +02:00
setup_percpu.c
setup.c pci-v4.19-changes 2018-08-16 09:21:54 -07:00
signal_compat.c signal: Add TRAP_UNK si_code for undiagnosted trap exceptions 2018-04-25 10:40:56 -05:00
signal.c rseq: Avoid infinite recursion when delivering SIGSEGV 2018-06-22 19:04:22 +02:00
smp.c x86/irq: Let interrupt handlers set kvm_cpu_l1tf_flush_l1d 2018-08-05 09:53:13 +02:00
smpboot.c Merge 4.18-rc7 into master to pick up the KVM dependcy 2018-08-05 16:39:29 +02:00
stacktrace.c x86/stacktrace: Do not fail for ORC with regs on stack 2018-06-21 16:34:56 +02:00
step.c
sys_x86_64.c compat: Move compat_timespec/ timeval to compat_time.h 2018-04-19 13:29:54 +02:00
sysfb_efi.c
sysfb_simplefb.c
sysfb.c
tboot.c
tce_64.c
time.c x86: Don't include linux/irq.h from asm/hardirq.h 2018-08-05 09:53:13 +02:00
tls.c
tls.h
topology.c
trace_clock.c
tracepoint.c
traps.c x86/kprobes: Inline kprobe_exceptions_notify() into do_general_protection() 2018-09-03 15:12:08 +02:00
tsc_msr.c x86/platform/intel-mid: Remove custom TSC calibration 2018-07-03 13:08:21 +02:00
tsc_sync.c
tsc.c x86/tsc: Consolidate init code 2018-07-30 19:33:35 +02:00
umip.c signal: Ensure every siginfo we send has all bits initialized 2018-04-25 10:40:51 -05:00
unwind_frame.c
unwind_guess.c
unwind_orc.c x86/unwind/orc: Detect the end of the stack 2018-06-21 16:34:56 +02:00
uprobes.c uprobes/x86: Remove incorrect WARN_ON() in uprobe_init_insn() 2018-06-21 17:11:02 +02:00
verify_cpu.S
vm86_32.c x86/entry: Rename update_sp0 to update_task_stack 2018-07-20 01:11:40 +02:00
vmlinux.lds.S x86/mm/pti: Make pti_clone_kernel_text() compile on 32 bit 2018-07-20 01:11:44 +02:00
vsmp_64.c
x86_init.c x86/tsc: Make use of tsc_calibrate_cpu_early() 2018-07-20 00:02:44 +02:00