Re: [BUG] possible deadlock in __schedule (with reproducer available)
From: Steven Rostedt
Date: Sun Nov 24 2024 - 22:31:01 EST
On Sun, 24 Nov 2024 18:02:35 -0800
Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx> wrote:
> > > -EWONTFIX. Don't do stupid.
> >
> > Ack. BPF should not be causing deadlocks by doing code called from
> > tracepoints.
>
> I sense so much BPF love here that it diminishes the ability to read
> stack traces :)
You know I love BPF ;-) I do recommend it when I feel it's the right
tool for the job.
> Above is one of many printk related splats that syzbot keeps finding.
> This is not a new issue and it has nothing to do with bpf.
I had to fight printk related spats too. But when that happens, its not
considered a bug to the code that is being attached to. Note, my
response is more about the subject title, which sounds like it's
blaming the schedule code. Which is not the issue.
>
> > Tracepoints have a special context similar to NMIs. If you add
> > a hook into an NMI handler that causes a deadlock, it's a bug in the hook,
> > not the NMI code. If you add code that causes a deadlock when attaching to a
> > tracepoint, it's a bug in the hook, not the tracepoint.
>
> trace events call strncpy_from_user_nofault() just as well.
> kernel/trace/trace_events_filter.c:830
Well, in some cases you could do that from NMI as well. The point is,
tracepoints are a different context, and things need to be careful when
using it. If any deadlock occurs by attaching to a tracepoint (and this
isn't just BPF, I have code too that needs to be very careful about
this as well), then the bug is with the attached callback.
I agree with Peter. This isn't his problem. Hence my Ack.
-- Steve