Re: possible deadlock in console_unlock

From: Sergey Senozhatsky
Date: Sat Feb 16 2019 - 02:46:53 EST


On (02/16/19 16:21), Sergey Senozhatsky wrote:
> On (02/16/19 14:36), Yao HongBo wrote:
> > hi, sergey:
> >
> > As shown in that link, https://lkml.org/lkml/2018/6/6/397
> >
> > On the linux kernel 5.0-rc6, Syzkaller also hit 'possible deadlock in console_unlock'
> > bug for several times in my environment.
> >
> > This solution fixes things for me. Do you have a plan to submit patches to
> > solve this problem.
> >
> > diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
> > __printk_safe_enter();
> > kmalloc(sizeof(struct tty_buffer) + 2 * size, GFP_ATOMIC);
> > __printk_safe_exit();
>
> I would probably try the following:

Yao HongBo, could you please post the lockdep splat?

GFP_NOWARN is probably the best option for now. Yes, it, maybe,
will not work for fault-injection cases; but printk_safe approach
is harder to push for, especially given that printk_safe maybe will
not even exist in the future.

-ss