Skip to contentSkip to conversation

boot: don't enable booti/bootz by default if FIT_SIGNATURE is set

PATCH In review Rover Mo 3 participants 5 messages Nov 3, 2021 – Nov 4, 2021

lore
Share & tools
lore

Rover Mo

author
#0 lore raw

PATCH 1/1 boot: don't enable booti/bootz by default if FIT_SIGNATURE is set

To prevent boot unsigned images, same as CONFIG_LEGACY_IMAGE_FORMAT, don't enable CONFIG_CMD_BOOTI and CONFIG_CMD_BOOTI by default if CONFIG_FIT_SIGNATURE is enabled.

---
 cmd/Kconfig | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
cmd/Kconfig +10 -1
index 5b30b13e43..5f9dd91928 100644
@@ -203,15 +203,24 @@ config BOOTM_EFI
 
 config CMD_BOOTZ
 	bool "bootz"
+	default y if !FIT_SIGNATURE
 	help
 	  Boot the Linux zImage
+	  It is enabled by default for backward compatibility, unless
+	  FIT_SIGNATURE is set where it is disabled so that unsigned images
+	  cannot be loaded. If a board needs to  boot a Linux zImage in this
+	  case, enable it here.
 
 config CMD_BOOTI
 	bool "booti"
 	depends on ARM64 || RISCV
-	default y
+	default y if !FIT_SIGNATURE
 	help
 	  Boot an AArch64 Linux Kernel image from memory.
+	  It is enabled by default for backward compatibility, unless
+	  FIT_SIGNATURE is set where it is disabled so that unsigned images
+	  cannot be loaded. If a board needs to boot an AArch64 Linux Kernel
+	  image in this case, enable it here.
 
 config BOOTM_LINUX
 	bool "Support booting Linux OS images"
Signature · 1 line
2.25.1
#1 lore raw
Quoted 1 line · Rover Mo

To prevent boot unsigned images, same as CONFIG_LEGACY_IMAGE_FORMAT,

nits:
%s/boot/booting/

Quoted 2 lines

don't enable CONFIG_CMD_BOOTI and CONFIG_CMD_BOOTI by default if CONFIG_FIT_SIGNATURE is enabled.

Disabling the booti and the bootz command does not stop you from booting unsigned images, e.g. using the bootefi command.

Quoted 17 lines
---
  cmd/Kconfig | 11 ++++++++++-
  1 file changed, 10 insertions(+), 1 deletion(-)
cmd/Kconfig +1 -0
index 5b30b13e43..5f9dd91928 100644
@@ -203,15 +203,24 @@ config BOOTM_EFI
 
  config CMD_BOOTZ
  	bool "bootz"
+	default y if !FIT_SIGNATURE
  	help
  	  Boot the Linux zImage

cmd/Kconfig config BOOTM_EFI · line 217

Quoted 10 lines
cmd/Kconfig +5 -1
+	  It is enabled by default for backward compatibility, unless
+	  FIT_SIGNATURE is set where it is disabled so that unsigned images
+	  cannot be loaded. If a board needs to  boot a Linux zImage in this
+	  case, enable it here.
 
  config CMD_BOOTI
  	bool "booti"
  	depends on ARM64 || RISCV
-	default y
+	default y if !FIT_SIGNATURE

How about CONFIG_EFI_SECURE_BOOT? Should this also disable the default?

cmd/Kconfig config BOOTM_EFI · line 220

Quoted 3 lines
cmd/Kconfig +1 -0
  	help
  	  Boot an AArch64 Linux Kernel image from memory.
+	  It is enabled by default for backward compatibility, unless

Backwards relative to UEFI?

This focuses very much on default values. How about:

"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."

cmd/Kconfig config BOOTM_EFI · line 222

Quoted 2 lines
cmd/Kconfig +2 -0
+	  FIT_SIGNATURE is set where it is disabled so that unsigned images
+	  cannot be loaded. If a board needs to boot an AArch64 Linux Kernel

Why AArch64 and not RISC-V?

Who needs all those lines.

Best regards

Heinrich

Quoted 5 lines
cmd/Kconfig +1 -0
+	  image in this case, enable it here.
 
  config BOOTM_LINUX
  	bool "Support booting Linux OS images"
author
#2 lore raw

