From: Joerg Roedel <jroedel@suse.de>
To: David Rientjes <rientjes@google.com>
Cc: Borislav Petkov <bp@alien8.de>, Andy Lutomirski <luto@kernel.org>,
Sean Christopherson <seanjc@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Andi Kleen <ak@linux.intel.com>,
Brijesh Singh <brijesh.singh@amd.com>,
Tom Lendacky <thomas.lendacky@amd.com>,
Jon Grimm <jon.grimm@amd.com>,
Thomas Gleixner <tglx@linutronix.de>,
Christoph Hellwig <hch@lst.de>,
Peter Zijlstra <peterz@infradead.org>,
Paolo Bonzini <pbonzini@redhat.com>,
Ingo Molnar <mingo@redhat.com>,
x86@kernel.org, linux-mm@kvack.org
Subject: Re: AMD SEV-SNP/Intel TDX: validation of memory pages
Date: Fri, 12 Feb 2021 14:19:07 +0100 [thread overview]
Message-ID: <20210212131907.GI5453@suse.de> (raw)
In-Reply-To: <7515a81a-19e-b063-2081-3f5e79f0f7a8@google.com>
Hi,
On Mon, Feb 01, 2021 at 05:51:09PM -0800, David Rientjes wrote:
> I think quite invasive changes are needed for the guest to support lazy
> validation/acceptance to core areas that lots of people on the recipient
> list have strong opinions about. Some things that come to mind:
>
> - Annotations for pages that must be pre-validated in the x86 boot
> sequence, including IST stacks
The problem is two-fold:
1. How to pass the information about pre-validated memory
through the whole boot process. This includes firmware,
boot-loader, Kernel decompressor and the early Linux boot
code.
2. How to keep track of validated memory at systems runtime.
(I omit the kexec case for now)
For 1. the best option I see is passing this information as part of the
Linux boot protocol:
- First we should require from the firmware that everything in
the memmap which is not marked as E820 Usable is already
validated. This includes any memory used by the firmware
itself.
- Then we can pass this information up the boot process by
extending struct boot_params. The bootloader can pass which
E820 usable memory it validated, same for the kernel
decompressor. The text+data (but not bss) of the running
kernel image is per definition validated by the decompressor
and does not need to be added explicitly to boot_params.
- Once the running kernel image took over there are multiple
choices. The simplest is probably to keep a validation log,
but other data structures can work too until the memmap is set
up.
The benefit of passing it up via boot_params is that the whole process
does not necessarily rely on EFI. There are some use-cases for SNP and
TDX like lightweight container runtimes with only minimal or even no
firmware.
> - Proliferation of these annotations throughout any kernel code that can
> access memory for #VC or #VE
>
> - Handling lazy validation of guest memory through the core mm layer,
> most likely involving a bit in struct page flags to track their status
Yes, I would also prefer tracking the validation info in 'struct page',
once those are set up. We can discuss different options, there is no
strict need for using struct page, it just seems natural to me.
> - Any need for validating memory that is not backed by struct page that
> needs to be special-cased
When everything that is not E820 Usable is already validated then this
should be a no-brainer. Shared memory with the HV and MMIO memory is not
guest private anyway, so there should be no issues. Just a page_is_ram()
check in the #VC/#VE handler is needed.
Regards,
Joerg
next prev parent reply other threads:[~2021-02-12 13:19 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-02 1:51 David Rientjes
2021-02-02 13:17 ` Matthew Wilcox
2021-02-02 16:02 ` Kirill A. Shutemov
2021-02-03 0:16 ` Brijesh Singh
2021-02-11 17:46 ` Sean Christopherson
2021-02-02 22:37 ` Andi Kleen
2021-02-11 20:46 ` Peter Zijlstra
2021-02-12 13:19 ` Joerg Roedel [this message]
2021-02-12 14:17 ` Peter Zijlstra
2021-02-12 14:53 ` Joerg Roedel
2021-02-12 15:19 ` Peter Zijlstra
2021-02-12 15:28 ` Joerg Roedel
2021-02-12 16:12 ` Peter Zijlstra
2021-02-12 16:18 ` Joerg Roedel
2021-02-12 16:45 ` Peter Zijlstra
2021-02-12 17:48 ` Dave Hansen
2021-02-12 18:22 ` Sean Christopherson
2021-02-12 18:38 ` Andy Lutomirski
2021-02-12 18:43 ` Sean Christopherson
2021-02-12 18:46 ` Dave Hansen
2021-02-12 19:24 ` Sean Christopherson
2021-02-16 10:00 ` Joerg Roedel
2021-02-16 14:27 ` Andi Kleen
2021-02-16 14:46 ` Peter Zijlstra
2021-02-16 15:59 ` Paolo Bonzini
2021-02-16 16:25 ` Joerg Roedel
2021-02-16 16:48 ` Paolo Bonzini
2021-02-16 18:26 ` Joerg Roedel
2021-02-16 18:33 ` Paolo Bonzini
2021-02-16 16:47 ` Peter Zijlstra
2021-02-16 16:57 ` Andy Lutomirski
2021-02-16 17:05 ` Paolo Bonzini
2021-02-16 16:55 ` Andi Kleen
2021-02-12 21:42 ` Andi Kleen
2021-02-12 21:58 ` Peter Zijlstra
2021-02-12 22:39 ` Andi Kleen
2021-02-12 22:46 ` Andy Lutomirski
2021-02-13 9:38 ` Peter Zijlstra
2021-02-12 23:51 ` Paolo Bonzini
2021-03-23 9:33 ` Joerg Roedel
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=20210212131907.GI5453@suse.de \
--to=jroedel@suse.de \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=bp@alien8.de \
--cc=brijesh.singh@amd.com \
--cc=hch@lst.de \
--cc=jon.grimm@amd.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-mm@kvack.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=rientjes@google.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--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