Re: [PATCH] kretprobe: Prevent triggering kretprobe from within kprobe_flush_task

From: Jiri Olsa
Date: Thu Apr 16 2020 - 05:15:08 EST


On Thu, Apr 16, 2020 at 10:55:06AM +0900, Masami Hiramatsu wrote:

SNIP

> > trampoline_handler
> > kretprobe_hash_lock(current, &head, &flags); <--- deadlock
> >
> > Adding kprobe_busy_begin/end helpers that mark code with fake
> > probe installed to prevent triggering of another kprobe within
> > this code.
> >
> > Using these helpers in kprobe_flush_task, so the probe recursion
> > protection check is hit and the probe is never set to prevent
> > above lockup.
> >
> > Reported-by: "Ziqian SUN (Zamir)" <zsun@xxxxxxxxxx>
> > Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
>
> Thanks Jiri and Ziqian!
>
> Looks good to me.
>
> Acked-by: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
>
> BTW, this is a kind of bugfix. So should it add a Fixes tag?
>
> Fixes: ef53d9c5e4da ('kprobes: improve kretprobe scalability with hashed locking')
> Cc: stable@xxxxxxxxxxxxxxx

ah right, do you want me to repost with those?

thanks,
jirka