aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver O'Halloran <oohall@gmail.com>2019-10-11 15:27:42 +1100
committerOliver O'Halloran <oohall@gmail.com>2019-10-14 10:51:42 +1100
commitcc34635df59e4f5aa8ad80bc788e74f8cf197880 (patch)
treead33d98ab5a8d3d13a031a2804426e2fdce5ad6b
parenta4e0f636ea8c179d68c14d96ca36e165406a452e (diff)
downloadskiboot-cc34635df59e4f5aa8ad80bc788e74f8cf197880.zip
skiboot-cc34635df59e4f5aa8ad80bc788e74f8cf197880.tar.gz
skiboot-cc34635df59e4f5aa8ad80bc788e74f8cf197880.tar.bz2
core/init: Checksum romem after patching out traps
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@us.ibm.com> Tested-by: Carol L Soto <clsoto@us.ibm.com> Tested-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Fixes: 9ddc1a6bfaef ("core/util: trap based assertions") Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
-rw-r--r--core/init.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/core/init.c b/core/init.c
index c2d7324..cc1fdbc 100644
--- a/core/init.c
+++ b/core/init.c
@@ -85,6 +85,8 @@ struct debug_descriptor debug_descriptor = {
#endif
};
+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)
patch_traps(false);
+ checksum_romem();
+
debug_descriptor.state_flags |= OPAL_BOOT_COMPLETE;
cpu_give_self_os();
@@ -1320,8 +1324,6 @@ void __noreturn __nomcount main_cpu_entry(const void *fdt)
prd_register_reserved_memory();
- checksum_romem();
-
load_and_boot_kernel(false);
}