Malcolm Herbert wrote:
> Wanting to generate some random-ish data to perform some disk io
> testing, in a similar vein to that which Nathan did on Wednesday. 
> Discovered that /dev/urandom on this host seems to only allow a maximum
> read() of 1040 bytes per request:

Looks like its hardcoded via MAXRETBYTES macro:
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/io/random.c#61

> The manual entry for urandom doesn't mention a limit on requests ...
> haven't yet found anything on SunSolve about this, but I'm still looking
> ... has anyone else seen similar behaviour?

Its probably not quite so unusual--all device drivers should place a 
limit on how much
data can be read from them in one call, and do something sensible 
regardless of what
garbage gets passed: e.g. reject a request or return something less than 
requested.
A system shouldn't hang because you make a typo, entering "M" where you 
intended to use "K".
[You may well guess there's a story behind that one.] I'm not going to 
argue whether 1040B
is an appropriate limit, although the manpage gives a clue that its 
expecting it to be used
"for less demanding  and shorter term cryptographic uses such as short 
term session keys,
paddings, and challenge strings".

In the case of /dev/urandom, since it is attempting to supply relatively 
high-quality random
bits based on entropy from various sources in a system, you're like to 
exhaust it very quickly
using it to fill i/o buffers. A pseudo-random number generator may be 
more appropriate for this.

-- 
============================================================================
   ,-_|\   Richard Smith Staff Engineer PAE
  /     \  Sun Microsystems                   Phone : +61 3 9869 6200
richard.smith at Sun.COM                        Direct : +61 3 9869 6224
  \_,-._/  476 St Kilda Road                    Fax : +61 3 9869 6290
       v   Melbourne Vic 3004 Australia
=========================================================================== 


Reply via email to