[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <815ba487-a6c1-0daa-aead-a7f3a52df2a1@linux.ibm.com>
Date: Thu, 3 Feb 2022 13:03:58 +0200
From: Dov Murik <dovmurik@...ux.ibm.com>
To: Gerd Hoffmann <kraxel@...hat.com>
Cc: linux-efi@...r.kernel.org, Borislav Petkov <bp@...e.de>,
Ashish Kalra <ashish.kalra@....com>,
Brijesh Singh <brijesh.singh@....com>,
Tom Lendacky <thomas.lendacky@....com>,
Ard Biesheuvel <ardb@...nel.org>,
James Morris <jmorris@...ei.org>,
"Serge E. Hallyn" <serge@...lyn.com>,
Andi Kleen <ak@...ux.intel.com>,
Greg KH <gregkh@...uxfoundation.org>,
Andrew Scull <ascull@...gle.com>,
Dave Hansen <dave.hansen@...el.com>,
"Dr. David Alan Gilbert" <dgilbert@...hat.com>,
Lenny Szubowicz <lszubowi@...hat.com>,
Peter Gonda <pgonda@...gle.com>,
James Bottomley <jejb@...ux.ibm.com>,
Tobin Feldman-Fitzthum <tobin@...ux.ibm.com>,
Jim Cadden <jcadden@....com>,
Daniele Buono <dbuono@...ux.vnet.ibm.com>,
linux-coco@...ts.linux.dev, linux-security-module@...r.kernel.org,
linux-kernel@...r.kernel.org, Dov Murik <dovmurik@...ux.ibm.com>
Subject: Re: [PATCH v7 4/5] efi: Load efi_secret module if EFI secret area is
populated
On 03/02/2022 8:16, Gerd Hoffmann wrote:
> Hi,
>
>>> I think the module should fail noisily. See above for autoload. In
>>> case the module is loaded (either manually by the admin, or because
>>> efi.coco_secret != EFI_INVALID_TABLE_ADDR) and it can't actually load
>>> the secrets we want know why ...
>>
>> Note that the AmdSev build of OVMF always publishes
>> LINUX_EFI_COCO_SECRET_TABLE_GUID in the EFI table. Even when
>> LAUNCH_SECRET was not executed. In such cases the secret area will be
>> empty.
>
> Hmm, ok. Why? I assume the secret area is filled by the host and ovmf
> doesn't even look at it?
>
Exactly. OVMF just reserves this area, and puts its address+size in the
EFI config table. It doesn't care about its format and usage.
There are currently two "users" for the actual data in this memory area:
1. grub's efisecret module (which reads the disk passphrase from an
entry in the secret area)
2. linux's efi_secret module (which we're discussing here)
>> If we keep only the 'efi.coco_secret != EFI_INVALID_TABLE_ADDR' check,
>> we'll get errors from efi_secret for every VM launch that doesn't
>> undergo LAUNCH_SECRET. I don't think that's good.
>
> Well, if that is a common case the module could either print nothing or
> log KERN_INFO level instead of KERN_ERROR.
>
What if the user doesn't inject a secret and doesn't include the
efi_secret module at all in the initrd? request_module("efi_secret")
will fail.
I can ignore the error code of request_module("efi_secret") but that
feels bad.
>> If we *do* want to check that the area starts with
>> EFI_SECRET_TABLE_HEADER_GUID (like I think we should), we need all the
>> checks before that, like checking that the area is big enough, and that
>> all the memremap()s succeed -- before actually comparing the
>> header_guid. The checks are basically prerequisites for calling
>> efi_guidcmp() safely.
>
> It is still not fully clear to me why you want do that check twice.
>
I want to load the module only if secrets were injected by the Guest
Owner.
Again, I'm open to ideas on how to de-duplicate these early checks, if
that's important.
-Dov
Powered by blists - more mailing lists