Re: [PATCHv2 perf/core] uprobes: Harden uretprobe syscall trampoline check

From: Google
Date: Tue Feb 11 2025 - 23:05:25 EST


On Tue, 11 Feb 2025 17:59:41 +0100
Oleg Nesterov <oleg@xxxxxxxxxx> wrote:

> On 02/11, Alexei Starovoitov wrote:
> >
> > > > +#define UPROBE_NO_TRAMPOLINE_VADDR ((unsigned long)-1)
> >
> > If you respin anyway maybe use ~0UL instead?
> > In the above and in
> > uprobe_get_trampoline_vaddr(),
> > since
> >
> > unsigned long trampoline_vaddr = -1;
>
> ... or -1ul in both cases.
>
> I agree, UPROBE_NO_TRAMPOLINE_VADDR has a single user, looks
> a bit strange...

I think both this function and uprobe_get_trampoline_vaddr()
should use the same macro as a token.
(and ~0UL is a bit more comfortable for me too :) )

----
unsigned long uprobe_get_trampoline_vaddr(void)
{
struct xol_area *area;
unsigned long trampoline_vaddr = -1;
----

Thank you,

>
> Oleg.
>
>


--
Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>