[PATCH] bcachefs: no console_lock in bch2_print_string_as_lines

John Ogness john.ogness at linutronix.de
Wed Jul 10 14:01:40 UTC 2024


On 2024-07-10, Daniel Vetter <daniel.vetter at ffwll.ch> wrote:
> console_lock is the outermost subsystem lock for a lot of subsystems,
> which means get/put_user must nest within. Which means it cannot be
> acquired somewhere deeply nested in other locks, and most definitely
> not while holding fs locks potentially needed to resolve faults.
>
> console_trylock is the best we can do here. But John pointed out on a
> previous version that this is futile:
>
> "Using the console lock here at all is wrong. The console lock does not
> prevent other CPUs from calling printk() and inserting lines in between.
>
> "There is no way to guarantee a contiguous ringbuffer block using
> multiple printk() calls.
>
> "The console_lock usage should be removed."
>
> https://lore.kernel.org/lkml/87frsh33xp.fsf@jogness.linutronix.de/
>
> Do that.
>
> Reported-by: syzbot+6cebc1af246fe020a2f0 at syzkaller.appspotmail.com
> References: https://lore.kernel.org/dri-devel/00000000000026c1ff061cd0de12@google.com/
> Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
> Fixes: a8f354284304 ("bcachefs: bch2_print_string_as_lines()")

Reviewed-by: John Ogness <john.ogness at linutronix.de>


More information about the dri-devel mailing list