Skip to content

Commit d60ad3d

Browse files
mhiramatPeter Zijlstra
authored andcommitted
x86/kprobes: Retrieve correct opcode for group instruction
Since the opcodes start from 0xff are group5 instruction group which is not 2 bytes opcode but the extended opcode determined by the MOD/RM byte. The commit abd82e5 ("x86/kprobes: Do not decode opcode in resume_execution()") used insn->opcode.bytes[1], but that is not correct. We have to refer the insn->modrm.bytes[1] instead. Fixes: abd82e5 ("x86/kprobes: Do not decode opcode in resume_execution()") Signed-off-by: Masami Hiramatsu <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/161469872400.49483.18214724458034233166.stgit@devnote2
1 parent 0705ef6 commit d60ad3d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

arch/x86/kernel/kprobes/core.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,11 @@ static void set_resume_flags(struct kprobe *p, struct insn *insn)
453453
break;
454454
#endif
455455
case 0xff:
456-
opcode = insn->opcode.bytes[1];
456+
/*
457+
* Since the 0xff is an extended group opcode, the instruction
458+
* is determined by the MOD/RM byte.
459+
*/
460+
opcode = insn->modrm.bytes[0];
457461
if ((opcode & 0x30) == 0x10) {
458462
/*
459463
* call absolute, indirect

0 commit comments

Comments
 (0)