Skip to content

Commit 62685ab

Browse files
olsajiriPeter Zijlstra
authored andcommitted
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>
1 parent 3a86608 commit 62685ab

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

kernel/events/uprobes.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2765,16 +2765,16 @@ static void handle_swbp(struct pt_regs *regs)
27652765

27662766
handler_chain(uprobe, regs);
27672767

2768+
/* Try to optimize after first hit. */
2769+
arch_uprobe_optimize(&uprobe->arch, bp_vaddr);
2770+
27682771
/*
27692772
* If user decided to take execution elsewhere, it makes little sense
27702773
* to execute the original instruction, so let's skip it.
27712774
*/
27722775
if (instruction_pointer(regs) != bp_vaddr)
27732776
goto out;
27742777

2775-
/* Try to optimize after first hit. */
2776-
arch_uprobe_optimize(&uprobe->arch, bp_vaddr);
2777-
27782778
if (arch_uprobe_skip_sstep(&uprobe->arch, regs))
27792779
goto out;
27802780

0 commit comments

Comments
 (0)