diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index b37a6bde8a91..4e6ada6a11c7 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c @@ -2241,6 +2241,13 @@ static void handle_swbp(struct pt_regs *regs) handler_chain(uprobe, regs); + /* + * If user decided to take execution elsewhere, it makes little sense + * to execute the original instruction, so let's skip it. + */ + if (instruction_pointer(regs) != bp_vaddr) + goto out; + if (arch_uprobe_skip_sstep(&uprobe->arch, regs)) goto out;