Skip to contentSkip to conversation

Add chainloaded image as shim's verifiable object

PATCH In review Michael Chang 3 participants 6 messages Mar 5, 2021 – Mar 11, 2021

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Add chainloaded image as shim's verifiable object

While attempting to dual boot Microsoft Windows with efi chainloader, it failed with below error when secure boot was enabled.

error ../../grub-core/kern/verifiers.c:119:verification requested but nobody cares: /EFI/Microsoft/Boot/bootmgfw.efi.

It is a regression, as previously it worked without problem.

It turns out chainloading image has been locked down introduced by

578c95298 kern: Add lockdown support

However we should consider it as verifiable object to shim to allow booting in secure boot enabled mode. The chainloaded image could also have trusted signature signed by vendor with their pubkey cert in db. For that matters it's usage should not be locked down in secure boot, and instead use shim to validate it's signature before running it.

V2:
Keep GRUB_FILE_TYPE_EFI_CHAINLOADED_IMAGE in the lockdown list as it ensures at least one verifer has validated the image.

---
 grub-core/kern/efi/sb.c | 1 +
 1 file changed, 1 insertion(+)
grub-core/kern/efi/sb.c +1 -0
index 41dadcd14..96d237722 100644
@@ -129,6 +129,7 @@ shim_lock_verifier_init (grub_file_t io __attribute__ ((unused)),
     case GRUB_FILE_TYPE_BSD_KERNEL:
     case GRUB_FILE_TYPE_XNU_KERNEL:
     case GRUB_FILE_TYPE_PLAN9_KERNEL:
+    case GRUB_FILE_TYPE_EFI_CHAINLOADED_IMAGE:
       *flags = GRUB_VERIFY_FLAGS_SINGLE_CHUNK;
 
       /* Fall through. */
Signature · 1 line
2.26.2
Reviewed-by on v2 1/1
#1 lore raw
Quoted 18 lines · Michael Chang via Grub-devel

While attempting to dual boot Microsoft Windows with efi chainloader, it failed with below error when secure boot was enabled.

error ../../grub-core/kern/verifiers.c:119:verification requested but nobody cares: /EFI/Microsoft/Boot/bootmgfw.efi.

It is a regression, as previously it worked without problem.

It turns out chainloading image has been locked down introduced by

578c95298 kern: Add lockdown support

However we should consider it as verifiable object to shim to allow booting in secure boot enabled mode. The chainloaded image could also have trusted signature signed by vendor with their pubkey cert in db. For that matters it's usage should not be locked down in secure boot, and instead use shim to validate it's signature before running it.

Quoted 5 lines

V2:
Keep GRUB_FILE_TYPE_EFI_CHAINLOADED_IMAGE in the lockdown list as it ensures at least one verifer has validated the image.

Daniel

#2 lore raw
Quoted 19 lines · Daniel Kiper
Quoted 18 lines · Michael Chang via Grub-devel

While attempting to dual boot Microsoft Windows with efi chainloader, it failed with below error when secure boot was enabled.

error ../../grub-core/kern/verifiers.c:119:verification requested but nobody cares: /EFI/Microsoft/Boot/bootmgfw.efi.

It is a regression, as previously it worked without problem.

It turns out chainloading image has been locked down introduced by

578c95298 kern: Add lockdown support

However we should consider it as verifiable object to shim to allow booting in secure boot enabled mode. The chainloaded image could also have trusted signature signed by vendor with their pubkey cert in db. For that matters it's usage should not be locked down in secure boot, and instead use shim to validate it's signature before running it.

Quoted 7 lines
Quoted 5 lines

V2:
Keep GRUB_FILE_TYPE_EFI_CHAINLOADED_IMAGE in the lockdown list as it ensures at least one verifer has validated the image.

May I ask if the patch is planned or going to be merged to the master hence available in the 2.06-rc1 cut ?

Thanks,
Michael

Quoted 3 lines

Daniel

#3 lore raw

IS: 2.06-rc1 cut... WAS: Re: [PATCH v2] Add chainloaded image as shim's verifiable object

Quoted 24 lines · Michael Chang via Grub-devel
Quoted 23 lines · Daniel Kiper
Quoted 22 lines · Michael Chang via Grub-devel

While attempting to dual boot Microsoft Windows with efi chainloader, it failed with below error when secure boot was enabled.

error ../../grub-core/kern/verifiers.c:119:verification requested but nobody cares: /EFI/Microsoft/Boot/bootmgfw.efi.

It is a regression, as previously it worked without problem.

It turns out chainloading image has been locked down introduced by

578c95298 kern: Add lockdown support

However we should consider it as verifiable object to shim to allow booting in secure boot enabled mode. The chainloaded image could also have trusted signature signed by vendor with their pubkey cert in db. For that matters it's usage should not be locked down in secure boot, and instead use shim to validate it's signature before running it.

V2:
Keep GRUB_FILE_TYPE_EFI_CHAINLOADED_IMAGE in the lockdown list as it ensures at least one verifer has validated the image.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

May I ask if the patch is planned or going to be merged to the master hence available in the 2.06-rc1 cut ?

I have just pushed it together with other fixes and cleanups from the grub-devel. If you can see something important missing drop me a line immediately. Now I am working on 2.06-rc1 cut. If nothing blows up expect it tomorrow or on Friday...

Daniel

#4 lore raw

Re: IS: 2.06-rc1 cut... WAS: Re: [PATCH v2] Add chainloaded image as shim's verifiable object

Le 10/03/2021 à 17:06, Daniel Kiper a écrit :

Quoted 4 lines

I have just pushed it together with other fixes and cleanups from the grub-devel. If you can see something important missing drop me a line immediately. Now I am working on 2.06-rc1 cut. If nothing blows up expect it tomorrow or on Friday...

A least the disable-os-probing stuff works as expected, as far as I can tell.

Didier

#5 lore raw

Re: IS: 2.06-rc1 cut... WAS: Re: [PATCH v2] Add chainloaded image as shim's verifiable object

In reply to Daniel Kiper
Quoted 29 lines · Daniel Kiper
Quoted 28 lines · Michael Chang via Grub-devel
Quoted 26 lines · Daniel Kiper
Quoted 18 lines · Michael Chang via Grub-devel

While attempting to dual boot Microsoft Windows with efi chainloader, it failed with below error when secure boot was enabled.

error ../../grub-core/kern/verifiers.c:119:verification requested but nobody cares: /EFI/Microsoft/Boot/bootmgfw.efi.

It is a regression, as previously it worked without problem.

It turns out chainloading image has been locked down introduced by

578c95298 kern: Add lockdown support

However we should consider it as verifiable object to shim to allow booting in secure boot enabled mode. The chainloaded image could also have trusted signature signed by vendor with their pubkey cert in db. For that matters it's usage should not be locked down in secure boot, and instead use shim to validate it's signature before running it.

Quoted 5 lines

V2:
Keep GRUB_FILE_TYPE_EFI_CHAINLOADED_IMAGE in the lockdown list as it ensures at least one verifer has validated the image.

Quoted 7 lines
Quoted 2 lines

May I ask if the patch is planned or going to be merged to the master hence available in the 2.06-rc1 cut ?

I have just pushed it together with other fixes and cleanups from the grub-devel. If you can see something important missing drop me a line immediately. Now I am working on 2.06-rc1 cut. If nothing blows up expect it tomorrow or on Friday...

Many thanks to picking up the patch. Tested the efi chainloader now could successfully load and start the signed uefi binary, meanwhile reject the one with invalid signature in secure boot enabled mode. This function is restored.

Thanks,
Michael

Quoted 3 lines

Daniel