public inbox for linux-coco@lists.linux.dev
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Dave Hansen <dave.hansen@intel.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "Theodore Ts'o" <tytso@mit.edu>,
	"Jason A. Donenfeld" <Jason@zx2c4.com>,
	Kuppuswamy Sathyanarayanan
	<sathyanarayanan.kuppuswamy@linux.intel.com>,
	Elena Reshetova <elena.reshetova@intel.com>,
	Jun Nakajima <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-kernel@vger.kernel.org
Subject: Re: [RFC] Randomness on confidential computing platforms
Date: Mon, 29 Jan 2024 13:38:32 -0800	[thread overview]
Message-ID: <CA4D4182-8D65-4CEB-A173-68B92B04641B@zytor.com> (raw)
In-Reply-To: <CC681F94-469C-4225-A075-C5F9129E7D96@zytor.com>

On January 29, 2024 1:17:07 PM PST, "H. Peter Anvin" <hpa@zytor.com> wrote:
>On January 29, 2024 1:04:23 PM PST, Dave Hansen <dave.hansen@intel.com> wrote:
>>On 1/29/24 12:26, Kirill A. Shutemov wrote:
>>>>> Do we care?
>>>> I want to make sure I understand the scenario:
>>>>
>>>>  1. We're running in a guest under TDX (or SEV-SNP)
>>>>  2. The VMM (or somebody) is attacking the guest by eating all the
>>>>     hardware entropy and RDRAND is effectively busted
>>>>  3. Assuming kernel-based panic_on_warn and WARN_ON() rdrand_long()
>>>>     failure, that rdrand_long() never gets called.
>>> Never gets called during attack. It can be used before and after.
>>> 
>>>>  4. Userspace is using RDRAND output in some critical place like key
>>>>     generation and is not checking it for failure, nor mixing it with
>>>>     entropy from any other source
>>>>  5. Userspace uses the failed RDRAND output to generate a key
>>>>  6. Someone exploits the horrible key
>>>>
>>>> Is that it?
>>> Yes.
>>
>>Is there something that fundamentally makes this a VMM vs. TDX guest
>>problem?  If a malicious VMM can exhaust RDRAND, why can't malicious
>>userspace do the same?
>>
>>Let's assume buggy userspace exists.  Is that userspace *uniquely*
>>exposed to a naughty VMM or is that VMM just added to the list of things
>>that can attack buggy userspace?
>
>The concern, I believe, is that a TDX guest is vulnerable as a *victim*, especially if the OS is being malicious.
>
>However, as you say a malicious user space including a conventional VM could try to use it to attack another. The only thing we can do in the kernel about that is to be resilient.
>
>Note that there is an option to the kernel to suspend boot until enough entropy has been gathered that predicting the output of the entropy pool in the kernel ought to be equivalent to breaking AES (in which case we have far worse problems.) To harden the VM case in general perhaps we should consider RDRAND to have zero entropy credit when used as a fallback for RDSEED.
>

It is probably worth pointing out, too, that in reality the specs for RDRAND/RDSEED are *extremely* sandbagged. The architect told me that it is extremely unlikely that we will *ever* see a failure due to exhaustion, even if it is executed continuously on all cores – the randomness production rate exceeds the bandwidth of the bus in uncore.

  reply	other threads:[~2024-01-29 21:39 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-26 13:42 [RFC] Randomness on confidential computing platforms Kirill A. Shutemov
2024-01-26 14:46 ` Nikolay Borisov
2024-01-26 15:42   ` Reshetova, Elena
2024-01-26 15:57     ` Daniel P. Berrangé
2024-01-26 16:35       ` Nikolay Borisov
2024-01-29  7:15         ` Reshetova, Elena
2024-01-26 15:23 ` Sean Christopherson
2024-01-29 10:27   ` Kirill A. Shutemov
2024-01-29 16:30 ` Dave Hansen
2024-01-29 16:37   ` H. Peter Anvin
2024-01-29 16:41   ` Kirill A. Shutemov
2024-01-29 17:07     ` H. Peter Anvin
2024-01-29 18:55     ` Dave Hansen
2024-01-29 20:26       ` Kirill A. Shutemov
2024-01-29 21:04         ` Dave Hansen
2024-01-29 21:17           ` H. Peter Anvin
2024-01-29 21:38             ` H. Peter Anvin [this message]
2024-01-29 22:12             ` H. Peter Anvin
2024-01-29 21:33           ` Kirill A. Shutemov
2024-01-29 22:18             ` Dave Hansen
2024-01-29 23:32               ` H. Peter Anvin
2024-01-30  8:19                 ` Reshetova, Elena
2024-01-30  8:01             ` Reshetova, Elena

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=CA4D4182-8D65-4CEB-A173-68B92B04641B@zytor.com \
    --to=hpa@zytor.com \
    --cc=Jason@zx2c4.com \
    --cc=ashish.kalra@amd.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=elena.reshetova@intel.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