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:	Fri, 4 Dec 2015 22:40:48 +0800
From:	Herbert Xu <herbert@...dor.apana.org.au>
To:	Jiri Slaby <jslaby@...e.cz>
Cc:	linux-kernel@...r.kernel.org, Matt Mackall <mpm@...enic.com>,
	linux-crypto@...r.kernel.org
Subject: Re: [PATCH v2] hw_random: core, sleep interruptible in read

On Fri, Nov 27, 2015 at 04:50:43PM +0100, Jiri Slaby wrote:
> hwrng kthread can be waiting via hwrng_fillfn for some data from a rng
> like virtio-rng:
> hwrng           D ffff880093e17798     0   382      2 0x00000000
> ...
> Call Trace:
>  [<ffffffff817339c6>] wait_for_completion_killable+0x96/0x210
>  [<ffffffffa00aa1b7>] virtio_read+0x57/0xf0 [virtio_rng]
>  [<ffffffff814f4a35>] hwrng_fillfn+0x75/0x130
>  [<ffffffff810aa243>] kthread+0xf3/0x110
> 
> And when some user program tries to read the /dev node in this state,
> we get:
> rngd            D ffff880093e17798     0   762      1 0x00000004
> ...
> Call Trace:
>  [<ffffffff817351ac>] mutex_lock_nested+0x15c/0x3e0
>  [<ffffffff814f478e>] rng_dev_read+0x6e/0x240
>  [<ffffffff81231958>] __vfs_read+0x28/0xe0
>  [<ffffffff81232393>] vfs_read+0x83/0x130
> 
> And this is indeed unkillable. So use mutex_lock_interruptible
> instead of mutex_lock in rng_dev_read and exit immediatelly when
> interrupted. And possibly return already read data, if any (as POSIX
> allows).
> 
> v2: use ERESTARTSYS instead of EINTR
> 
> Signed-off-by: Jiri Slaby <jslaby@...e.cz>
> Cc: Matt Mackall <mpm@...enic.com>
> Cc: Herbert Xu <herbert@...dor.apana.org.au>
> Cc: <linux-crypto@...r.kernel.org>

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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