Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F140493841
D32021.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D32021.id.diff
View Options
diff --git a/sys/dev/random/random_harvestq.h b/sys/dev/random/random_harvestq.h
--- a/sys/dev/random/random_harvestq.h
+++ b/sys/dev/random/random_harvestq.h
@@ -42,8 +42,6 @@
uint8_t he_source; /* origin of the entropy */
};
-void read_rate_increment(u_int);
-
#define RANDOM_HARVEST_INIT_LOCK(x) mtx_init(&harvest_context.hc_mtx, "entropy harvest mutex", NULL, MTX_SPIN)
#define RANDOM_HARVEST_LOCK(x) mtx_lock_spin(&harvest_context.hc_mtx)
#define RANDOM_HARVEST_UNLOCK(x) mtx_unlock_spin(&harvest_context.hc_mtx)
diff --git a/sys/dev/random/random_harvestq.c b/sys/dev/random/random_harvestq.c
--- a/sys/dev/random/random_harvestq.c
+++ b/sys/dev/random/random_harvestq.c
@@ -75,8 +75,6 @@
static void random_kthread(void);
static void random_sources_feed(void);
-static u_int read_rate;
-
/*
* Random must initialize much earlier than epoch, but we can initialize the
* epoch code before SMP starts. Prior to SMP, we can safely bypass
@@ -231,7 +229,7 @@
uint32_t entropy[HARVESTSIZE];
struct epoch_tracker et;
struct random_sources *rrs;
- u_int i, n, local_read_rate;
+ u_int i, n;
bool rse_warm;
rse_warm = epoch_inited;
@@ -240,15 +238,10 @@
* Step over all of live entropy sources, and feed their output
* to the system-wide RNG.
*/
- local_read_rate = atomic_readandclear_32(&read_rate);
- /* Perform at least one read per round */
- local_read_rate = MAX(local_read_rate, 1);
- /* But not exceeding RANDOM_KEYSIZE_WORDS */
- local_read_rate = MIN(local_read_rate, RANDOM_KEYSIZE_WORDS);
if (rse_warm)
epoch_enter_preempt(rs_epoch, &et);
CK_LIST_FOREACH(rrs, &source_list, rrs_entries) {
- for (i = 0; i < p_random_alg_context->ra_poolcount*local_read_rate; i++) {
+ for (i = 0; i < p_random_alg_context->ra_poolcount; i++) {
n = rrs->rrs_source->rs_read(entropy, sizeof(entropy));
KASSERT((n <= sizeof(entropy)), ("%s: rs_read returned too much data (%u > %zu)", __func__, n, sizeof(entropy)));
/*
@@ -272,13 +265,6 @@
explicit_bzero(entropy, sizeof(entropy));
}
-void
-read_rate_increment(u_int chunk)
-{
-
- atomic_add_32(&read_rate, chunk);
-}
-
/* ARGSUSED */
static int
random_check_uint_harvestmask(SYSCTL_HANDLER_ARGS)
diff --git a/sys/dev/random/randomdev.c b/sys/dev/random/randomdev.c
--- a/sys/dev/random/randomdev.c
+++ b/sys/dev/random/randomdev.c
@@ -187,7 +187,6 @@
if (error != 0)
return (error);
- read_rate_increment(howmany(uio->uio_resid + 1, sizeof(uint32_t)));
total_read = 0;
/* Easy to deal with the trivial 0 byte case. */
@@ -286,7 +285,6 @@
(void)randomdev_wait_until_seeded(SEEDWAIT_UNINTERRUPTIBLE);
}
- read_rate_increment(roundup2(len, sizeof(uint32_t)));
p_random_alg_context->ra_read(random_buf, len);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 25, 3:17 PM (3 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27249711
Default Alt Text
D32021.id.diff (2 KB)
Attached To
Mode
D32021: kern: random: reduce the rate at which we collect from fast entropy sources
Attached
Detach File
Event Timeline
Log In to Comment