Skip to contentSkip to conversation

Add support for secure boot in falcon mode

RFC PATCH In review Anshul Dalal 2 participants 13 messages Jun 26, 2025 – Jun 27, 2025

lore
Share & tools
lore
#0 lore raw

cover Add support for secure boot in falcon mode

Hi all,

With my ongoing work in supporting falcon mode on TI's AM62 platforms[1], I have encountered several limitations of falcon boot flow from a security PoV. Currently falcon mode requires an args binary (usually a DTB) and the kernel image to boot.

This conflicts with secure boot which requires a signed fitImage to be loaded with the kernel and dtb packaged in a single FIT container among other issues. This patch series adds a new SPL_SECURE_OS_BOOT config symbols which disables loading the args file as well as fallback to U-Boot if enabled.

The changes have currently only been verified on MMC FS boot but I can expand support to other boot media if this is the right direction for achieving secure falcon boot.

Happy booting,
Anshul
---
[1]: https://lore.kernel.org/u-boot/[email protected]/
---
Anshul Dalal (4):
spl: Kconfig: add SPL_SECURE_OS_BOOT config symbol
spl: Kconfig: allow disabling fallback during os boot
spl: Kconfig: disallow loading args in falcon mode
cmd: Kconfig: disable loading raw images in secure os boot

 cmd/Kconfig          |  3 +-
 common/spl/Kconfig   | 27 ++++++++++++++
 common/spl/spl_ext.c |  5 +++
 common/spl/spl_fat.c |  5 +++
 common/spl/spl_mmc.c | 87 ++++++++++++++++++++++++++++----------------
 5 files changed, 94 insertions(+), 33 deletions(-)
Signature · 1 line
2.49.0
#1 lore raw

RFC PATCH 1/4 spl: Kconfig: add SPL_SECURE_OS_BOOT config symbol

This patch adds the new SPL_SECURE_OS_BOOT symbol that enables secure boot flow in falcon mode.

---
 common/spl/Kconfig | 7 +++++++
 1 file changed, 7 insertions(+)
common/spl/Kconfig +7 -0
index 880192043c4..8d153c2e9c9 100644
@@ -1196,6 +1196,13 @@ config SPL_OS_BOOT
 	  Enable booting directly to an OS from SPL.
 	  for more info read doc/README.falcon
 
+config SPL_SECURE_OS_BOOT
+	bool "Activate Secure Falcon Mode"
+	depends on SPL_OS_BOOT
+	help
+	  Enables support for secure boot in falcon mode by restricting the SPL to
+	  only loading a fitImage instead of raw kernel images or DTBs.
+
 config SPL_PAYLOAD_ARGS_ADDR
 	hex "Address in memory to load 'args' file for Falcon Mode to"
 	depends on SPL_OS_BOOT || SPL_LOAD_FIT_OPENSBI_OS_BOOT
Signature · 1 line
2.49.0
#2 lore raw

Re: [RFC PATCH v1 1/4] spl: Kconfig: add SPL_SECURE_OS_BOOT config symbol

Quoted 13 lines · Anshul Dalal

This patch adds the new SPL_SECURE_OS_BOOT symbol that enables secure boot flow in falcon mode.

---
 common/spl/Kconfig | 7 +++++++
 1 file changed, 7 insertions(+)
common/spl/Kconfig +0 -0
index 880192043c4..8d153c2e9c9 100644

common/spl/Kconfig config SPL_OS_BOOT · line 1204

Quoted 9 lines
common/spl/Kconfig +6 -0
@@ -1196,6 +1196,13 @@ config SPL_OS_BOOT
 	  Enable booting directly to an OS from SPL.
 	  for more info read doc/README.falcon
 
+config SPL_SECURE_OS_BOOT
+	bool "Activate Secure Falcon Mode"
+	depends on SPL_OS_BOOT
+	help
+	  Enables support for secure boot in falcon mode by restricting the SPL to
+	  only loading a fitImage instead of raw kernel images or DTBs.

