Skip to content

Commit 0ac8dae

Browse files
committed
uprobes/x86: Add support to emulate NOP instructions
JIRA: https://issues.redhat.com/browse/RHEL-78203 commit 610f6e1 Author: Jiri Olsa <jolsa@kernel.org> Date: Mon Apr 14 10:36:46 2025 +0200 uprobes/x86: Add support to emulate NOP instructions Add support to emulate all NOP instructions as the original uprobe instruction. This change speeds up uprobe on top of all NOP instructions and is a preparation for usdt probe optimization, that will be done on top of NOP5 instructions. With this change the usdt probe on top of NOP5s won't take the performance hit compared to usdt probe on top of standard NOP instructions. Suggested-by: Oleg Nesterov <oleg@redhat.com> Suggested-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Jiri Olsa <jolsa@kernel.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Reviewed-by: Oleg Nesterov <oleg@redhat.com> Acked-by: Andrii Nakryiko <andrii@kernel.org> Cc: Alan Maguire <alan.maguire@oracle.com> Cc: Hao Luo <haoluo@google.com> Cc: John Fastabend <john.fastabend@gmail.com> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Song Liu <songliubraving@fb.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Yonghong Song <yhs@fb.com> Link: https://lore.kernel.org/r/20250414083647.1234007-1-jolsa@kernel.org Signed-off-by: Viktor Malik <vmalik@redhat.com>
1 parent 6c2a685 commit 0ac8dae

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

arch/x86/kernel/uprobes.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,11 @@ static int branch_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn)
836836
insn_byte_t p;
837837
int i;
838838

839+
/* x86_nops[insn->length]; same as jmp with .offs = 0 */
840+
if (insn->length <= ASM_NOP_MAX &&
841+
!memcmp(insn->kaddr, x86_nops[insn->length], insn->length))
842+
goto setup;
843+
839844
switch (opc1) {
840845
case 0xeb: /* jmp 8 */
841846
case 0xe9: /* jmp 32 */

0 commit comments

Comments
 (0)