mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-13 23:34:05 +08:00
Random number generator fixes for Linux 5.19-rc4.
-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEq5lC5tSkz8NBJiCnSfxwEqXeA64FAmK0tnsACgkQSfxwEqXe A67+Ow/+LARXzhM1FoWtdosYTnuHhEdLZ91noQHNqCMZQqwEypp5zNeUfy+OPm6V lD6jI0SVAhVufdtMt//t62N+vnaAPMcXRz/n1Dfps+cZenCut5ALm7u19hv4p4gO Ncabh7CLRP7o0mcEaitK8LbDTG3xzgaV0vZ9c084EbeKSsnQSdKLqHp1NMNxAbG4 S+vvitJchzfME3Xc68nE9QxzerdONZklUQV9WaVnj3n4fpylFAGA7ZmthDAxhGTU uwRxanj3Q4VKBv5yhI+k+7VW21gqYDaym8cgSWvV7/CSXsEjN4QKZbGwplzYbhLd dD6M8OMtwD3+wEg+AOT5Ah3jGJGLv3RDdh542JMl3XvYxk8ea2DYeEiaxx8zcsfo OX4b+Hz8TCyeh969v2c86qqbMk/DZjBTo9Sxxmjh4BMium+M/XecLWVqOz15wDiI Xs0WZY8xJq2WxU880FUoNpv9tprpt+i6KKVJWziewNmL3Ockzq5OadM94hINhoZu t7ZA9P2Lf1YUIr7ttBJ8UF9YLCh/tx1oSPDpzLWH+tpoGd5qFyb+WKsdPLY4TlgA /r3JzEz3BXrfMCo2+tq1SJjxnEUxAMmTbPMF3Jzdkljl6tXNvKsByZOO5Ik8W8EP iKzX05Pj2QdvcDdXMqwV1gu1IYkCzrpEtEAqhltyUppOeNWl5D4= =beeQ -----END PGP SIGNATURE----- Merge tag 'random-5.19-rc4-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/crng/random Pull random number generator fixes from Jason Donenfeld: - A change to schedule the interrupt randomness mixing less often, yet credit a little more each time, to reduce overhead during interrupt storms. - Squelch an undesired pr_warn() from __ratelimit(), which was causing problems in the reporters' CI. - A trivial comment fix. * tag 'random-5.19-rc4-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/crng/random: random: update comment from copy_to_user() -> copy_to_iter() random: quiet urandom warning ratelimit suppression message random: schedule mix_interrupt_randomness() less often
This commit is contained in:
commit
ba461afbef
@ -87,7 +87,7 @@ static struct fasync_struct *fasync;
|
||||
|
||||
/* Control how we warn userspace. */
|
||||
static struct ratelimit_state urandom_warning =
|
||||
RATELIMIT_STATE_INIT("warn_urandom_randomness", HZ, 3);
|
||||
RATELIMIT_STATE_INIT_FLAGS("urandom_warning", HZ, 3, RATELIMIT_MSG_ON_RELEASE);
|
||||
static int ratelimit_disable __read_mostly =
|
||||
IS_ENABLED(CONFIG_WARN_ALL_UNSEEDED_RANDOM);
|
||||
module_param_named(ratelimit_disable, ratelimit_disable, int, 0644);
|
||||
@ -408,7 +408,7 @@ static ssize_t get_random_bytes_user(struct iov_iter *iter)
|
||||
|
||||
/*
|
||||
* Immediately overwrite the ChaCha key at index 4 with random
|
||||
* bytes, in case userspace causes copy_to_user() below to sleep
|
||||
* bytes, in case userspace causes copy_to_iter() below to sleep
|
||||
* forever, so that we still retain forward secrecy in that case.
|
||||
*/
|
||||
crng_make_state(chacha_state, (u8 *)&chacha_state[4], CHACHA_KEY_SIZE);
|
||||
@ -1009,7 +1009,7 @@ void add_interrupt_randomness(int irq)
|
||||
if (new_count & MIX_INFLIGHT)
|
||||
return;
|
||||
|
||||
if (new_count < 64 && !time_is_before_jiffies(fast_pool->last + HZ))
|
||||
if (new_count < 1024 && !time_is_before_jiffies(fast_pool->last + HZ))
|
||||
return;
|
||||
|
||||
if (unlikely(!fast_pool->mix.func))
|
||||
|
@ -23,12 +23,16 @@ struct ratelimit_state {
|
||||
unsigned long flags;
|
||||
};
|
||||
|
||||
#define RATELIMIT_STATE_INIT(name, interval_init, burst_init) { \
|
||||
.lock = __RAW_SPIN_LOCK_UNLOCKED(name.lock), \
|
||||
.interval = interval_init, \
|
||||
.burst = burst_init, \
|
||||
#define RATELIMIT_STATE_INIT_FLAGS(name, interval_init, burst_init, flags_init) { \
|
||||
.lock = __RAW_SPIN_LOCK_UNLOCKED(name.lock), \
|
||||
.interval = interval_init, \
|
||||
.burst = burst_init, \
|
||||
.flags = flags_init, \
|
||||
}
|
||||
|
||||
#define RATELIMIT_STATE_INIT(name, interval_init, burst_init) \
|
||||
RATELIMIT_STATE_INIT_FLAGS(name, interval_init, burst_init, 0)
|
||||
|
||||
#define RATELIMIT_STATE_INIT_DISABLED \
|
||||
RATELIMIT_STATE_INIT(ratelimit_state, 0, DEFAULT_RATELIMIT_BURST)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user