The base symbol here is SPL_OS_BOOT so this should become SPL_OS_BOOT_SECURE and say something like "Allow Falcon Mode on secure devices" with the help text saying that this allows for using Falcon Mode on devices where general security features such as signature verification are enabled and this will then disallow some inherently non-securable options.

Signature · 1 line
Tom
#3 lore raw

RFC PATCH 2/4 spl: Kconfig: allow disabling fallback during os boot

In reply to Anshul Dalal

During falcon boot in FS mode, if the SPL fails to load the payload (kernel image and args), the execution fallbacks to standard u-boot boot mode.

This might not be desired in cases when u-boot payload (tifalcon.bin in our case) is dysfuncitonal by itself or user's access to standard u-boot should be restricted (for security reasons for example).

In our falcon use case, this fallback allows the user to bypass authenticated boot by just deleting the fitImage which causes SPL to reload tifalcon.bin. The boot proceeds as usual until ATF jumps to PRELOADED_BL33_BASE where the kernel has not been loaded causing the core to execute whatever else was written at that address.

Therefore this patch adds a new config symbol SPL_FALCON_ALLOW_FALLBACK that explicitly toggles the fallback for MMC FS boot. It is set to 'y' by default so as to not break any existing falcon mode systems.

---
 common/spl/Kconfig   | 10 +++++
 common/spl/spl_mmc.c | 87 ++++++++++++++++++++++++++++----------------
 2 files changed, 65 insertions(+), 32 deletions(-)
common/spl/Kconfig +10 -0
index 8d153c2e9c9..d5d3a41ce61 100644
@@ -1203,6 +1203,16 @@ config SPL_SECURE_OS_BOOT
 	  Enables support for secure boot in falcon mode by restricting the SPL to
 	  only loading a fitImage instead of raw kernel images or DTBs.
 
+config SPL_FALCON_ALLOW_FALLBACK
+	bool "Allow fallback to regular boot if falcon mode fails"
+	depends on SPL_OS_BOOT && SYS_MMCSD_FS_BOOT && !SPL_SECURE_OS_BOOT
+	default y
+	help
+	  Enable support to fallback to regular boot if falcon mode fails in
+	  MMC FS boot.
+	  When enabled, u-boot will to load SPL_FS_LOAD_PAYLOAD_NAME from MMC
+	  if loading SPL_FS_LOAD_KERNEL_NAME fails.
+
 config SPL_PAYLOAD_ARGS_ADDR
 	hex "Address in memory to load 'args' file for Falcon Mode to"
 	depends on SPL_OS_BOOT || SPL_LOAD_FIT_OPENSBI_OS_BOOT
common/spl/spl_mmc.c +55 -32

103 lines not on this page · raw message

Signature · 1 line
2.49.0
#4 lore raw

Re: [RFC PATCH v1 2/4] spl: Kconfig: allow disabling fallback during os boot

Quoted 29 lines · Anshul Dalal

During falcon boot in FS mode, if the SPL fails to load the payload (kernel image and args), the execution fallbacks to standard u-boot boot mode.

This might not be desired in cases when u-boot payload (tifalcon.bin in our case) is dysfuncitonal by itself or user's access to standard u-boot should be restricted (for security reasons for example).

In our falcon use case, this fallback allows the user to bypass authenticated boot by just deleting the fitImage which causes SPL to reload tifalcon.bin. The boot proceeds as usual until ATF jumps to PRELOADED_BL33_BASE where the kernel has not been loaded causing the core to execute whatever else was written at that address.

Therefore this patch adds a new config symbol SPL_FALCON_ALLOW_FALLBACK that explicitly toggles the fallback for MMC FS boot. It is set to 'y' by default so as to not break any existing falcon mode systems.

---
 common/spl/Kconfig   | 10 +++++
 common/spl/spl_mmc.c | 87 ++++++++++++++++++++++++++++----------------
 2 files changed, 65 insertions(+), 32 deletions(-)
common/spl/Kconfig +0 -0
index 8d153c2e9c9..d5d3a41ce61 100644

common/spl/Kconfig config SPL_SECURE_OS_BOOT · line 1206

