Module Name: src Committed By: riz Date: Thu Apr 19 19:59:11 UTC 2012
Modified Files: src/sys/dev [netbsd-6]: rndpseudo.c src/sys/kern [netbsd-6]: kern_rndq.c subr_cprng.c src/sys/lib/libkern [netbsd-6]: arc4random.c src/sys/sys [netbsd-6]: rnd.h Log Message: Pull up following revision(s) (requested by tls in ticket #185): sys/kern/subr_cprng.c: revision 1.6 sys/kern/subr_cprng.c: revision 1.7 sys/lib/libkern/arc4random.c: revision 1.32 sys/kern/kern_rndq.c: revision 1.2 sys/dev/rndpseudo.c: revision 1.7 sys/sys/rnd.h: revision 1.30 Add a spin mutex to the rndsink structure; it is used to avoid lock ordering and sleep-holding-locks problems when rekeying, and thus to avoid a nasty race between cprng destruction and reseeding. Fix LOCKDEBUG problems pointed out by drochner@ 1) Lock ordering in cprng_strong_destroy had us take a spin mutex then an adaptive mutex. Can't do that. Reordering this requires changing cprng_strong_reseed to tryenter the cprng's own mutex and skip the reseed on failure, or we could deadlock. 2) Can't free memory with a valid mutex in it. reorder initialization to improve error handling in case the system runs out of file descriptors, avoids LOCKDEBUG panic due to double mutex initialization To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/dev/rndpseudo.c cvs rdiff -u -r1.1 -r1.1.2.1 src/sys/kern/kern_rndq.c cvs rdiff -u -r1.5 -r1.5.2.1 src/sys/kern/subr_cprng.c cvs rdiff -u -r1.31 -r1.31.2.1 src/sys/lib/libkern/arc4random.c cvs rdiff -u -r1.29 -r1.29.2.1 src/sys/sys/rnd.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.