[PATCH for-11.2] hw/uefi: accept a PK enrolled in setup mode

Martin Pitt posted 1 patch 19 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/awkUHTIhRM._5FDHrTR@piware.de
Maintainers: Gerd Hoffmann <kraxel@redhat.com>
hw/uefi/var-service-auth.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH for-11.2] hw/uefi: accept a PK enrolled in setup mode
Posted by Martin Pitt 19 hours ago
From: Martin Pitt <martin@amutable.com>

uefi_vars_check_auth_2_sb() returns an efi_status. Commit cc3cf42e618a
changed it to return "true" for the "no self-signed PK is required" code
path. That value 1 is interpreted as EFI_WARN_UNKNOWN_GLYPH, so
uefi_vars_mm_set_variable() rejects the write, and the guest can never
enroll its own PK. Return the correct code to fix this.

Since commit a1b96fcde870 ("hw/uefi: improve default config security")
a self-signed PK is not required by default. This bug can be worked
around by forcing the still working old code path:

  -global uefi-vars-sysbus.require-self-signed-pk=on

Fixes: cc3cf42e618a ("hw/uefi: add require-self-signed-pk config option")
Signed-off-by: Martin Pitt <martin@amutable.com>
---
 hw/uefi/var-service-auth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/uefi/var-service-auth.c b/hw/uefi/var-service-auth.c
index 21fc50f904..744c2cc193 100644
--- a/hw/uefi/var-service-auth.c
+++ b/hw/uefi/var-service-auth.c
@@ -214,7 +214,7 @@ static efi_status uefi_vars_check_auth_2_sb(uefi_vars_state *uv,
             };
             return uefi_vars_check_pkcs7_2(&tmp, NULL, NULL, va, data);
         } else {
-            return true;
+            return EFI_SUCCESS;
         }
     }
 
-- 
2.56.0
Re: [PATCH for-11.2] hw/uefi: accept a PK enrolled in setup mode
Posted by Philippe Mathieu-Daudé 13 hours ago
On 27/11/26 06:24, Martin Pitt wrote:
> From: Martin Pitt <martin@amutable.com>
> 
> uefi_vars_check_auth_2_sb() returns an efi_status. Commit cc3cf42e618a
> changed it to return "true" for the "no self-signed PK is required" code
> path. That value 1 is interpreted as EFI_WARN_UNKNOWN_GLYPH, so
> uefi_vars_mm_set_variable() rejects the write, and the guest can never
> enroll its own PK. Return the correct code to fix this.
> 
> Since commit a1b96fcde870 ("hw/uefi: improve default config security")
> a self-signed PK is not required by default. This bug can be worked
> around by forcing the still working old code path:
> 
>    -global uefi-vars-sysbus.require-self-signed-pk=on
> 
> Fixes: cc3cf42e618a ("hw/uefi: add require-self-signed-pk config option")
> Signed-off-by: Martin Pitt <martin@amutable.com>
> ---
>   hw/uefi/var-service-auth.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>