Skip to content

Commit 20ffd92

Browse files
dubekardbiesheuvel
authored andcommitted
efi: Register efi_secret platform device if EFI secret area is declared
During efi initialization, check if coco_secret is defined in the EFI configuration table; in such case, register platform device "efi_secret". This allows udev to automatically load the efi_secret module (platform driver), which in turn will populate the <securityfs>/secrets/coco directory in guests into which secrets were injected. Note that a declared address of an EFI secret area doesn't mean that secrets where indeed injected to that area; if the secret area is not populated, the driver will not load (but the platform device will still be registered). Signed-off-by: Dov Murik <dovmurik@linux.ibm.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Link: https://lore.kernel.org/r/20220412212127.154182-4-dovmurik@linux.ibm.com Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
1 parent cbabf03 commit 20ffd92

File tree

1 file changed

+5
-0
lines changed
  • drivers/firmware/efi

1 file changed

+5
-0
lines changed

drivers/firmware/efi/efi.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,11 @@ static int __init efisubsys_init(void)
425425
if (efi_enabled(EFI_DBG) && efi_enabled(EFI_PRESERVE_BS_REGIONS))
426426
efi_debugfs_init();
427427

428+
#ifdef CONFIG_EFI_COCO_SECRET
429+
if (efi.coco_secret != EFI_INVALID_TABLE_ADDR)
430+
platform_device_register_simple("efi_secret", 0, NULL, 0);
431+
#endif
432+
428433
return 0;
429434

430435
err_remove_group:

0 commit comments

Comments
 (0)