mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Dr. Greg" <greg@enjellic.com>
To: "Reshetova, Elena" <elena.reshetova@intel.com>
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>,
	"Daniel P. Berrang??" <berrange@redhat.com>,
	"Hansen, Dave" <dave.hansen@intel.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"Theodore Ts'o" <tytso@mit.edu>,
	Kuppuswamy Sathyanarayanan
	<sathyanarayanan.kuppuswamy@linux.intel.com>,
	"Nakajima, Jun" <jun.nakajima@intel.com>,
	Tom Lendacky <thomas.lendacky@amd.com>,
	"Kalra, Ashish" <ashish.kalra@amd.com>,
	Sean Christopherson <seanjc@google.com>,
	"linux-coco@lists.linux.dev" <linux-coco@lists.linux.dev>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] x86/random: Issue a warning if RDRAND or RDSEED fails
Date: Thu, 1 Feb 2024 04:52:56 -0600	[thread overview]
Message-ID: <20240201105256.GB17612@wind.enjellic.com> (raw)
In-Reply-To: <DM8PR11MB5750FDC379F54F8591246DF0E7432@DM8PR11MB5750.namprd11.prod.outlook.com>

On Thu, Feb 01, 2024 at 07:26:15AM +0000, Reshetova, Elena wrote:

Good morning to everyone.

> > On Wed, Jan 31, 2024 at 02:06:13PM +0100, Jason A. Donenfeld wrote:
> > 
> > Hi again to everyone, beautiful day here in North Dakota.
> > 
> > > On Wed, Jan 31, 2024 at 9:17???AM Reshetova, Elena
> > > <elena.reshetova@intel.com> wrote:
> > > > This matches both my understanding (I do have cryptography background
> > > > and understanding how cryptographic RNGs work)
> > > > and official public docs that Intel published on this matter.
> > > > Given that the physical entropy source is limited anyhow, and by giving
> > > > enough pressure on the whole construction you should be able to
> > > > make RDRAND fail because if the intermediate AES-CBC MAC extractor/
> > > > conditioner is not getting its min entropy input rate, it wont
> > > > produce a proper seed for AES CTR DRBG.
> > > > Of course exact details/numbers can wary between different generations of
> > > > Intel DRNG implementation, and the platforms where it is running on,
> > > > so be careful to sticking to concrete numbers.
> > 
> > > Alright, so RDRAND is not reliable. The question for us now is: do
> > > we want RDRAND unreliability to translate to another form of
> > > unreliability elsewhere, e.g. DoS/infiniteloop/latency/WARN_ON()? Or
> > > would it be better to declare the hardware simply broken and ask
> > > Intel to fix it? (I don't know the answer to that question.)
> > 
> > I think it would demonstrate a lack of appropriate engineering
> > diligence on the part of our community to declare RDRAND 'busted' at
> > this point.
> > 
> > While it appeares to be trivially easy to force RDSEED into depletion,
> > there does not seem to be a suggestion, at least in the open
> > literature, that this directly or easily translates into stalling
> > output from RDRAND in any type of relevant adversarial fashion.
> > 
> > If this were the case, given what CVE's seem to be worth on a resume,
> > someone would have rented a cloud machine and come up with a POC
> > against RDRAND in a multi-tenant environment and then promptly put up
> > a web-site called 'Random Starve' or something equally ominous.
> > 
> > This is no doubt secondary to the 1022x amplication factor inherent in
> > the 'Bull Mountain' architecture.
> > 
> > I'm a bit surprised that no one from the Intel side of this
> > conversation didn't pitch this over the wall as soon as this
> > conversation came up, but I would suggest that everyone concerned
> > about this issue give the following a thorough read:
> > 
> > https://www.intel.com/content/www/us/en/developer/articles/guide/intel-digital-
> > random-number-generator-drng-software-implementation-guide.html
> > 
> > Relevant highlights:
> > 
> > - As I suggested in my earlier e-mail, random number generation is a
> >   socket based resource, hence an adversarial domain limited to only
> >   the cores on a common socket.
> > 
> > - There is a maximum randomness throughput rate of 800 MB/s over all
> >   cores sharing common random number infrastructure.  Single thread
> >   throughput rates of 70-200 MB/s are demonstratable.
> > 
> > - A failure of RDRAND over 10 re-tries is 'astronomically' small, with
> >   no definition of astronomical provided, one would assume really
> >   small, given they are using the word astronomical.

> As I said, I want to investigate this properly before stating
> anything.  In a CoCo VM we cannot guarantee that a victim guest is
> able to execute this 10 re-try loop (there is also a tightness
> requirement listed in official guide that is not further specified)
> without interruption since all guest scheduling is under the host
> control. Again, this is the angle that was not present before and I
> want to make sure we are protected against this case.

I suspect that all of this may be the source of interesting
discussions inside of Intel, see my closing question below.

If nothing else, we will wait with baited breath for a definition of
astronomical, if of course, the definition of that value is
unprivileged and you would be free to forward it along... :-)

