diff --git a/patches.suse/x86-kprobes-restore-btf-if-the-single-stepping-is-cancelled.patch b/patches.suse/x86-kprobes-restore-btf-if-the-single-stepping-is-cancelled.patch new file mode 100644 index 0000000..43755bd --- /dev/null +++ b/patches.suse/x86-kprobes-restore-btf-if-the-single-stepping-is-cancelled.patch @@ -0,0 +1,43 @@ +From: Masami Hiramatsu +Date: Wed, 28 Oct 2020 23:31:10 +0900 +Subject: x86/kprobes: Restore BTF if the single-stepping is cancelled +Git-commit: 78ff2733ff352175eb7f4418a34654346e1b6cd2 +Patch-mainline: v5.11-rc1 +References: git-fixes + +Fix to restore BTF if single-stepping causes a page fault and +it is cancelled. + +Usually the BTF flag was restored when the single stepping is done +(in resume_execution()). However, if a page fault happens on the +single stepping instruction, the fault handler is invoked and +the single stepping is cancelled. Thus, the BTF flag is not +restored. + +Fixes: 1ecc798c6764 ("x86: debugctlmsr kprobes") +Signed-off-by: Masami Hiramatsu +Signed-off-by: Peter Zijlstra (Intel) +Link: https://lkml.kernel.org/r/160389546985.106936.12727996109376240993.stgit@devnote2 + +Acked-by: Nikolay Borisov +--- + arch/x86/kernel/kprobes/core.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c +index 547c7abb39f5..39f7d8c3c064 100644 +--- a/arch/x86/kernel/kprobes/core.c ++++ b/arch/x86/kernel/kprobes/core.c +@@ -937,6 +937,11 @@ int kprobe_fault_handler(struct pt_regs *regs, int trapnr) + * So clear it by resetting the current kprobe: + */ + regs->flags &= ~X86_EFLAGS_TF; ++ /* ++ * Since the single step (trap) has been cancelled, ++ * we need to restore BTF here. ++ */ ++ restore_btf(); + + /* + * If the TF flag was set before the kprobe hit, + diff --git a/series.conf b/series.conf index 6f6023b..b481b1b 100644 --- a/series.conf +++ b/series.conf @@ -59087,6 +59087,7 @@ patches.suse/x86-mm-ident_map-check-for-errors-from-ident_pud_init.patch patches.suse/s390-cio-fix-use-after-free-in-ccw_device_destroy_console patches.suse/s390-smp-perform-initial-cpu-reset-also-for-smt-siblings + patches.suse/x86-kprobes-restore-btf-if-the-single-stepping-is-cancelled.patch patches.suse/x86-apic-Fix-x2apic-enablement-without-interrupt-rem.patch patches.suse/x86-msi-Only-use-high-bits-of-MSI-address-for-DMAR-u.patch patches.suse/x86-ioapic-Handle-Extended-Destination-ID-field-in-R.patch