Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc: Detect the trusted boot state of the system

While secure boot permits only properly verified signed kernels to be
booted, trusted boot calculates the file hash of the kernel image and
stores the measurement prior to boot, that can be subsequently
compared against good known values via attestation services.

This patch reads the trusted boot state of a PowerNV system. The state
is used to conditionally enable additional measurement rules in the
IMA arch-specific policies.

Signed-off-by: Nayna Jain <nayna@linux.ibm.com>
Signed-off-by: Eric Richter <erichte@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/e9eeee6b-b9bf-1e41-2954-61dbd6fbfbcf@linux.ibm.com

authored by

Nayna Jain and committed by
Michael Ellerman
2702809a 4238fad3

+21
+6
arch/powerpc/include/asm/secure_boot.h
··· 11 11 #ifdef CONFIG_PPC_SECURE_BOOT 12 12 13 13 bool is_ppc_secureboot_enabled(void); 14 + bool is_ppc_trustedboot_enabled(void); 14 15 15 16 #else 16 17 17 18 static inline bool is_ppc_secureboot_enabled(void) 19 + { 20 + return false; 21 + } 22 + 23 + static inline bool is_ppc_trustedboot_enabled(void) 18 24 { 19 25 return false; 20 26 }
+15
arch/powerpc/kernel/secure_boot.c
··· 33 33 34 34 return enabled; 35 35 } 36 + 37 + bool is_ppc_trustedboot_enabled(void) 38 + { 39 + struct device_node *node; 40 + bool enabled = false; 41 + 42 + node = get_ppc_fw_sb_node(); 43 + enabled = of_property_read_bool(node, "trusted-enabled"); 44 + 45 + of_node_put(node); 46 + 47 + pr_info("Trusted boot mode %s\n", enabled ? "enabled" : "disabled"); 48 + 49 + return enabled; 50 + }