Re: short read from /dev/urandom

From: Theodore Ts'o
Date: Fri Jan 14 2005 - 18:29:44 EST


On Fri, Jan 14, 2005 at 01:04:52PM -0800, Ulrich Drepper wrote:
> I'm concerned that there is isgnificant code out there relying on the
> no-short-read promise. And perhaps more importantly, other
> implementations promise the same.
>
> The code in question comes from a crypto library which is in wide use
> (http://www.cryptopp.com) and it is using urandom under this assumption.
> I fear there is quite a bit more code like this out there. Changing
> the ABI after the fact is no good and dangerous in this case.
>
> I know this is making the device special, but I really think the
> no-short-reads property should be perserved for urandom.

Good point. The fact that there are other implementations out there
which are doing this is a convincing argument.

I am still a bit concerned still that a stupidly written program that
opens /dev/urandom (perhaps unwittingly) and tries to read a few
hundred megabytes will become uninterruptible until the read
completes, but I'm not sure it's worth it to but in some kludge that
says "break if there's a signal and count > 1 megabyte --- otherwise
we'll return soon enough".

- Ted
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/