From 916cf1e977f02f54dff6ab8f25c03a94c9657ef0 Mon Sep 17 00:00:00 2001 From: Che-Liang Chiou Date: Wed, 25 Apr 2012 01:02:31 +0800 Subject: [PATCH] Omit body load address check Omit this check because this check is not really necessary and it is dealing more harms than goods to ARM boards. While body load address is configurable, it is not quite possible to fix all the build scripts and runtime scripts to carry this address; so in reality all scripts use the default body load address. The problem is, this default address is not friendly to ARM boards, and it virtually makes this check fails on ARM boards. BUG=chromium-os:28077 TEST=emerge-{daisy,x86-alex} vboot_reference TEST=load_kernel_test -b 1 chromiumos_image.bin TEST=run verified boot on Daisy Change-Id: I1a1cc0aedf254e2a2b680046812ab7154f26dea7 Reviewed-on: https://gerrit.chromium.org/gerrit/20947 Tested-by: Che-Liang Chiou Reviewed-by: Gaurav Shah Reviewed-by: Bill Richardson Commit-Ready: Che-Liang Chiou --- firmware/include/load_kernel_fw.h | 3 ++- firmware/include/vboot_struct.h | 2 ++ firmware/lib/vboot_kernel.c | 8 -------- utility/load_kernel_test.c | 4 ---- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/firmware/include/load_kernel_fw.h b/firmware/include/load_kernel_fw.h index 406691ff48..0040e56de0 100644 --- a/firmware/include/load_kernel_fw.h +++ b/firmware/include/load_kernel_fw.h @@ -20,7 +20,8 @@ #define BOOT_FLAG_DEVELOPER UINT64_C(0x01) /* In recovery mode */ #define BOOT_FLAG_RECOVERY UINT64_C(0x02) -/* Skip check of kernel buffer address */ +/* Skip check of kernel buffer address. Since body load address check is + * omitted; this flag is deprecated and not used anywhere in the codebase. */ #define BOOT_FLAG_SKIP_ADDR_CHECK UINT64_C(0x04) typedef struct LoadKernelParams { diff --git a/firmware/include/vboot_struct.h b/firmware/include/vboot_struct.h index 3374d4cc26..48a4f6b150 100644 --- a/firmware/include/vboot_struct.h +++ b/firmware/include/vboot_struct.h @@ -232,6 +232,8 @@ typedef struct VbKernelPreambleHeader { #define VBSD_LKP_CHECK_VERIFY_PREAMBLE 9 #define VBSD_LKP_CHECK_KERNEL_ROLLBACK 10 #define VBSD_LKP_CHECK_PREAMBLE_VALID 11 +/* Body load address check is omitted; this result code is deprecated and not + * used anywhere in the codebase. */ #define VBSD_LKP_CHECK_BODY_ADDRESS 12 #define VBSD_LKP_CHECK_BODY_OFFSET 13 #define VBSD_LKP_CHECK_SELF_SIGNED 14 diff --git a/firmware/lib/vboot_kernel.c b/firmware/lib/vboot_kernel.c index 8a13824281..9573e6ec95 100644 --- a/firmware/lib/vboot_kernel.c +++ b/firmware/lib/vboot_kernel.c @@ -401,14 +401,6 @@ VbError_t LoadKernel(LoadKernelParams* params) { if (-1 != good_partition) continue; - /* Verify body load address matches what we expect */ - if ((preamble->body_load_address != (size_t)params->kernel_buffer) && - !(params->boot_flags & BOOT_FLAG_SKIP_ADDR_CHECK)) { - VBDEBUG(("Wrong body load address.\n")); - shpart->check_result = VBSD_LKP_CHECK_BODY_ADDRESS; - goto bad_kernel; - } - /* Verify kernel body starts at a multiple of the sector size. */ body_offset = key_block->key_block_size + preamble->preamble_size; if (0 != body_offset % blba) { diff --git a/utility/load_kernel_test.c b/utility/load_kernel_test.c index c36c3357be..f5585c383b 100644 --- a/utility/load_kernel_test.c +++ b/utility/load_kernel_test.c @@ -190,10 +190,6 @@ int main(int argc, char* argv[]) { /* Free the key blob, now that we're done with it */ free(key_blob); - /* Needs to skip the address check, since we're putting it somewhere on the - * heap instead of its actual target address in the firmware. */ - lkp.boot_flags |= BOOT_FLAG_SKIP_ADDR_CHECK; - printf("bootflags = %" PRIu64 "\n", lkp.boot_flags); /* Get image size */