DTB not check secure boot

Hello,

I’m doing some test on the secure boot on the ORIN NX using the Jetpack 6.1, for the moment I only enable the UEFI part of the secure boot and test that the system does not start if some element are not signed.

I configure my system to boot in kernel mode, and sign only the elements needed to boot in this mode. My issue is that when I do the test with the DTB not signed, the system still boot. I was expected it to fail with an error on the DTB signature.

Is there something to enable for the DTB to be check during the boot?
Is there a fall back system I don’t see, that still allow the system to boot?

boot_log.txt (87.5 KB)
flash_log.txt (50.8 KB)

Best regards

hello AFR,

per your flashing logs.. it looks you did not fuse a target yet, right?
for instance,
it looks you did not assign keys (such as PKC key) to the flash command-line.
/home/alexandre-froissard/test_install/tmp_dir/tools/kernel_flash/l4t_initrd_flash_internal.sh --network usb0 --usb-instance 1-12 --device-instance 0 --flash-only --network usb0 jetson-orin-d131 internal

Hello,

Yes for now I didn’t fuses, I’m doing some testing on the UEFI part first to make sure all my configuration on this point is good. On a second step I will fuses the board.

Does the fact that the fuses are not set yet make the check of the DTB to be skipped?

Best regards

hello AFR,

please also refer to developer guide, Check If UEFI Secure Boot Is Enabled.

BTW,
may I also know how you test with the DTB not signed?
for instance,
please check its partition labels, $ ls -la /dev/disk/by-partlabel/
lrwxrwxrwx 1 root root 15 Nov 21 2023 A_kernel-dtb -> ../../mmcblk0p3
and, please use dd to write A_kernel-dtb partition, which is located at mmcblk0p3
$ sudo dd if=tegra234-xxx.dtb of=/dev/mmcblk0p3 bs=64k

Hello JerryChang,

Yes the secure boot is enable

efivar -n 8be4df61-93ca-11d2-aa0d-00e098032b8c-SecureBoot
GUID: 8be4df61-93ca-11d2-aa0d-00e098032b8c
Name: “SecureBoot”
Attributes:
Boot Service Access
Runtime Service Access
Value:
00000000 01 |. |

I signed the elements using the following script
sign_files.sh.txt (5.0 KB)

This script signed and replace the element to be flash
Then I used the flashing script l4t_initrd_flash.sh to load the image on the board.

FYI, I did the test with the EFI image and the boot.img not signed and the boot failed as expected.

If you think it can be pertinent, I can do a test with updating the dtb after flash and see if it change something.

Best regards

hello AFR,

DTB it can coming from partition (A_kernel-dtb) or root file system (FDT entry).
flash script handle sign/encryption by default to write the binary file to partitions.

anyways, may I know what’s the real use-case?

Hello JerryChang,

The real use case is the have full secure boot enable on the system with the elements sign by a private service during the build of the OS.

The OS is configure via a chroot, then the different image are generate using the l4t_initrd_flash.sh with the no_flash option, after that the element are sign using the private signing service and finally the sign binary are flash to the device.

The all the steps except the flash will all done in a CI/CD pipeline.

In the case I tested with the DTB not sign, neither the A_kernel-dtb or the FDT contain a sign version of the files.
From the documentation, if the system is booted in kernel mode, A_kernel-dtb should be used. I choose to configure the system in kernel boot mode because I saw it’s the last mode before switching in recovery in case of error.

Best regards

hello AFR,

to be honest, I did not test with only UEFI secureboot.
I’ve test the root-of-trust start from the BootROM. (i.e. bootloader secureboot enabled)

please refer to this diagram of Selection Order.
just double check which stage of not signed DTB file has loaded.

Hello JerryChang,

From the diagram you share, there is a DTB EFI, how can I check if this one is used? Does that mean that if the DTB from the partition is invalid it will switch to the EFI one?
DTB EFI does it mean a DTB that is embedded in the EFI image?

Best regards

hello AFR,

you may check debug logs..
please see-also Build without docker · NVIDIA/edk2-nvidia Wiki · GitHub for the instruction to build debug UEFI binary.

Hello JerryChang,

Indeed I finally saw a log on the debug console about the DTB
“DTB signature invalid”
It something that is not saved neither in the dmesg neither in the journal as it is printed before the boot of Linux

My guess for now it’s that the EFI DTB is an element sign by the PKC key so as long as I don’t enable the full secure boot I can not test further.

Thank you for your help

hello AFR,

it’s bootloader log, which output to serial console,
since such logs printed to StdErr, you should seeing that via UART logs.