lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yy2MSm1zIRWa2BT4@alley>
Date:   Fri, 23 Sep 2022 12:36:58 +0200
From:   Petr Mladek <pmladek@...e.com>
To:     "Jason A. Donenfeld" <Jason@...c4.com>,
        Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc:     linux-kernel@...r.kernel.org,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        John Ogness <john.ogness@...utronix.de>,
        Mike Galbraith <efault@....de>,
        Rasmus Villemoes <linux@...musvillemoes.dk>,
        Sergey Senozhatsky <senozhatsky@...omium.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        Theodore Ts'o <tytso@....edu>,
        Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH 2/2 v3] lib/vsprintf: Initialize vsprintf's pointer hash
 once the random core is ready.

On Tue 2022-09-20 17:01:33, Jason A. Donenfeld wrote:
> Hi,
> 
> On Mon, Aug 1, 2022 at 11:34 AM Sebastian Andrzej Siewior
> <bigeasy@...utronix.de> wrote:
> >
> > The printk code invokes vnsprintf in order to compute the complete
> > string before adding it into its buffer. This happens in an IRQ-off
> > region which leads to a warning on PREEMPT_RT in the random code if the
> > format strings contains a %p for pointer printing. This happens because
> > the random core acquires locks which become sleeping locks on PREEMPT_RT
> > which must not be acquired with disabled interrupts and or preemption
> > disabled.
> > By default the pointers are hashed which requires a random value on the
> > first invocation (either by printk or another user which comes first.
> >
> > One could argue that there is no need for printk to disable interrupts
> > during the vsprintf() invocation which would fix the just mentioned
> > problem. However printk itself can be invoked in a context with
> > disabled interrupts which would lead to the very same problem.
> >
> > Move the initialization of ptr_key into a worker and schedule it from
> > subsys_initcall(). This happens early but after the workqueue subsystem
> > is ready. Use get_random_bytes() to retrieve the random value if the RNG
> > core is ready, otherwise schedule a worker in two seconds and try again.
> >
> > Reported-by: Mike Galbraith <efault@....de>
> > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
> > ---
> > v2…v3:
> >    - schedule a worker every two seconds if the RNG core is not ready.
> >
> As we discussed at Plumbers, it seems like this is the least-awful way
> forward. If we wind up with another case sufficiently similar to this,
> I'll add back a notifier to random.c. But while there's only this one
> special case, the ugly timer thing will have to do.
> 
> So Petr - feel free to queue this up this v3, with my objection now removed.

v3 is still using two patches and there was some discussion about
adding __read_mostly.

Sebastian, could you please re-send a cleaned up patch(set). Also it would
be to get/add there also Acked-by from Jason.

Thanks in advance.

Best Regards,
Petr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