Skip to content

Commit cefa721

Browse files
oleg-nesterovKAGA-KOKO
authored andcommitted
uprobes/x86: Allow to probe a NOP instruction with 0x66 prefix
Intel ICC -hotpatch inserts 2-byte "0x66 0x90" NOP at the start of each function to reserve extra space for hot-patching, and currently it is not possible to probe these functions because branch_setup_xol_ops() wrongly rejects NOP with REP prefix as it treats them like word-sized branch instructions. Fixes: 250bbd1 ("uprobes/x86: Refuse to attach uprobe to "word-sized" branch insns") Reported-by: Seiji Nishikawa <snishika@redhat.com> Suggested-by: Denys Vlasenko <dvlasenk@redhat.com> Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Link: https://lore.kernel.org/r/20221204173933.GA31544@redhat.com
1 parent 023e59d commit cefa721

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

arch/x86/kernel/uprobes.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,8 +722,9 @@ static int branch_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn)
722722
switch (opc1) {
723723
case 0xeb: /* jmp 8 */
724724
case 0xe9: /* jmp 32 */
725-
case 0x90: /* prefix* + nop; same as jmp with .offs = 0 */
726725
break;
726+
case 0x90: /* prefix* + nop; same as jmp with .offs = 0 */
727+
goto setup;
727728

728729
case 0xe8: /* call relative */
729730
branch_clear_offset(auprobe, insn);
@@ -753,6 +754,7 @@ static int branch_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn)
753754
return -ENOTSUPP;
754755
}
755756

757+
setup:
756758
auprobe->branch.opc1 = opc1;
757759
auprobe->branch.ilen = insn->length;
758760
auprobe->branch.offs = insn->immediate.value;

0 commit comments

Comments
 (0)