Dear Heinrich,

Thank for your comments.

Quoted 1 line

How about CONFIG_EFI_SECURE_BOOT? Should this also disable the default?

I think yes.
I will update the relation to "default y if !FIT_SIGNATURE && !EFI_SECURE_BOOT", and add "!EFI_SECURE_BOOT" into LEGACY_IMAGE_FORMAT.

Quoted 3 lines

Review

Quoted 1 line
(quoted diff) +1 -0
+	  It is enabled by default for backward compatibility, unless

Backwards relative to UEFI?

No.

This description is from CONFIG_LEGACY_IMAGE_FORMAT.

```
config LEGACY_IMAGE_FORMAT
        bool "Enable support for the legacy image format"
        default y if !FIT_SIGNATURE
        help
          This option enables the legacy image format. It is enabled by
          default for backward compatibility, unless FIT_SIGNATURE is                                                                                   
          set where it is disabled so that unsigned images cannot be
          loaded. If a board needs the legacy image format support in this 
          case, enable it here.
```

In my understand, this backward compatibility is to support both secure boot and non-secure boot when necessary.

Quoted 5 lines

This focuses very much on default values. How about:

"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."

I agree, this description is more comprehensive.

So that I want to update the commit title to "boot: don't enable the non-secure boot commands by default if secure boot enabled"

Quoted 1 line

Why AArch64 and not RISC-V?

The help information of CMD_BOOTI only mentions AArch64, so I followed it.

Should I update as following?

```diff
-          Boot an AArch64 Linux Kernel image from memory.
+         Boot an AArch64/RISC-V Linux Kernel image from memory.
```

Best regards,
Rover

Quoted 70 lines · Heinrich Schuchardt
Quoted 1 line · Rover Mo

To prevent boot unsigned images, same as CONFIG_LEGACY_IMAGE_FORMAT,

nits:
%s/boot/booting/

Quoted 2 lines

don't enable CONFIG_CMD_BOOTI and CONFIG_CMD_BOOTI by default if CONFIG_FIT_SIGNATURE is enabled.

Disabling the booti and the bootz command does not stop you from booting unsigned images, e.g. using the bootefi command.

Quoted 17 lines
---
  cmd/Kconfig | 11 ++++++++++-
  1 file changed, 10 insertions(+), 1 deletion(-)
cmd/Kconfig +1 -0
index 5b30b13e43..5f9dd91928 100644
@@ -203,15 +203,24 @@ config BOOTM_EFI
 
  config CMD_BOOTZ
  	bool "bootz"
+	default y if !FIT_SIGNATURE
  	help
  	  Boot the Linux zImage

cmd/Kconfig config BOOTM_EFI · line 217

Quoted 10 lines
cmd/Kconfig +5 -1
+	  It is enabled by default for backward compatibility, unless
+	  FIT_SIGNATURE is set where it is disabled so that unsigned images
+	  cannot be loaded. If a board needs to  boot a Linux zImage in this
+	  case, enable it here.
 
  config CMD_BOOTI
  	bool "booti"
  	depends on ARM64 || RISCV
-	default y
+	default y if !FIT_SIGNATURE

How about CONFIG_EFI_SECURE_BOOT? Should this also disable the default?

cmd/Kconfig config BOOTM_EFI · line 220

Quoted 3 lines
cmd/Kconfig +1 -0
  	help
  	  Boot an AArch64 Linux Kernel image from memory.
+	  It is enabled by default for backward compatibility, unless

Backwards relative to UEFI?

This focuses very much on default values. How about:

"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."

cmd/Kconfig config BOOTM_EFI · line 222

Quoted 2 lines
cmd/Kconfig +2 -0
+	  FIT_SIGNATURE is set where it is disabled so that unsigned images
+	  cannot be loaded. If a board needs to boot an AArch64 Linux Kernel

Why AArch64 and not RISC-V?

Who needs all those lines.

Best regards

Heinrich

Quoted 5 lines
cmd/Kconfig +1 -0
+	  image in this case, enable it here.
 
  config BOOTM_LINUX
  	bool "Support booting Linux OS images"
#3 lore raw
Quoted 52 lines · Rover Mo

Dear Heinrich,

Thank for your comments.

Quoted 1 line

