Skip to content

Commit dca857a

Browse files
olsajiriKernel Patches Daemon
authored andcommitted
uprobe: Do not emulate/sstep original instruction when ip is changed
If uprobe handler changes instruction pointer we still execute single step) or emulate the original instruction and increment the (new) ip with its length. This makes the new instruction pointer bogus and application will likely crash on illegal instruction execution. If user decided to take execution elsewhere, it makes little sense to execute the original instruction, so let's skip it. Signed-off-by: Jiri Olsa <[email protected]>
1 parent 9879802 commit dca857a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

kernel/events/uprobes.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2742,6 +2742,9 @@ static void handle_swbp(struct pt_regs *regs)
27422742

27432743
handler_chain(uprobe, regs);
27442744

2745+
if (instruction_pointer(regs) != bp_vaddr)
2746+
goto out;
2747+
27452748
if (arch_uprobe_skip_sstep(&uprobe->arch, regs))
27462749
goto out;
27472750

0 commit comments

Comments
 (0)