Re: [PATCH] kretprobe: Prevent triggering kretprobe from within kprobe_flush_task
From: Masami Hiramatsu
Date: Thu Apr 16 2020 - 11:31:36 EST
Hi Jiri,
On Thu, 16 Apr 2020 11:13:20 +0200
Jiri Olsa <jolsa@xxxxxxxxxx> wrote:
> 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?
Yeah, if you don't mind.
Thank you,
>
> thanks,
> jirka
>
--
Masami Hiramatsu <mhiramat@xxxxxxxxxx>