All of lore.kernel.org
 help / color / mirror / Atom feed
* repeatable boot randomness inside KVM guest
@ 2018-04-14 19:59 Alexey Dobriyan
  2018-04-14 22:41 ` Andy Lutomirski
  2018-04-14 22:44 ` Theodore Y. Ts'o
  0 siblings, 2 replies; 22+ messages in thread
From: Alexey Dobriyan @ 2018-04-14 19:59 UTC (permalink / raw)
  To: linux-kernel, tytso, kvm; +Cc: security

SLAB allocators got CONFIG_SLAB_FREELIST_RANDOM option which randomizes
allocation pattern inside a slab:


	#ifdef CONFIG_SLAB_FREELIST_RANDOM
	/* Pre-initialize the random sequence cache */
	static int init_cache_random_seq(struct kmem_cache *s)
	{
		...

Then I printed actual random sequences for each kmem cache.
Turned out they were all the same for most of the caches and
they didn't vary across guest reboots.

	int cache_random_seq_create(struct kmem_cache *cachep, unsigned int count, gfp_t gfp)
	{
		...
		/* Get best entropy at this stage of boot */
	        prandom_seed_state(&state, get_random_long());

Then I searched internet and turned out KVM can pass randomness via
virtio-rng or something. So I linked /dev/urandom.

And it didn't help!

The only way to get randomness for SLAB is to enable RDRAND inside guest.

Is it KVM bug?

For the record I'm using qemu 2.11.1-r2 and whatever F27 ships now.

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2018-04-17 21:41 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-14 19:59 repeatable boot randomness inside KVM guest Alexey Dobriyan
2018-04-14 22:41 ` Andy Lutomirski
2018-04-14 23:09   ` Alexey Dobriyan
2018-04-14 22:44 ` Theodore Y. Ts'o
2018-04-15  0:41   ` Matthew Wilcox
2018-04-17  9:13     ` James Bottomley
2018-04-17  9:13       ` James Bottomley
2018-04-17 11:47       ` Matthew Wilcox
2018-04-17 11:47         ` Matthew Wilcox
2018-04-17 11:57         ` James Bottomley
2018-04-17 11:57           ` James Bottomley
2018-04-17 14:07           ` Matthew Wilcox
2018-04-17 14:07             ` Matthew Wilcox
2018-04-17 15:20             ` James Bottomley
2018-04-17 15:20               ` James Bottomley
2018-04-17 15:16           ` Theodore Y. Ts'o
2018-04-17 15:42             ` James Bottomley
2018-04-17 15:42               ` James Bottomley
2018-04-17 21:40               ` Theodore Y. Ts'o
2018-04-16 15:54   ` Kees Cook
2018-04-16 16:15     ` Thomas Garnier
2018-04-17  0:31       ` Alexey Dobriyan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.