Quoted 4 lines
common/spl/Kconfig +1 -0
@@ -1203,6 +1203,16 @@ config SPL_SECURE_OS_BOOT
 	  Enables support for secure boot in falcon mode by restricting the SPL to
 	  only loading a fitImage instead of raw kernel images or DTBs.
 
+config SPL_FALCON_ALLOW_FALLBACK

SPL_OS_BOOT_ALLOW_FALLBACK please.

common/spl/Kconfig config SPL_SECURE_OS_BOOT · line 1208

Quoted 2 lines
common/spl/Kconfig +2 -0
+	bool "Allow fallback to regular boot if falcon mode fails"
+	depends on SPL_OS_BOOT && SYS_MMCSD_FS_BOOT && !SPL_SECURE_OS_BOOT

This should just be SPL_OS_BOOT && !SPL_OS_BOOT_SECURE.

Then in a follow-up patch we need to go and modify spl_*_load_os to make use of the new flag and if fail to load the OS image we panic() if we can't fall back.

Signature · 1 line
Tom
#5 lore raw

Re: [RFC PATCH v1 2/4] spl: Kconfig: allow disabling fallback during os boot

Quoted 38 lines · Tom Rini
Quoted 29 lines · Anshul Dalal

During falcon boot in FS mode, if the SPL fails to load the payload (kernel image and args), the execution fallbacks to standard u-boot boot mode.

This might not be desired in cases when u-boot payload (tifalcon.bin in our case) is dysfuncitonal by itself or user's access to standard u-boot should be restricted (for security reasons for example).

In our falcon use case, this fallback allows the user to bypass authenticated boot by just deleting the fitImage which causes SPL to reload tifalcon.bin. The boot proceeds as usual until ATF jumps to PRELOADED_BL33_BASE where the kernel has not been loaded causing the core to execute whatever else was written at that address.

Therefore this patch adds a new config symbol SPL_FALCON_ALLOW_FALLBACK that explicitly toggles the fallback for MMC FS boot. It is set to 'y' by default so as to not break any existing falcon mode systems.

---
 common/spl/Kconfig   | 10 +++++
 common/spl/spl_mmc.c | 87 ++++++++++++++++++++++++++++----------------
 2 files changed, 65 insertions(+), 32 deletions(-)
common/spl/Kconfig +0 -0
index 8d153c2e9c9..d5d3a41ce61 100644

common/spl/Kconfig config SPL_SECURE_OS_BOOT · line 1206

Quoted 4 lines
common/spl/Kconfig +1 -0
@@ -1203,6 +1203,16 @@ config SPL_SECURE_OS_BOOT
 	  Enables support for secure boot in falcon mode by restricting the SPL to
 	  only loading a fitImage instead of raw kernel images or DTBs.
 
+config SPL_FALCON_ALLOW_FALLBACK

SPL_OS_BOOT_ALLOW_FALLBACK please.

Quoted 8 lines

common/spl/Kconfig config SPL_SECURE_OS_BOOT · line 1208

Quoted 2 lines
common/spl/Kconfig +2 -0
+	bool "Allow fallback to regular boot if falcon mode fails"
+	depends on SPL_OS_BOOT && SYS_MMCSD_FS_BOOT && !SPL_SECURE_OS_BOOT

This should just be SPL_OS_BOOT && !SPL_OS_BOOT_SECURE.

Then in a follow-up patch we need to go and modify spl_*_load_os to make use of the new flag and if fail to load the OS image we panic() if we can't fall back.

A quick general question here, in cases where we want a function to lead to a boot failure. Is it better to return an error, hoping the caller to handle it and stop the boot process or panic within the function body to begin with?

int spl_do_*_os_boot() {
	int ret = spl_load_kernel_image(...);

	if (ret && !CONFIG_IS_ENABLED(OS_BOOT_ALLOW_FALLBACK))
		return ret; OR panic("Failed to os boot");

	/* fallback */
}

From a security PoV, I see the point in explicitly halting the boot right within the function body but returning the error conforms to standard error handling practices.

