Re: [PATCH 07/10] uprobes/x86: Introduce arch_uretprobe_is_alive()

From: Srikar Dronamraju
Date: Fri May 08 2015 - 07:31:26 EST


>
> Yes, and we can do this without changing arch_uretprobe_hijack_return_addr()
> interface (which imo should be changed anyway, but this is off-topic).
>
> > and handle_trampoline() would call something like
> >
> > arch_uretprobe_is_alive(next->sp, regs);
> >
> > bool __weak arch_uretprobe_is_alive(unsigned long sp, struct pt_regs *regs)
> > {
> > return user_stack_pointer(regs) <= sp;
> > }
>
> The problem is, I simply do not know if this is right on !x86.
>
> And. I wanted to ensure that if (say) arch/ppc needs something else to
> save/check in hijack/alive, then this architecture can just add the new
> members in arch_uretprobe and change the arch_ helpers.
>

The above weak function should work with ppc. Infact I see only 2 arch
that define CONFIG_STACK_GROWSUP (metag and parisc) and both don't
seem to have uprobes support for now. And even if they get uprobes
support, then supporting arch that define CONFIG_STACK_GROWSUP within
the weak function should be easy. Also the archs can also overload this
function. (In which case we could even drop the weak notation for now).

We even seem to use this assumption when kprobe_tracer/uprobe_tracer
fetch arguments from stack. See fetch_kernel_stack_address() /
fetch_user_stack_address() and get_user_stack_nth().

--
Thanks and Regards
Srikar Dronamraju

--
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/