This is a note to let you know that I've just added the patch titled

    x86: kprobes: Prohibit probing on instruction which has emulate prefix

to the 5.4-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     x86-kprobes-prohibit-probing-on-instruction-which-has-emulate-prefix.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <sta...@vger.kernel.org> know about it.


>From 004e8dce9c5595697951f7cd0e9f66b35c92265e Mon Sep 17 00:00:00 2001
From: Masami Hiramatsu <mhira...@kernel.org>
Date: Fri, 6 Sep 2019 22:14:20 +0900
Subject: x86: kprobes: Prohibit probing on instruction which has emulate prefix

From: Masami Hiramatsu <mhira...@kernel.org>

commit 004e8dce9c5595697951f7cd0e9f66b35c92265e upstream.

Prohibit probing on instruction which has XEN_EMULATE_PREFIX
or KVM's emulate prefix. Since that prefix is a marker for Xen
and KVM, if we modify the marker by kprobe's int3, that doesn't
work as expected.

Signed-off-by: Masami Hiramatsu <mhira...@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <pet...@infradead.org>
Cc: Juergen Gross <jgr...@suse.com>
Cc: x...@kernel.org
Cc: Boris Ostrovsky <boris.ostrov...@oracle.com>
Cc: Ingo Molnar <mi...@kernel.org>
Cc: Stefano Stabellini <sstabell...@kernel.org>
Cc: Andrew Cooper <andrew.coop...@citrix.com>
Cc: Borislav Petkov <b...@alien8.de>
Cc: xen-devel@lists.xenproject.org
Cc: Randy Dunlap <rdun...@infradead.org>
Cc: Josh Poimboeuf <jpoim...@redhat.com>
Link: 
https://lkml.kernel.org/r/156777566048.25081.6296162369492175325.stgit@devnote2
Signed-off-by: Maximilian Heyne <mhe...@amazon.de>
Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>
---
 arch/x86/kernel/kprobes/core.c |    4 ++++
 1 file changed, 4 insertions(+)

--- a/arch/x86/kernel/kprobes/core.c
+++ b/arch/x86/kernel/kprobes/core.c
@@ -358,6 +358,10 @@ int __copy_instruction(u8 *dest, u8 *src
        kernel_insn_init(insn, dest, MAX_INSN_SIZE);
        insn_get_length(insn);
 
+       /* We can not probe force emulate prefixed instruction */
+       if (insn_has_emulate_prefix(insn))
+               return 0;
+
        /* Another subsystem puts a breakpoint, failed to recover */
        if (insn->opcode.bytes[0] == BREAKPOINT_INSTRUCTION)
                return 0;


Patches currently in stable-queue which might be from mhira...@kernel.org are

queue-5.4/x86-xen-kvm-gather-the-definition-of-emulate-prefixes.patch
queue-5.4/x86-xen-insn-decode-xen-and-kvm-emulate-prefix-signature.patch
queue-5.4/x86-asm-allow-to-pass-macros-to-__asm_form.patch
queue-5.4/x86-kprobes-prohibit-probing-on-instruction-which-has-emulate-prefix.patch

Reply via email to