Re: [PATCH 1/2] uprobes/x86: Change __skip_sstep() to actually skipthe whole insn

From: Anton Arapov
Date: Wed Jan 02 2013 - 08:16:57 EST


On Sun, Dec 30, 2012 at 04:47:19PM +0100, Oleg Nesterov wrote:
> __skip_sstep() doesn't update regs->ip. Currently this is correct
> but only "by accident" and it doesn't skip the whole insn. Change
> it to advance ->ip by the length of the detected 0x66*0x90 sequence.
>
> Signed-off-by: Oleg Nesterov <oleg@xxxxxxxxxx>
> ---
> arch/x86/kernel/uprobes.c | 5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c
> index c71025b..4e33a35 100644
> --- a/arch/x86/kernel/uprobes.c
> +++ b/arch/x86/kernel/uprobes.c
> @@ -680,8 +680,11 @@ static bool __skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs)
> if (auprobe->insn[i] == 0x66)
> continue;
>
> - if (auprobe->insn[i] == 0x90)
> + if (auprobe->insn[i] == 0x90) {
> + regs->ip = uprobe_get_swbp_addr(regs);
> + regs->ip += i + 1;
> return true;
> + }

This change/routine is not obvious without the patch description, I
would appreciate some comment in the code. :) I believe it could help
some random developer in future.
/ I leave it to your judgement though /

Anton.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/