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] [day] [month] [year] [list]
Date:   Mon, 9 Sep 2019 17:54:20 +1000
From:   Herbert Xu <herbert@...dor.apana.org.au>
To:     Stephen Boyd <swboyd@...omium.org>
Cc:     linux-kernel@...r.kernel.org, Theodore Ts'o <tytso@....edu>,
        linux-crypto@...r.kernel.org,
        Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
        Keerthy <j-keerthy@...com>
Subject: Re: [PATCH] random: Use wait_event_freezable() in
 add_hwgenerator_randomness()

On Thu, Sep 05, 2019 at 09:41:12AM -0700, Stephen Boyd wrote:
> Sebastian reports that after commit ff296293b353 ("random: Support freezable
> kthreads in add_hwgenerator_randomness()") we can call might_sleep() when the
> task state is TASK_INTERRUPTIBLE (state=1). This leads to the following warning.
> 
>  do not call blocking ops when !TASK_RUNNING; state=1 set at [<00000000349d1489>] prepare_to_wait_event+0x5a/0x180
>  WARNING: CPU: 0 PID: 828 at kernel/sched/core.c:6741 __might_sleep+0x6f/0x80
>  Modules linked in:
> 
>  CPU: 0 PID: 828 Comm: hwrng Not tainted 5.3.0-rc7-next-20190903+ #46
>  RIP: 0010:__might_sleep+0x6f/0x80
> 
>  Call Trace:
>   kthread_freezable_should_stop+0x1b/0x60
>   add_hwgenerator_randomness+0xdd/0x130
>   hwrng_fillfn+0xbf/0x120
>   kthread+0x10c/0x140
>   ret_from_fork+0x27/0x50
> 
> We shouldn't call kthread_freezable_should_stop() from deep within the
> wait_event code because the task state is still set as
> TASK_INTERRUPTIBLE instead of TASK_RUNNING and
> kthread_freezable_should_stop() will try to call into the freezer with
> the task in the wrong state. Use wait_event_freezable() instead so that
> it calls schedule() in the right place and tries to enter the freezer
> when the task state is TASK_RUNNING instead.
> 
> Reported-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
> Tested-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
> Cc: Keerthy <j-keerthy@...com>
> Fixes: ff296293b353 ("random: Support freezable kthreads in add_hwgenerator_randomness()")
> Signed-off-by: Stephen Boyd <swboyd@...omium.org>
> ---
> 
> See https://lkml.kernel.org/r/20190904110038.2bx25byitrejlteu@flow for
> context on the bug report.
> 
>  drivers/char/random.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