Regards,
Anshul

#6 lore raw

Re: [RFC PATCH v1 2/4] spl: Kconfig: allow disabling fallback during os boot

Quoted 62 lines · Anshul Dalal
Quoted 38 lines · Tom Rini
Quoted 29 lines · Anshul Dalal

During falcon boot in FS mode, if the SPL fails to load the payload (kernel image and args), the execution fallbacks to standard u-boot boot mode.

This might not be desired in cases when u-boot payload (tifalcon.bin in our case) is dysfuncitonal by itself or user's access to standard u-boot should be restricted (for security reasons for example).

In our falcon use case, this fallback allows the user to bypass authenticated boot by just deleting the fitImage which causes SPL to reload tifalcon.bin. The boot proceeds as usual until ATF jumps to PRELOADED_BL33_BASE where the kernel has not been loaded causing the core to execute whatever else was written at that address.

Therefore this patch adds a new config symbol SPL_FALCON_ALLOW_FALLBACK that explicitly toggles the fallback for MMC FS boot. It is set to 'y' by default so as to not break any existing falcon mode systems.

---
 common/spl/Kconfig   | 10 +++++
 common/spl/spl_mmc.c | 87 ++++++++++++++++++++++++++++----------------
 2 files changed, 65 insertions(+), 32 deletions(-)
common/spl/Kconfig +0 -0
index 8d153c2e9c9..d5d3a41ce61 100644

common/spl/Kconfig config SPL_SECURE_OS_BOOT · line 1206

Quoted 4 lines
common/spl/Kconfig +1 -0
@@ -1203,6 +1203,16 @@ config SPL_SECURE_OS_BOOT
 	  Enables support for secure boot in falcon mode by restricting the SPL to
 	  only loading a fitImage instead of raw kernel images or DTBs.
 
+config SPL_FALCON_ALLOW_FALLBACK

SPL_OS_BOOT_ALLOW_FALLBACK please.

Quoted 8 lines

common/spl/Kconfig config SPL_SECURE_OS_BOOT · line 1208

Quoted 2 lines
common/spl/Kconfig +2 -0
+	bool "Allow fallback to regular boot if falcon mode fails"
+	depends on SPL_OS_BOOT && SYS_MMCSD_FS_BOOT && !SPL_SECURE_OS_BOOT

This should just be SPL_OS_BOOT && !SPL_OS_BOOT_SECURE.

Then in a follow-up patch we need to go and modify spl_*_load_os to make use of the new flag and if fail to load the OS image we panic() if we can't fall back.

A quick general question here, in cases where we want a function to lead to a boot failure. Is it better to return an error, hoping the caller to handle it and stop the boot process or panic within the function body to begin with?

int spl_do_*_os_boot() {
	int ret = spl_load_kernel_image(...);

	if (ret && !CONFIG_IS_ENABLED(OS_BOOT_ALLOW_FALLBACK))
		return ret; OR panic("Failed to os boot");

	/* fallback */
}
Quoted 3 lines

From a security PoV, I see the point in explicitly halting the boot right within the function body but returning the error conforms to standard error handling practices.

As part of implementing this, it's a little bit up to you here. I didn't immediately see a good fall back path to panic at the higher level but I could have just missed it. But the important thing is that if we're secure and we fail to load and fallback is disabled, we need to panic somewhere.

Signature · 1 line
Tom
#7 lore raw

RFC PATCH 3/4 spl: Kconfig: disallow loading args in falcon mode

In reply to Anshul Dalal

The current falcon boot requires loading of an args file (usually the DTB) and a kernel image file to boot. But with secure boot, the dtb is expected to be packaged inside the fitImage that kernel image (path set by SPL_FS_LOAD_KERNEL_NAME) points to making loading the args file unnecessary.

Secondly the args file causes security issues since it can not be authenticated unlike a fitImage.

Furthermore current falcon boot flow provides added flexibility that might not be desired in the interest of security, in the current flow SPL first looks for files pointed to by the environment variables 'falcon_args_file' and 'falcon_image_file'. This could be compromised by modifying the env data.

