Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

uprobe: Move arch_uprobe_optimize right after handlers execution

It's less confusing to optimize uprobe right after handlers execution
and before we do the check for changed ip register to avoid situations
where changed ip register would skip uprobe optimization.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Oleg Nesterov <oleg@redhat.com>

authored by

Jiri Olsa and committed by
Peter Zijlstra
62685ab0 3a866087

+3 -3
+3 -3
kernel/events/uprobes.c
··· 2765 2765 2766 2766 handler_chain(uprobe, regs); 2767 2767 2768 + /* Try to optimize after first hit. */ 2769 + arch_uprobe_optimize(&uprobe->arch, bp_vaddr); 2770 + 2768 2771 /* 2769 2772 * If user decided to take execution elsewhere, it makes little sense 2770 2773 * to execute the original instruction, so let's skip it. 2771 2774 */ 2772 2775 if (instruction_pointer(regs) != bp_vaddr) 2773 2776 goto out; 2774 - 2775 - /* Try to optimize after first hit. */ 2776 - arch_uprobe_optimize(&uprobe->arch, bp_vaddr); 2777 2777 2778 2778 if (arch_uprobe_skip_sstep(&uprobe->arch, regs)) 2779 2779 goto out;