[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220513142229.541060503@linuxfoundation.org>
Date: Fri, 13 May 2022 16:23:39 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Masami Hiramatsu <mhiramat@...nel.org>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>,
Juergen Gross <jgross@...e.com>, x86@...nel.org,
Boris Ostrovsky <boris.ostrovsky@...cle.com>,
Ingo Molnar <mingo@...nel.org>,
Stefano Stabellini <sstabellini@...nel.org>,
Andrew Cooper <andrew.cooper3@...rix.com>,
Borislav Petkov <bp@...en8.de>, xen-devel@...ts.xenproject.org,
Randy Dunlap <rdunlap@...radead.org>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Maximilian Heyne <mheyne@...zon.de>
Subject: [PATCH 5.4 13/18] x86: kprobes: Prohibit probing on instruction which has emulate prefix
From: Masami Hiramatsu <mhiramat@...nel.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 <mhiramat@...nel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Cc: Juergen Gross <jgross@...e.com>
Cc: x86@...nel.org
Cc: Boris Ostrovsky <boris.ostrovsky@...cle.com>
Cc: Ingo Molnar <mingo@...nel.org>
Cc: Stefano Stabellini <sstabellini@...nel.org>
Cc: Andrew Cooper <andrew.cooper3@...rix.com>
Cc: Borislav Petkov <bp@...en8.de>
Cc: xen-devel@...ts.xenproject.org
Cc: Randy Dunlap <rdunlap@...radead.org>
Cc: Josh Poimboeuf <jpoimboe@...hat.com>
Link: https://lkml.kernel.org/r/156777566048.25081.6296162369492175325.stgit@devnote2
Signed-off-by: Maximilian Heyne <mheyne@...zon.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.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;
Powered by blists - more mailing lists