Module Name: src Committed By: riastradh Date: Sat Mar 1 14:15:15 UTC 2014
Modified Files: src/sys/kern: kern_rndsink.c Log Message: Kick on-demand entropy sources in rndsinks_distribute. Partial workaround for indefinite hangs when entropy is scarce or buffered up. We need to do more to handle entropy that has been buffered up -- see the comment for details -- but this will help for now. Problem noted by pooka. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/kern/kern_rndsink.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/kern_rndsink.c diff -u src/sys/kern/kern_rndsink.c:1.7 src/sys/kern/kern_rndsink.c:1.8 --- src/sys/kern/kern_rndsink.c:1.7 Fri Oct 25 11:35:55 2013 +++ src/sys/kern/kern_rndsink.c Sat Mar 1 14:15:15 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_rndsink.c,v 1.7 2013/10/25 11:35:55 martin Exp $ */ +/* $NetBSD: kern_rndsink.c,v 1.8 2014/03/01 14:15:15 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_rndsink.c,v 1.7 2013/10/25 11:35:55 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_rndsink.c,v 1.8 2014/03/01 14:15:15 riastradh Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -210,7 +210,20 @@ rndsinks_enqueue(struct rndsink *rndsink KASSERT(mutex_owned(&rndsinks_lock)); - /* XXX Kick any on-demand entropy sources too. */ + /* + * XXX This should request only rndsink->rs_bytes bytes of + * entropy, but that might get buffered up indefinitely because + * kern_rndq has no bound on the duration before it will + * process queued entropy samples. For now, request refilling + * the pool altogether so that the buffer will fill up and get + * processed. Later, we ought to (a) bound the duration before + * queued entropy samples get processed, and (b) add a target + * or something -- as soon as we get that much from the entropy + * sources, distribute it. + */ + mutex_spin_enter(&rndpool_mtx); + rnd_getmore(RND_POOLBITS / NBBY); + mutex_spin_exit(&rndpool_mtx); switch (rndsink->rsink_state) { case RNDSINK_IDLE: