Skip to content

Commit 004e8dc

Browse files
mhiramatPeter Zijlstra
authored andcommitted
x86: kprobes: Prohibit probing on instruction which has emulate prefix
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 <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Juergen Gross <[email protected]> Cc: [email protected] Cc: Boris Ostrovsky <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Stefano Stabellini <[email protected]> Cc: Andrew Cooper <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: [email protected] Cc: Randy Dunlap <[email protected]> Cc: Josh Poimboeuf <[email protected]> Link: https://lkml.kernel.org/r/156777566048.25081.6296162369492175325.stgit@devnote2
1 parent 4d65adf commit 004e8dc

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arch/x86/kernel/kprobes/core.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,10 @@ int __copy_instruction(u8 *dest, u8 *src, u8 *real, struct insn *insn)
351351
kernel_insn_init(insn, dest, MAX_INSN_SIZE);
352352
insn_get_length(insn);
353353

354+
/* We can not probe force emulate prefixed instruction */
355+
if (insn_has_emulate_prefix(insn))
356+
return 0;
357+
354358
/* Another subsystem puts a breakpoint, failed to recover */
355359
if (insn->opcode.bytes[0] == BREAKPOINT_INSTRUCTION)
356360
return 0;

0 commit comments

Comments
 (0)