Merge branch 'for-next/random' into for-next/core
Avoid calling arch_get_random_seed_long() from add_interrupt_randomness() as this can result in a firmware call on some arm64 systems. * for-next/random: random: avoid arch_get_random_seed_long() when collecting IRQ randomness
This commit is contained in:
Коммит
cf6a85a850
|
@ -1261,8 +1261,6 @@ void add_interrupt_randomness(int irq, int irq_flags)
|
||||||
cycles_t cycles = random_get_entropy();
|
cycles_t cycles = random_get_entropy();
|
||||||
__u32 c_high, j_high;
|
__u32 c_high, j_high;
|
||||||
__u64 ip;
|
__u64 ip;
|
||||||
unsigned long seed;
|
|
||||||
int credit = 0;
|
|
||||||
|
|
||||||
if (cycles == 0)
|
if (cycles == 0)
|
||||||
cycles = get_reg(fast_pool, regs);
|
cycles = get_reg(fast_pool, regs);
|
||||||
|
@ -1298,23 +1296,12 @@ void add_interrupt_randomness(int irq, int irq_flags)
|
||||||
|
|
||||||
fast_pool->last = now;
|
fast_pool->last = now;
|
||||||
__mix_pool_bytes(r, &fast_pool->pool, sizeof(fast_pool->pool));
|
__mix_pool_bytes(r, &fast_pool->pool, sizeof(fast_pool->pool));
|
||||||
|
|
||||||
/*
|
|
||||||
* If we have architectural seed generator, produce a seed and
|
|
||||||
* add it to the pool. For the sake of paranoia don't let the
|
|
||||||
* architectural seed generator dominate the input from the
|
|
||||||
* interrupt noise.
|
|
||||||
*/
|
|
||||||
if (arch_get_random_seed_long(&seed)) {
|
|
||||||
__mix_pool_bytes(r, &seed, sizeof(seed));
|
|
||||||
credit = 1;
|
|
||||||
}
|
|
||||||
spin_unlock(&r->lock);
|
spin_unlock(&r->lock);
|
||||||
|
|
||||||
fast_pool->count = 0;
|
fast_pool->count = 0;
|
||||||
|
|
||||||
/* award one bit for the contents of the fast pool */
|
/* award one bit for the contents of the fast pool */
|
||||||
credit_entropy_bits(r, credit + 1);
|
credit_entropy_bits(r, 1);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(add_interrupt_randomness);
|
EXPORT_SYMBOL_GPL(add_interrupt_randomness);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче