[Skiboot] [PATCH 2/2] core/init: Checksum romem after patching out traps

Oliver O'Halloran oohall at gmail.com
Fri Oct 11 15:27:42 AEDT 2019

Currently we checksum the read-only parts of skiboot's memory just
before loading and booting petitboot. Commit 9ddc1a6bfaef
("core/util: trap based assertions") modifies the .text after this
point since it needs to disable the trap instructions that we use
to trigger an abort() before entering the kernel.

We can fix this by moving the checksum to after the point where the
traps are patched out. We could do the patching sooner, but since
load_and_boot_kernel() is a fairly complex function it's perferable
to keep boot-time assertion infrastructure active until just before
we enter the kernel.

Reported-by: Carol L Soto <clsoto at us.ibm.com>
Fixes: 9ddc1a6bfaef ("core/util: trap based assertions")
Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
 core/init.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/core/init.c b/core/init.c
index c2d7324622db..cc1fdbc4d0b0 100644
--- a/core/init.c
+++ b/core/init.c
@@ -85,6 +85,8 @@ struct debug_descriptor debug_descriptor = {
+static void checksum_romem(void);
 static bool try_load_elf64_le(struct elf_hdr *header)
 	struct elf64_hdr *kh = (struct elf64_hdr *)header;
@@ -621,6 +623,8 @@ void __noreturn load_and_boot_kernel(bool is_reboot)
+	checksum_romem();
 	debug_descriptor.state_flags |= OPAL_BOOT_COMPLETE;
@@ -1320,8 +1324,6 @@ void __noreturn __nomcount main_cpu_entry(const void *fdt)
-	checksum_romem();

More information about the Skiboot mailing list