Skip to contentSkip to conversation

boot: don't enable the non-secure boot commands by default if secure boot enabled

PATCH NAK Rover Mo 2 participants 3 messages May 20, 2022

lore
Share & tools
lore

Rover Mo

author
#0 lore raw

PATCH v3 1/2 boot: don't enable the non-secure boot commands by default if secure boot enabled

To prevent booting unsigned images, don't enable the non-secure boot commands(booti, bootz .etc) by default if secure boot enabled.

---
 boot/Kconfig |  2 +-
 cmd/Kconfig  | 11 +++++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)
boot/Kconfig +1 -1
index dff4d23b88..cebe4e24fe 100644
@@ -407,7 +407,7 @@ endif
 
 config LEGACY_IMAGE_FORMAT
 	bool "Enable support for the legacy image format"
-	default y if !FIT_SIGNATURE && !TI_SECURE_DEVICE
+	default y if !FIT_SIGNATURE && !TI_SECURE_DEVICE && !EFI_SECURE_BOOT
 	help
 	  This option enables the legacy image format. It is enabled by
 	  default for backward compatibility, unless FIT_SIGNATURE is
cmd/Kconfig +9 -2
index 69c1814d24..6baa85bfdd 100644
@@ -259,15 +259,22 @@ config BOOTM_EFI
 
 config CMD_BOOTZ
 	bool "bootz"
+	default y if !FIT_SIGNATURE && !EFI_SECURE_BOOT
 	help
 	  Boot the Linux zImage
+	  The booti command is used for launching unsigned Linux zImage.
+	  If you want to have secure boot either via signed FIT images or via
+	  signed UEFI images, this option should be disabled.
 
 config CMD_BOOTI
 	bool "booti"
 	depends on ARM64 || RISCV
-	default y
+	default y if !FIT_SIGNATURE && !EFI_SECURE_BOOT
 	help
-	  Boot an AArch64 Linux Kernel image from memory.
+	  Boot an AArch64/RISC-V Linux Kernel image from memory.
+	  The booti command is used for launching unsigned AArch64 and RISC-V
+	  Linux kernel images. If you want to have secure boot either via signed
+	  FIT images or via signed UEFI images, this option should be disabled.
 
 config BOOTM_LINUX
 	bool "Support booting Linux OS images"
Signature · 1 line
2.25.1
#1 lore raw

Am 20. Mai 2022 04:58:46 MESZ schrieb Rover Mo <[email protected]>:

Quoted 17 lines

To prevent booting unsigned images, don't enable the non-secure boot commands(booti, bootz .etc) by default if secure boot enabled.

---
boot/Kconfig | 2 +-
cmd/Kconfig | 11 +++++++++--

2 files changed, 10 insertions(+), 3 deletions(-)
boot/Kconfig +0 -0
index dff4d23b88..cebe4e24fe 100644
@@ -407,7 +407,7 @@ endif
 

config LEGACY_IMAGE_FORMAT
bool "Enable support for the legacy image format"

boot/Kconfig endif · line 410

Quoted 2 lines
boot/Kconfig +1 -1
-	default y if !FIT_SIGNATURE && !TI_SECURE_DEVICE
+	default y if !FIT_SIGNATURE && !TI_SECURE_DEVICE && !EFI_SECURE_BOOT

Having EFI_SECURE_BOOT=y is not enough to use secure boot. You must also supply variables PK, KEK, db, dbx.

Furthermore you would have to disable a whole lot more commands to secure the device.

Currently we have patches in review to provide a bootmenu with optionally no access to the console. This is a better approach.

Best regards

Heinrich

Quoted 34 lines

help
This option enables the legacy image format. It is enabled by default for backward compatibility, unless FIT_SIGNATURE is

cmd/Kconfig +0 -0
index 69c1814d24..6baa85bfdd 100644
@@ -259,15 +259,22 @@ config BOOTM_EFI
 

config CMD_BOOTZ
bool "bootz"

cmd/Kconfig +1 -0
+	default y if !FIT_SIGNATURE && !EFI_SECURE_BOOT

help
Boot the Linux zImage

cmd/Kconfig +3 -0
+	  The booti command is used for launching unsigned Linux zImage.
+	  If you want to have secure boot either via signed FIT images or via
+	  signed UEFI images, this option should be disabled.

config CMD_BOOTI

	bool "booti"
	depends on ARM64 || RISCV
cmd/Kconfig +1 -1
-	default y
+	default y if !FIT_SIGNATURE && !EFI_SECURE_BOOT

help

cmd/Kconfig +4 -1
-	  Boot an AArch64 Linux Kernel image from memory.
+	  Boot an AArch64/RISC-V Linux Kernel image from memory.
+	  The booti command is used for launching unsigned AArch64 and RISC-V
+	  Linux kernel images. If you want to have secure boot either via signed
+	  FIT images or via signed UEFI images, this option should be disabled.

config BOOTM_LINUX
bool "Support booting Linux OS images"

Signature · 1 line
2.25.1
author
#2 lore raw
Quoted 8 lines · Heinrich Schuchardt

Am 20. Mai 2022 04:58:46 MESZ schrieb Rover Mo <[email protected]>:

Having EFI_SECURE_BOOT=y is not enough to use secure boot. You must also supply variables PK, KEK, db, dbx.

Furthermore you would have to disable a whole lot more commands to secure the device.

Currently we have patches in review to provide a bootmenu with optionally no access to the console. This is a better approach.

Thank you for your explanation.

Please forget my patches.

Best regards,
Rover Mo