Therefore this patch introduces a new boolean config symbol SPL_FALCON_LOAD_ARGS that simplifies the boot flow to only load the kernel image file set by SPL_FS_LOAD_KERNEL_NAME if disabled.

---
 common/spl/Kconfig   | 10 ++++++++++
 common/spl/spl_ext.c |  5 +++++
 common/spl/spl_fat.c |  5 +++++
 3 files changed, 20 insertions(+)
common/spl/Kconfig +10 -0
index d5d3a41ce61..b2dbe2eea65 100644
@@ -1213,6 +1213,16 @@ config SPL_FALCON_ALLOW_FALLBACK
 	  When enabled, u-boot will to load SPL_FS_LOAD_PAYLOAD_NAME from MMC
 	  if loading SPL_FS_LOAD_KERNEL_NAME fails.
 
+config SPL_FALCON_LOAD_ARGS
+	bool "Allow loading of args file in falcon mode"
+	depends on SPL_OS_BOOT && SYS_MMCSD_FS_BOOT && !SPL_SECURE_OS_BOOT
+	default y
+	help
+	  Say y to enable loading of SPL_FS_LOAD_ARGS_NAME which is used as
+	  the OS kernel argument from the filesystem (typically the DTB).
+	  This could be disabled if the falcon payload itself contains the
+	  argument (or DTB) like in a FIT container.
+
 config SPL_PAYLOAD_ARGS_ADDR
 	hex "Address in memory to load 'args' file for Falcon Mode to"
 	depends on SPL_OS_BOOT || SPL_LOAD_FIT_OPENSBI_OS_BOOT
