Skip to content

Commit a194acd

Browse files
mhiramatPeter Zijlstra
authored andcommitted
x86/kprobes: Identify far indirect JMP correctly
Since Grp5 far indirect JMP is FF "mod 101 r/m", it should be (modrm & 0x38) == 0x28, and near indirect JMP is also 0x38 == 0x20. So we can mask modrm with 0x30 and check 0x20. This is actually what the original code does, it also doesn't care the last bit. So the result code is same. Thus, I think this is just a cosmetic cleanup. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/161469873475.49483.13257083019966335137.stgit@devnote2
1 parent d60ad3d commit a194acd

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

arch/x86/kernel/kprobes/core.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,7 @@ static void set_resume_flags(struct kprobe *p, struct insn *insn)
467467
p->ainsn.is_call = 1;
468468
p->ainsn.is_abs_ip = 1;
469469
break;
470-
} else if (((opcode & 0x31) == 0x20) ||
471-
((opcode & 0x31) == 0x21)) {
470+
} else if ((opcode & 0x30) == 0x20) {
472471
/*
473472
* jmp near and far, absolute indirect
474473
* ip is correct.

0 commit comments

Comments
 (0)