[PATCH v7 4/5] efi: Load efi_secret module if EFI secret area is populated
Dov Murik
dovmurik at linux.ibm.com
Thu Feb 3 11:03:58 UTC 2022
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
More information about the Linux-security-module-archive
mailing list