> > > > That said, I have taken an AR to follow up internally on what can be done
> > > > to improve our situation with RDRAND/RDSEED.
> > 
> > I think I can save you some time Elena.
> > 
> > > Specifying this is an interesting question. What exactly might our
> > > requirements be for a "non-broken" RDRAND? It seems like we have two
> > > basic ones:
> > >
> > > - One VMX (or host) context can't DoS another one.
> > > - Ring 3 can't DoS ring 0.
> > >
> > > I don't know whether that'd be implemented with context-tied rate
> > > limiting or more state or what. But I think, short of just making
> > > RDRAND never fail, that's basically what's needed.
> > 
> > I think we probably have that, for all intents and purposes, given
> > that we embrace the following methodogy:
> > 
> > - Use RDRAND exclusively.
> > 
> > - Be willing to take 10 swings at the plate.
> > 
> > - Given the somewhat demanding requirements for TDX/COCO, fail and
> >   either deadlock or panic after 10 swings since that would seem to
> >   suggest the hardware is broken, ie. RMA time.

> Again, my worry here that a CoCo guest is not in control of its own
> scheduling and this might make an impact on the above statement,
> i.e. it might theoretical be possible to cause this without
> physically broken HW.

So all of this leaves open a very significant question that would seem
to be worthy of further enlightenment from inside the bowels of
Intel engineering.

Our discussion has now led us to a point where there appears to be a
legitimate concern that the hypervisor has such significant control
over a confidential VM that the integrity of a simple re-try loop is
an open question.

Let us posit for argument, that confidential computing resolves down
to the implementation of a trusted computing platform that in turn
resolves to a requirement for competent and robust cryptography for
initial and ongoing attestation, let alone confidentiality in the face
of possible side-channel and timing attacks.

I'm sure there would be a great deal of interest in any information
that can be provided that this scenario is possible, given the level
of control that is being suggested that a hypervisor would enjoy over
an ostensibly confidential and trusted guest.

> Best Regards,
> Elena.

Have a good day.

As always,
Dr. Greg

The Quixote Project - Flailing at the Travails of Cybersecurity
              https://github.com/Quixote-Project

  reply	other threads:[~2024-02-01 10:57 UTC|newest]