How about CONFIG_EFI_SECURE_BOOT? Should this also disable the default?

I think yes.
I will update the relation to "default y if !FIT_SIGNATURE && !EFI_SECURE_BOOT",
and add "!EFI_SECURE_BOOT" into LEGACY_IMAGE_FORMAT.

Quoted 3 lines

Review

Quoted 1 line
(quoted diff) +1 -0
+	  It is enabled by default for backward compatibility, unless

Backwards relative to UEFI?

No.

This description is from CONFIG_LEGACY_IMAGE_FORMAT.

```
config LEGACY_IMAGE_FORMAT
         bool "Enable support for the legacy image format"
         default y if !FIT_SIGNATURE
         help
           This option enables the legacy image format. It is enabled by
           default for backward compatibility, unless FIT_SIGNATURE is
           set where it is disabled so that unsigned images cannot be
           loaded. If a board needs the legacy image format support in this
           case, enable it here.
```

In my understand,this backward compatibility is to support both secure boot and non-secure boot when necessary.

Quoted 5 lines

This focuses very much on default values. How about:

"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."

I agree, this description is more comprehensive.

So that I want to update the commit title to "boot: don't enable thenon-secure boot commands by default ifsecure boot enabled"

Quoted 1 line

Why AArch64 and not RISC-V?

The help information of CMD_BOOTI only mentions AArch64, so I followed it.

Should I update as following?
```diff

Review

Quoted 2 lines
(quoted diff) +1 -1
-          Boot an AArch64 Linux Kernel image from memory.
+         Boot an AArch64/RISC-V Linux Kernel image from memory.

Yes, please.

Best regards

Heinrich

Quoted 79 lines

```

Best regards,
Rover

Quoted 70 lines · Heinrich Schuchardt
Quoted 1 line · Rover Mo

To prevent boot unsigned images, same as CONFIG_LEGACY_IMAGE_FORMAT,

nits:
%s/boot/booting/

Quoted 2 lines

don't enable CONFIG_CMD_BOOTI and CONFIG_CMD_BOOTI by default if CONFIG_FIT_SIGNATURE is enabled.

Disabling the booti and the bootz command does not stop you from booting unsigned images, e.g. using the bootefi command.

Quoted 17 lines
---
  cmd/Kconfig | 11 ++++++++++-
  1 file changed, 10 insertions(+), 1 deletion(-)
cmd/Kconfig +1 -0
index 5b30b13e43..5f9dd91928 100644
@@ -203,15 +203,24 @@ config BOOTM_EFI
 
  config CMD_BOOTZ
  	bool "bootz"
+	default y if !FIT_SIGNATURE
  	help
  	  Boot the Linux zImage

cmd/Kconfig config BOOTM_EFI · line 217

Quoted 10 lines
cmd/Kconfig +5 -1
+	  It is enabled by default for backward compatibility, unless
+	  FIT_SIGNATURE is set where it is disabled so that unsigned images
+	  cannot be loaded. If a board needs to  boot a Linux zImage in this
+	  case, enable it here.
 
  config CMD_BOOTI
  	bool "booti"
  	depends on ARM64 || RISCV
-	default y
+	default y if !FIT_SIGNATURE

How about CONFIG_EFI_SECURE_BOOT? Should this also disable the default?

cmd/Kconfig config BOOTM_EFI · line 220

Quoted 3 lines
cmd/Kconfig +1 -0
  	help
  	  Boot an AArch64 Linux Kernel image from memory.
+	  It is enabled by default for backward compatibility, unless

Backwards relative to UEFI?

This focuses very much on default values. How about:

"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."

cmd/Kconfig config BOOTM_EFI · line 222

Quoted 2 lines
cmd/Kconfig +2 -0
+	  FIT_SIGNATURE is set where it is disabled so that unsigned images
+	  cannot be loaded. If a board needs to boot an AArch64 Linux Kernel

Why AArch64 and not RISC-V?

Who needs all those lines.

Best regards

Heinrich

Quoted 5 lines
cmd/Kconfig +1 -0
+	  image in this case, enable it here.
 
  config BOOTM_LINUX
  	bool "Support booting Linux OS images"
#4 lore raw

Hi,

Quoted 52 lines · Heinrich Schuchardt
Quoted 48 lines · Rover Mo

