Re: [RFC] Printk deadlock in bpf trace called from scheduler context

From: Peter Zijlstra
Date: Mon Jul 29 2024 - 08:27:54 EST


On Mon, Jul 29, 2024 at 01:46:09PM +0200, Radoslaw Zielonek wrote:
> I am currently working on a syzbot-reported bug where bpf
> is called from trace_sched_switch. In this scenario, we are still within
> the scheduler context, and calling printk can create a deadlock.
>
> I am uncertain about the best approach to fix this issue.

It's been like this forever, it doesn't need fixing, because tracepoints
shouldn't be doing printk() in the first place.

> Should we simply forbid such calls, or perhaps we should replace printk
> with printk_deferred in the bpf where we are still in scheduler context?

Not doing printk() is best.