Thread overview: 99+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-30  8:30 [PATCH 1/2] x86/random: Retry on RDSEED failure Kirill A. Shutemov
2024-01-30  8:30 ` [PATCH 2/2] x86/random: Issue a warning if RDRAND or RDSEED fails Kirill A. Shutemov
2024-01-30 12:37   ` Jason A. Donenfeld
2024-01-30 13:45     ` Reshetova, Elena
2024-01-30 14:21       ` Jason A. Donenfeld
2024-01-30 14:55         ` Reshetova, Elena
2024-01-30 15:00           ` Jason A. Donenfeld
2024-01-30 17:31       ` Dave Hansen
2024-01-30 17:49         ` Jason A. Donenfeld
2024-01-30 17:58           ` Dave Hansen
2024-01-30 18:15             ` H. Peter Anvin
2024-01-30 18:23               ` Jason A. Donenfeld
2024-01-30 18:23             ` Jason A. Donenfeld
2024-01-30 18:37               ` Dave Hansen
2024-01-30 18:05           ` Daniel P. Berrangé
2024-01-30 18:24             ` Jason A. Donenfeld
2024-01-30 18:31             ` Jason A. Donenfeld
2024-01-30 18:40             ` H. Peter Anvin
2024-01-31  8:16             ` Reshetova, Elena
2024-01-31 11:59               ` Dr. Greg
2024-01-31 13:06               ` Jason A. Donenfeld
2024-01-31 18:02                 ` Reshetova, Elena
2024-01-31 20:35                 ` Dr. Greg
2024-02-01  4:47                   ` Theodore Ts'o
2024-02-01  9:54                     ` Dr. Greg
2024-02-01 11:08                       ` Daniel P. Berrangé
2024-02-01 21:04                         ` Dr. Greg
2024-02-02  7:56                           ` Reshetova, Elena
2024-02-01  7:26                   ` Reshetova, Elena
2024-02-01 10:52                     ` Dr. Greg [this message]
2024-02-06  1:12               ` Dr. Greg
2024-02-06  8:04                 ` Daniel P. Berrangé
2024-02-06 12:04                   ` Dr. Greg
2024-02-06 13:00                     ` Daniel P. Berrangé
2024-02-08 10:31                       ` Dr. Greg
2024-02-06 13:50                     ` Daniel P. Berrangé
2024-02-06 15:35                     ` Borislav Petkov
2024-02-08 11:44                       ` Dr. Greg
2024-02-09 17:31                         ` Borislav Petkov
2024-02-09 19:49                           ` Jason A. Donenfeld
2024-02-09 20:37                             ` Dave Hansen
2024-02-09 21:45                             ` Borislav Petkov
2024-02-06 18:49                     ` H. Peter Anvin
2024-02-08 16:38                       ` Dr. Greg
2024-01-30 15:50   ` Kuppuswamy Sathyanarayanan
2024-01-30 12:29 ` [PATCH 1/2] x86/random: Retry on RDSEED failure Jason A. Donenfeld
2024-01-30 12:51   ` Jason A. Donenfeld
2024-01-30 13:10   ` Reshetova, Elena
2024-01-30 14:06     ` Jason A. Donenfeld
2024-01-30 14:43       ` Daniel P. Berrangé
2024-01-30 15:12         ` Jason A. Donenfeld
2024-01-30 18:35       ` Jason A. Donenfeld
2024-01-30 19:06         ` Reshetova, Elena
2024-01-30 19:16           ` Jason A. Donenfeld
2024-01-31  7:56             ` Reshetova, Elena
2024-01-31 13:14               ` Jason A. Donenfeld
2024-01-31 14:07                 ` Theodore Ts'o
2024-01-31 14:45                   ` Jason A. Donenfeld
2024-01-31 14:52                     ` Jason A. Donenfeld
2024-01-31 17:10                     ` Theodore Ts'o
2024-01-31 17:37                       ` Reshetova, Elena
2024-01-31 18:01                         ` Jason A. Donenfeld
2024-02-01  4:57                           ` Theodore Ts'o
2024-02-01 18:09                             ` Jason A. Donenfeld
2024-02-01 18:46                               ` Dave Hansen
2024-02-01 19:02                                 ` H. Peter Anvin
2024-02-02  7:25                               ` Reshetova, Elena
2024-02-02 15:39                                 ` Theodore Ts'o
2024-02-03 10:12                                   ` Jason A. Donenfeld
2024-02-09 19:53                                     ` Jason A. Donenfeld
2024-02-12  8:25                                       ` Reshetova, Elena
2024-02-12 16:32                                         ` Theodore Ts'o
2024-02-13  7:28                                           ` Dan Williams
2024-02-13 23:13                                             ` Theodore Ts'o
2024-02-14  0:53                                               ` Dan Williams
2024-02-14  4:32                                                 ` Theodore Ts'o
2024-02-14  6:48                                                   ` Dan Williams
2024-02-14  6:54                                                   ` Reshetova, Elena
2024-02-14  8:34                                                   ` Nikolay Borisov
2024-02-14  9:34                                                     ` Dr. Greg
2024-02-14 17:30                                         ` Jason A. Donenfeld
2024-02-14 15:18                                 ` Reshetova, Elena
2024-02-14 17:21                                   ` Jason A. Donenfeld
2024-02-14 17:59                                     ` Reshetova, Elena
2024-02-14 19:32                                       ` Jason A. Donenfeld
2024-02-15  7:07                                         ` Reshetova, Elena
2024-02-15 12:58                                           ` Jason A. Donenfeld
2024-02-14 19:46                                     ` Tom Lendacky
2024-02-14 20:04                                       ` Jason A. Donenfeld
2024-02-14 20:11                                         ` Theodore Ts'o
2024-02-15 13:01                                           ` Jason A. Donenfeld
2024-02-14 20:14                                     ` Dave Hansen
2024-02-02 15:47                               ` James Bottomley
2024-02-02 16:05                                 ` Theodore Ts'o
2024-02-02 21:28                                   ` James Bottomley
2024-02-03 14:35                                     ` Theodore Ts'o
2024-02-06 19:12                                       ` H. Peter Anvin
2024-01-30 15:20     ` H. Peter Anvin
2024-01-30 15:44 ` Kuppuswamy Sathyanarayanan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240201105256.GB17612@wind.enjellic.com \
    --to=greg@enjellic.com \
    --cc=Jason@zx2c4.com \
    --cc=ashish.kalra@amd.com \
    --cc=berrange@redhat.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=elena.reshetova@intel.com \
    --cc=hpa@zytor.com \
    --cc=jun.nakajima@intel.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.com \
    --cc=tytso@mit.edu \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®