All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: random: Providing a seed value to VM guests
@ 2014-05-01 19:02 Andy Lutomirski
  2014-05-01 19:26 ` tytso
  2014-05-01 19:41 ` H. Peter Anvin
  0 siblings, 2 replies; 17+ messages in thread
From: Andy Lutomirski @ 2014-05-01 19:02 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Theodore Ts'o, Florian Weimer, linux-kernel@vger.kernel.org,
	Kees Cook, kvm list

On Thu, May 1, 2014 at 11:59 AM, H. Peter Anvin <hpa@zytor.com> wrote:
> On 05/01/2014 11:53 AM, Andy Lutomirski wrote:
>>
>> A CPUID leaf or an MSR advertised by a CPUID leaf has another
>> advantage: it's easy to use in the ASLR code -- I don't think there's
>> a real IDT, so there's nothing like rdmsr_safe available.  It also
>> avoids doing anything complicated with the boot process to allow the
>> same seed to be used for ASLR and random.c; it can just be invoked
>> twice on boot.
>>
>
> At that point we are talking an x86-specific interface, and so we might
> as well simply emulate RDRAND (urandom) and RDSEED (random) if the CPU
> doesn't support them.  I believe KVM already has a way to report CPUID
> features that are "emulated but supported anyway", i.e. they work but
> are slow.

Do existing kernels and userspace respect this?  If the normal bit for
RDRAND is unset, then we might be okay, but, if not, then I think this
may kill guest performance.

Is RDSEED really reasonable here?  Won't it slow down by several
orders of magnitude?

>
>> What's the right forum for this?  This thread is probably not it.
>
> Change the subject line?

:)

>
>         -hpa
>
>



-- 
Andy Lutomirski
AMA Capital Management, LLC

^ permalink raw reply	[flat|nested] 17+ messages in thread
* [PATCH] random: Add "initialized" variable to proc
@ 2014-04-28 19:52 Florian Weimer
  2014-04-28 21:41 ` Theodore Ts'o
  0 siblings, 1 reply; 17+ messages in thread
From: Florian Weimer @ 2014-04-28 19:52 UTC (permalink / raw)
  To: Theodore Ts'o, linux-kernel

Before this change, you had to check kernel log messages to see if the
non-blocking pool had been properly initialized.  With this change, you
can consult the file /proc/sys/kernel/random/intialized instead.

Signed-off-by: Florian Weimer <fweimer@redhat.com>
---
 drivers/char/random.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/char/random.c b/drivers/char/random.c
index 6b75713..81d83e2 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1592,6 +1592,19 @@ static int proc_do_entropy(ctl_table *table, int write,
 	return proc_dointvec(&fake_table, write, buffer, lenp, ppos);
 }
 
+/*
+ * Return whether the urandom pool has been initialized.
+ */
+static int proc_do_initialized(ctl_table *table, int write,
+			       void __user *buffer, size_t *lenp, loff_t *ppos)
+{
+	ctl_table fake_table;
+	char ch = '0' + nonblocking_pool.initialized;
+	fake_table.data = &ch;
+	fake_table.maxlen = 1;
+	return proc_dostring(&fake_table, write, buffer, lenp, ppos);
+}
+
 static int sysctl_poolsize = INPUT_POOL_WORDS * 32;
 extern struct ctl_table random_table[];
 struct ctl_table random_table[] = {
@@ -1610,6 +1623,12 @@ struct ctl_table random_table[] = {
 		.data		= &input_pool.entropy_count,
 	},
 	{
+		.procname	= "initialized",
+		.maxlen		= 1,
+		.mode		= 0444,
+		.proc_handler	= proc_do_initialized,
+	},
+	{
 		.procname	= "read_wakeup_threshold",
 		.data		= &random_read_wakeup_bits,
 		.maxlen		= sizeof(int),
-- 
1.9.0


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

end of thread, other threads:[~2014-05-01 23:00 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-01 19:02 random: Providing a seed value to VM guests Andy Lutomirski
2014-05-01 19:26 ` tytso
2014-05-01 19:40   ` H. Peter Anvin
2014-05-01 20:16   ` Andy Lutomirski
2014-05-01 20:30     ` H. Peter Anvin
2014-05-01 20:32       ` Andy Lutomirski
2014-05-01 20:39         ` tytso
2014-05-01 20:56           ` Andy Lutomirski
2014-05-01 21:01             ` H. Peter Anvin
2014-05-01 21:06               ` Andy Lutomirski
2014-05-01 22:28                 ` tytso
2014-05-01 22:32                   ` Andy Lutomirski
2014-05-01 22:46                     ` H. Peter Anvin
2014-05-01 22:56                       ` Andy Lutomirski
2014-05-01 23:00                         ` H. Peter Anvin
2014-05-01 19:41 ` H. Peter Anvin
  -- strict thread matches above, loose matches on Subject: below --
2014-04-28 19:52 [PATCH] random: Add "initialized" variable to proc Florian Weimer
2014-04-28 21:41 ` Theodore Ts'o
2014-04-29 17:51   ` Florian Weimer
2014-04-29 18:26     ` Theodore Ts'o
2014-04-30 20:52       ` Andy Lutomirski
2014-05-01  2:06         ` Theodore Ts'o
2014-05-01  4:05           ` H. Peter Anvin
2014-05-01 15:05             ` tytso
2014-05-01 15:35               ` Andy Lutomirski
2014-05-01 18:53                 ` Andy Lutomirski
2014-05-01 18:59                   ` random: Providing a seed value to VM guests H. Peter Anvin

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.