Module Name: src
Committed By: riastradh
Date: Mon Mar 21 22:20:32 UTC 2022
Modified Files:
src/sys/kern: subr_autoconf.c
Log Message:
autoconf(9): Enter more timing samples into entropy pool.
Previously, we sampled the time of each _failed_ config_search. I'm
not sure why -- there was no explanation in the comment or the commit
message introducing this in rev. 1.230.2.1 on tls-earlyentropy.
With this change, we sample the time of _every_ search including the
successful ones -- and also measure the time to attach which often
includes things like probing device registers, triggering device
reset and waiting for it to post, &c.
To generate a diff of this commit:
cvs rdiff -u -r1.296 -r1.297 src/sys/kern/subr_autoconf.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/subr_autoconf.c
diff -u src/sys/kern/subr_autoconf.c:1.296 src/sys/kern/subr_autoconf.c:1.297
--- src/sys/kern/subr_autoconf.c:1.296 Sat Mar 12 19:26:33 2022
+++ src/sys/kern/subr_autoconf.c Mon Mar 21 22:20:32 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.296 2022/03/12 19:26:33 riastradh Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.297 2022/03/21 22:20:32 riastradh Exp $ */
/*
* Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.296 2022/03/12 19:26:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.297 2022/03/21 22:20:32 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_ddb.h"
@@ -1184,6 +1184,7 @@ config_search_internal(device_t parent,
mapply(&m, cf);
}
}
+ rnd_add_uint32(&rnd_autoconf_source, 0);
return m.match;
}
@@ -1270,14 +1271,6 @@ config_found(device_t parent, void *aux,
aprint_normal("%s", msgs[pret]);
}
- /*
- * This has the effect of mixing in a single timestamp to the
- * entropy pool. Experiments indicate the estimator will almost
- * always attribute one bit of entropy to this sample; analysis
- * of device attach/detach timestamps on FreeBSD indicates 4
- * bits of entropy/sample so this seems appropriately conservative.
- */
- rnd_add_uint32(&rnd_autoconf_source, 0);
return NULL;
}
@@ -1771,6 +1764,7 @@ config_attach_internal(device_t parent,
config_process_deferred(&deferred_config_queue, dev);
device_register_post_config(dev, aux);
+ rnd_add_uint32(&rnd_autoconf_source, 0);
return dev;
}