public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: James Bottomley <jejb@linux.ibm.com>
To: Brijesh Singh <brijesh.singh@amd.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: devel@edk2.groups.io, dovmurik@linux.vnet.ibm.com,
	Dov.Murik1@il.ibm.com, ashish.kalra@amd.com, tobin@ibm.com,
	david.kaplan@amd.com, jon.grimm@amd.com, thomas.lendacky@amd.com,
	frankeh@us.ibm.com
Subject: Re: [PATCH 0/4] SEV Encrypted Boot for Ovmf
Date: Thu, 12 Nov 2020 14:50:24 -0800	[thread overview]
Message-ID: <c3faffc4b34237b897ff2735cff03edf150f6c21.camel@linux.ibm.com> (raw)
In-Reply-To: <5890c3a4-a480-0ca7-55fd-550a91d8ecb1@amd.com>

On Thu, 2020-11-12 at 15:56 -0600, Brijesh Singh wrote:
> On 11/12/20 1:38 PM, Dr. David Alan Gilbert wrote:
> > * Brijesh Singh (brijesh.singh@amd.com) wrote:
> > > Hi James,
> > > 
> > > Thanks for series, I glanced at it, the changes looks okay to me.
> > > I have one questions.
> > > 
> > > How does the grub locate the disk decryption key ? Am I correct
> > > in assuming that the gurb is iterating through a configuration
> > > table entries and comparing the Secret GUID to locate the secret
> > > key. As per the SEV spec, its possible that a guest owner can
> > > call the secret injection more than once. I don't see the patch
> > > consider that case, should we support this or limit to one
> > > inject?  Maybe Qemu can enforce this property.
> > That's interesting, I hadn't realised that was possible - however,
> > I can't see a way to use it - for it to be useful, you would have
> > to have a way for the guest to communicate to the owner that it had
> > finished with the first injection and would like the next; but if
> > you already have a way to communicate from the guest to the owner
> > to request stuff, then you could pass a new secret by that comms
> > route?
> 
> The main reason for its existence was to allow guest owner to inject
> multiple blocks of the data if they need to do so, e.g IIRC, Enarx
> folks use this to inject the keep which is much bigger than 128K.

In some ways this sounds like the wrong approach.  I mean we could use
injection to inject the entire VM image as well, but we don't, we
inject the key and decrypt the image ... it does rather sound like
that's what should be happening for other bulk data, like the keep.  If
you do it this way you can use the main CPU and bulk memory encryption
to pull the data into the secure memory rather than using the PSP,
which is a lot slower.

Also one of the problems with having OVMF define the secret location is
that we have to find space in the MEMFD.  For a single page like the
current implementation uses, that's easy, but for tens to hundreds of
pages it would be impossible.  Even if we guid describe everything,
standard aes keys are 16-32 bytes, so even in the worst case we can fit
85 guid described decryption keys in a page, which should be more than
enough for anyone, provided we inject the key to the bulk data, not the
bulk data itself.

>  I am not sure if we really need it for the VM boot flow but we
> probably need to define the secret page layout such that it contains
> multiple entries in it. In our case the Secret can't be more than a
> page, so, we can define a secret page layout such that it can contain
> more than one disk key. I was thinking about something like this
> 
> typedef enum {
> 
>    DISK_KEY_AES_128,
> 
>    SSH_PRIVATE_KEY,
> 
>    ...
> 
> } data_type;
> 
> struct secret_data {
> 
>    u8 entries;
> 
>    struct {
> 
>       data_type type;
> 
>       u16 len;
> 
>       u8 name[16];
> 
>       u8 data[];
> 
>    } entry[];
> 
> }
> 
> This should allow us to package multiple secrets in one inject.

I proposed something slightly different in a prior email.  If we use
the guid approach, we don't have to define the data structure a-priori
... just the producer and consumer have to agree on what it is.

> > > Do you see any need for the Linux kernel needing to access the
> > > secret? Since the secret blob is available through configuration
> > > table, I believe we can have a platform driver that can read the
> > > configuration table and retrieve the secret blob.
> > I guess it depends if you get the Grub to pass the fs secret down
> > to the kernel or let it pick it up itself from the same place.
> 
> I guess the main reason why I was asking this is, what if guest owner
> provides more than one disk keys in the secret injection blob. Grub
> can use the boot disk key to access the Linux images and other disk
> keys may later be used by Linux.

Right, see other email for limitations.

James



  reply	other threads:[~2020-11-12 22:50 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-12  0:13 [PATCH 0/4] SEV Encrypted Boot for Ovmf James Bottomley
2020-11-12  0:13 ` [PATCH 1/4] OvmfPkg/Amdsev: Base commit to build encrypted boot specific OVMF James Bottomley
2020-11-16 19:11   ` [edk2-devel] " Laszlo Ersek
2020-11-16 20:00     ` James Bottomley
2020-11-12  0:13 ` [PATCH 2/4] OvmfPkg/AmdSev: add Grub Firmware Volume Package James Bottomley
2020-11-16 20:42   ` [edk2-devel] " Laszlo Ersek
2020-11-17  0:05     ` Laszlo Ersek
2020-11-18 23:00     ` James Bottomley
2020-11-19  7:59       ` Laszlo Ersek
2020-11-12  0:13 ` [PATCH 3/4] OvmfPkg: create a SEV secret area in the AmdSev memfd James Bottomley
2020-11-16 22:46   ` [edk2-devel] " Laszlo Ersek
2020-11-18 20:23     ` James Bottomley
2020-11-19  7:50       ` Laszlo Ersek
2020-11-19 19:41         ` Brijesh Singh
2020-11-20  6:29           ` jejb
2020-11-20 10:59             ` Laszlo Ersek
2020-11-18 20:39     ` Lendacky, Thomas
2020-11-19  7:51       ` Laszlo Ersek
2020-11-12  0:13 ` [PATCH 4/4] OvmfPkg/AmdSev: Expose the Sev Secret area using a configuration table James Bottomley
2020-11-17  0:12   ` [edk2-devel] " Laszlo Ersek
2020-11-12 16:21 ` [PATCH 0/4] SEV Encrypted Boot for Ovmf Ashish Kalra
2020-11-12 16:34   ` Dr. David Alan Gilbert
2020-11-12 17:07     ` James Bottomley
2020-11-12 17:22       ` Ashish Kalra
2020-11-12 17:32 ` Brijesh Singh
2020-11-12 19:38   ` Dr. David Alan Gilbert
2020-11-12 21:56     ` Brijesh Singh
2020-11-12 22:50       ` James Bottomley [this message]
2020-11-15 14:08         ` Brijesh Singh
2020-11-12 19:44   ` James Bottomley
2020-11-13  2:04 ` [edk2-devel] " James Bottomley
2020-11-13 22:41 ` Laszlo Ersek
2020-11-16 18:50 ` Laszlo Ersek
2020-11-16 18:56   ` Laszlo Ersek
2020-11-16 19:55   ` James Bottomley

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-list 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=c3faffc4b34237b897ff2735cff03edf150f6c21.camel@linux.ibm.com \
    --to=devel@edk2.groups.io \
    /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