[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150515064626.GA16704@gondor.apana.org.au>
Date: Fri, 15 May 2015 14:46:26 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Stephan Mueller <smueller@...onox.de>
Cc: pebolle@...cali.nl, andreas.steffen@...ongswan.org, tytso@....edu,
sandyinchina@...il.com, linux-kernel@...r.kernel.org,
linux-crypto@...r.kernel.org
Subject: Re: [PATCH v6 1/5] random: Blocking API for accessing
nonblocking_pool
On Wed, May 13, 2015 at 09:54:41PM +0200, Stephan Mueller wrote:
> /*
> + * Equivalent function to get_random_bytes with the difference that this
> + * function blocks the request until the nonblocking_pool is initialized.
> + */
> +void get_blocking_random_bytes(void *buf, int nbytes)
> +{
> + if (unlikely(nonblocking_pool.initialized == 0))
> + wait_event_interruptible(urandom_init_wait,
> + nonblocking_pool.initialized);
> + extract_entropy(&nonblocking_pool, buf, nbytes, 0, 0);
So what if the wait was interrupted? You are going to extract
entropy from an empty pool.
Anyway, you still haven't addressed my primary concern with this
model which is the potential for dead-lock. Sleeping for an open
period of time like this in a work queue is bad form. It may also
lead to dead-locks if whatever you're waiting for happened to use
the same work thread.
That's why I think you should simply provide a function and data
pointer which random.c can then stash onto a list to call when
the pool is ready.
Cheers,
--
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