common/spl/spl_ext.c +5 -0
index 7e0274a3058..f299587d73e 100644
@@ -82,6 +82,11 @@ int spl_load_image_ext_os(struct spl_image_info *spl_image,
 	struct disk_partition part_info = {};
 	__maybe_unused char *file;
 
+	if (!CONFIG_IS_ENABLED(FALCON_LOAD_ARGS))
+		return spl_load_image_ext(spl_image, bootdev, block_dev,
+					  partition,
+					  CONFIG_SPL_FS_LOAD_KERNEL_NAME);
+
 	if (part_get_info(block_dev, partition, &part_info)) {
 		printf("spl: no partition table found\n");
 		return -1;
common/spl/spl_fat.c +5 -0
index 8b7cafa7291..f3d8a88a8a4 100644
@@ -115,6 +115,11 @@ int spl_load_image_fat_os(struct spl_image_info *spl_image,
 	int err;
 	__maybe_unused char *file;
 
+	if (!CONFIG_IS_ENABLED(FALCON_LOAD_ARGS))
+		return spl_load_image_fat(spl_image, bootdev, block_dev,
+					  partition,
+					  CONFIG_SPL_FS_LOAD_KERNEL_NAME);
+
 	err = spl_register_fat_device(block_dev, partition);
 	if (err)
 		return err;
Signature · 1 line
2.49.0
#8 lore raw

Re: [RFC PATCH v1 3/4] spl: Kconfig: disallow loading args in falcon mode

Quoted 31 lines · Anshul Dalal

The current falcon boot requires loading of an args file (usually the DTB) and a kernel image file to boot. But with secure boot, the dtb is expected to be packaged inside the fitImage that kernel image (path set by SPL_FS_LOAD_KERNEL_NAME) points to making loading the args file unnecessary.

Secondly the args file causes security issues since it can not be authenticated unlike a fitImage.

Furthermore current falcon boot flow provides added flexibility that might not be desired in the interest of security, in the current flow SPL first looks for files pointed to by the environment variables 'falcon_args_file' and 'falcon_image_file'. This could be compromised by modifying the env data.

Therefore this patch introduces a new boolean config symbol SPL_FALCON_LOAD_ARGS that simplifies the boot flow to only load the kernel image file set by SPL_FS_LOAD_KERNEL_NAME if disabled.

---
 common/spl/Kconfig   | 10 ++++++++++
 common/spl/spl_ext.c |  5 +++++
 common/spl/spl_fat.c |  5 +++++
 3 files changed, 20 insertions(+)
common/spl/Kconfig +0 -0
index d5d3a41ce61..b2dbe2eea65 100644

common/spl/Kconfig config SPL_FALCON_ALLOW_FALLBACK · line 1216

Quoted 4 lines
common/spl/Kconfig +1 -0
@@ -1213,6 +1213,16 @@ config SPL_FALCON_ALLOW_FALLBACK
 	  When enabled, u-boot will to load SPL_FS_LOAD_PAYLOAD_NAME from MMC
 	  if loading SPL_FS_LOAD_KERNEL_NAME fails.
 
+config SPL_FALCON_LOAD_ARGS

I'm not sure we need this, exactly. We might need some hidden symbols but with SPL_OS_BOOT && SPL_OS_BOOT_SECURE we just need to not allow SPL*_ARGS options to be enabled. The tricky part will be either more hidden symbols or some updates to various parts of the code so that we can still compile.

Signature · 1 line
Tom
#9 lore raw

RFC PATCH 4/4 cmd: Kconfig: disable loading raw images in secure os boot

In reply to Anshul Dalal

Raw kernel images can not be authenticated so disable loading such binaries in secure falcon mode. This change restricts the falcon mode SPL to FIT as the only viable boot image which can be authenticated.

---
 cmd/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
cmd/Kconfig +2 -1
index ed741d43cea..8eb55dd7f6e 100644
@@ -353,12 +353,13 @@ config BOOTM_ELF
 
 config CMD_BOOTZ
 	bool "bootz"
+	depends on !SPL_SECURE_OS_BOOT
 	help
 	  Boot the Linux zImage
 
 config CMD_BOOTI
 	bool "booti"
-	depends on ARM64 || RISCV || SANDBOX
+	depends on (ARM64 || RISCV || SANDBOX) && !SPL_SECURE_OS_BOOT
 	default y
 	help
 	  Boot an AArch64 Linux Kernel image from memory.
Signature · 1 line
2.49.0
#10 lore raw

Re: [RFC PATCH v1 4/4] cmd: Kconfig: disable loading raw images in secure os boot

Quoted 18 lines · Anshul Dalal

Raw kernel images can not be authenticated so disable loading such binaries in secure falcon mode. This change restricts the falcon mode SPL to FIT as the only viable boot image which can be authenticated.

---
 cmd/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
cmd/Kconfig +1 -0
index ed741d43cea..8eb55dd7f6e 100644
@@ -353,12 +353,13 @@ config BOOTM_ELF
 
 config CMD_BOOTZ
 	bool "bootz"
+	depends on !SPL_SECURE_OS_BOOT

cmd/Kconfig config BOOTM_ELF · line 365

Quoted 10 lines
cmd/Kconfig +1 -1
 	help
 	  Boot the Linux zImage
 
 config CMD_BOOTI
 	bool "booti"
-	depends on ARM64 || RISCV || SANDBOX
+	depends on (ARM64 || RISCV || SANDBOX) && !SPL_SECURE_OS_BOOT
 	default y
 	help
 	  Boot an AArch64 Linux Kernel image from memory.

This is just pushing things too far and we need to step back and fix it, sorry. We need BOOTZ_IMAGE_FORMAT and BOOTI_IMAGE_FORMAT to go with LEGACY_IMAGE_FORMAT, and then SPL_... variants too, and then use those symbols.

Signature · 1 line
Tom
#11 lore raw

Re: [RFC PATCH v1 4/4] cmd: Kconfig: disable loading raw images in secure os boot

Quoted 23 lines · Tom Rini
Quoted 21 lines · Anshul Dalal

Raw kernel images can not be authenticated so disable loading such binaries in secure falcon mode. This change restricts the falcon mode SPL to FIT as the only viable boot image which can be authenticated.

---
 cmd/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
cmd/Kconfig +1 -0
index ed741d43cea..8eb55dd7f6e 100644
@@ -353,12 +353,13 @@ config BOOTM_ELF
 
 config CMD_BOOTZ
 	bool "bootz"
+	depends on !SPL_SECURE_OS_BOOT
 	help
 	  Boot the Linux zImage
 
Quoted 12 lines

cmd/Kconfig config BOOTM_ELF · line 365

Quoted 7 lines
cmd/Kconfig +1 -1
 config CMD_BOOTI
 	bool "booti"
-	depends on ARM64 || RISCV || SANDBOX
+	depends on (ARM64 || RISCV || SANDBOX) && !SPL_SECURE_OS_BOOT
 	default y
 	help
 	  Boot an AArch64 Linux Kernel image from memory.

This is just pushing things too far and we need to step back and fix it, sorry. We need BOOTZ_IMAGE_FORMAT and BOOTI_IMAGE_FORMAT to go with LEGACY_IMAGE_FORMAT, and then SPL_... variants too, and then use those symbols.

I can respin one of my earlier patch series[1] that migrated these CMD_BOOTx symbols to SPL. But we should still disable those new symbols to prevent loading of unverifiable raw kernel images in secure os boot right?

[1]: https://lore.kernel.org/u-boot/[email protected]/

#12 lore raw

Re: [RFC PATCH v1 4/4] cmd: Kconfig: disable loading raw images in secure os boot

Quoted 37 lines · Anshul Dalal
Quoted 23 lines · Tom Rini
Quoted 21 lines · Anshul Dalal

Raw kernel images can not be authenticated so disable loading such binaries in secure falcon mode. This change restricts the falcon mode SPL to FIT as the only viable boot image which can be authenticated.

---
 cmd/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
cmd/Kconfig +1 -0
index ed741d43cea..8eb55dd7f6e 100644
@@ -353,12 +353,13 @@ config BOOTM_ELF
 
 config CMD_BOOTZ
 	bool "bootz"
+	depends on !SPL_SECURE_OS_BOOT
 	help
 	  Boot the Linux zImage
 
Quoted 12 lines

cmd/Kconfig config BOOTM_ELF · line 365

Quoted 7 lines
cmd/Kconfig +1 -1
 config CMD_BOOTI
 	bool "booti"
-	depends on ARM64 || RISCV || SANDBOX
+	depends on (ARM64 || RISCV || SANDBOX) && !SPL_SECURE_OS_BOOT
 	default y
 	help
 	  Boot an AArch64 Linux Kernel image from memory.

This is just pushing things too far and we need to step back and fix it, sorry. We need BOOTZ_IMAGE_FORMAT and BOOTI_IMAGE_FORMAT to go with LEGACY_IMAGE_FORMAT, and then SPL_... variants too, and then use those symbols.

Quoted 6 lines

I can respin one of my earlier patch series[1] that migrated these CMD_BOOTx symbols to SPL. But we should still disable those new symbols to prevent loading of unverifiable raw kernel images in secure os boot right?

[1]: https://lore.kernel.org/u-boot/[email protected]/

I think I wasn't clear enough, sorry. We need in boot/Kconfig:

config BOOTZ_IMAGE_FORMAT
bool
help
Support for the Linux Kernel "zImage" format on 32bit ARM systems.

config BOOT_IMAGE_FORMAT
bool
help
Support for the Linux Kernel "Image" format found on 64bit ARM systems, RISC-V and other architectures within the Linux Kernel.

...
config SYS_BOOTM_LEN
...
depends on ... BOOTZ_IMAGE_FORMAT || SPL_BOOTZ_IMAGE_FORMAT ...

in cmd/Kconfig
config CMD_BOOTZ
bool ...
depends on BOOTZ_IMAGE_FORMAT

And then code / Makefiles outside of the command should use the appropriate new symbol. arch/arm/lib/Makefile for example:
obj-$(CONFIG_$(PHASE_)BOOTZ_IMAGE_FORMAT) += zimage.o obj-$(CONFIG_$(PHASE_)BOOTI_IMAGE_FORMAT) += image.o

And then yes, the SPL variants need to depend on !SPL_OS_BOOT_SECURE

Signature · 1 line
Tom