Dear Heinrich,

Thank for your comments.

Quoted 1 line

How about CONFIG_EFI_SECURE_BOOT? Should this also disable the default?

I think yes.
I will update the relation to "default y if !FIT_SIGNATURE && !EFI_SECURE_BOOT",
and add "!EFI_SECURE_BOOT" into LEGACY_IMAGE_FORMAT.

Quoted 3 lines
Quoted 1 line

+ It is enabled by default for backward compatibility, unless

Backwards relative to UEFI?

No.

This description is from CONFIG_LEGACY_IMAGE_FORMAT.

```
config LEGACY_IMAGE_FORMAT
         bool "Enable support for the legacy image format"
         default y if !FIT_SIGNATURE
         help
           This option enables the legacy image format. It is enabled by
           default for backward compatibility, unless FIT_SIGNATURE is
           set where it is disabled so that unsigned images cannot be
           loaded. If a board needs the legacy image format support in this
           case, enable it here.
```

In my understand,this backward compatibility is to support both secure boot and non-secure boot when necessary.

Quoted 5 lines

This focuses very much on default values. How about:

"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."

I agree, this description is more comprehensive.

So that I want to update the commit title to "boot: don't enable thenon-secure boot commands by default ifsecure boot enabled"

Quoted 1 line

Why AArch64 and not RISC-V?

Quoted 8 lines

Review

Quoted 6 lines

The help information of CMD_BOOTI only mentions AArch64, so I followed it.

Should I update as following?
```diff

(quoted diff) +1 -1
-          Boot an AArch64 Linux Kernel image from memory.
+         Boot an AArch64/RISC-V Linux Kernel image from memory.

Yes, please.

Also please do check tests (make qcheck) since sandbox enables more options than most boards.

- Simon

Quoted 84 lines

Best regards

Heinrich

Quoted 79 lines

```

Best regards,
Rover

Quoted 70 lines · Heinrich Schuchardt
Quoted 1 line · Rover Mo

To prevent boot unsigned images, same as CONFIG_LEGACY_IMAGE_FORMAT,

nits:
%s/boot/booting/

Quoted 2 lines

don't enable CONFIG_CMD_BOOTI and CONFIG_CMD_BOOTI by default if CONFIG_FIT_SIGNATURE is enabled.

Disabling the booti and the bootz command does not stop you from booting unsigned images, e.g. using the bootefi command.

Quoted 17 lines
---
  cmd/Kconfig | 11 ++++++++++-
  1 file changed, 10 insertions(+), 1 deletion(-)
cmd/Kconfig +1 -0
index 5b30b13e43..5f9dd91928 100644
@@ -203,15 +203,24 @@ config BOOTM_EFI
 
  config CMD_BOOTZ
    bool "bootz"
+   default y if !FIT_SIGNATURE
    help
      Boot the Linux zImage

cmd/Kconfig config BOOTM_EFI · line 217

Quoted 10 lines
cmd/Kconfig +5 -1
+     It is enabled by default for backward compatibility, unless
+     FIT_SIGNATURE is set where it is disabled so that unsigned images
+     cannot be loaded. If a board needs to  boot a Linux zImage in this
+     case, enable it here.
 
  config CMD_BOOTI
    bool "booti"
    depends on ARM64 || RISCV
-   default y
+   default y if !FIT_SIGNATURE

How about CONFIG_EFI_SECURE_BOOT? Should this also disable the default?

cmd/Kconfig config BOOTM_EFI · line 220

Quoted 3 lines
cmd/Kconfig +1 -0
    help
      Boot an AArch64 Linux Kernel image from memory.
+     It is enabled by default for backward compatibility, unless

Backwards relative to UEFI?

This focuses very much on default values. How about:

"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."

cmd/Kconfig config BOOTM_EFI · line 222

Quoted 2 lines
cmd/Kconfig +2 -0
+     FIT_SIGNATURE is set where it is disabled so that unsigned images
+     cannot be loaded. If a board needs to boot an AArch64 Linux Kernel

Why AArch64 and not RISC-V?

Who needs all those lines.

Best regards

Heinrich

Quoted 5 lines
cmd/Kconfig +1 -0
+     image in this case, enable it here.
 
  config BOOTM_LINUX
    bool "Support booting Linux OS images"