Module Name: src Committed By: riastradh Date: Sat May 21 15:33:40 UTC 2016
Modified Files: src/sys/kern: kern_rndsink.c Log Message: Use rnd_getmore as intended. No more essay needed here. Workaround for buffering got pushed into rnd_getmore, closer to the actual cause of the problem. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 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.16 src/sys/kern/kern_rndsink.c:1.17 --- src/sys/kern/kern_rndsink.c:1.16 Tue Apr 21 04:24:16 2015 +++ src/sys/kern/kern_rndsink.c Sat May 21 15:33:40 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_rndsink.c,v 1.16 2015/04/21 04:24:16 riastradh Exp $ */ +/* $NetBSD: kern_rndsink.c,v 1.17 2016/05/21 15:33:40 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.16 2015/04/21 04:24:16 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_rndsink.c,v 1.17 2016/05/21 15:33:40 riastradh Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -142,21 +142,10 @@ rndsinks_enqueue(struct rndsink *rndsink KASSERT(mutex_owned(&rndsinks.lock)); - /* - * 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. To work around this, we are - * a little too incestuous with kern_rndq: we avoid marking polled - * sources "fast" there, and know here that for non-fast sources, - * that code will buffer two ints worth of data per source. - * 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. - */ - rnd_getmore(MAX(rndsink->rsink_bytes, 2 * sizeof(uint32_t))); + /* Kick on-demand entropy sources. */ + rnd_getmore(rndsink->rsink_bytes); + /* Ensure this rndsink is on the queue. */ switch (rndsink->rsink_state) { case RNDSINK_IDLE: /* Not on the queue and nobody is handling it. */