mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 02:24:24 +02:00
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. Acked-by: Oleg Nesterov <oleg@redhat.com> Acked-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Jiri Olsa <jolsa@kernel.org> Link: https://lore.kernel.org/r/20250916215301.664963-3-jolsa@kernel.org Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
parent
7384893d97
commit
4363264111
|
|
@ -2741,6 +2741,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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user