Skip to content

Commit

Permalink
Merge tag 'LA.BF64.1.2.3-01510-8x92.0' of https://source.codeaurora.o…
Browse files Browse the repository at this point in the history
…rg/quic/la/kernel/lk into HEAD

"LA.BF64.1.2.3-01510-8x92.0"
  • Loading branch information
M1cha committed Mar 12, 2017
2 parents 6202aa7 + aef199e commit 512086b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
14 changes: 9 additions & 5 deletions app/aboot/aboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ struct verified_boot_state_name vbsn[] =
#define DELAY_WAIT 30000
static unsigned page_size = 0;
static unsigned page_mask = 0;
static unsigned mmc_blocksize = 0;
static unsigned mmc_blocksize_mask = 0;
static char ffbm_mode_string[FFBM_MODE_BUF_SIZE];
static bool boot_into_ffbm;
static char target_boot_params[64];
Expand Down Expand Up @@ -805,7 +807,7 @@ void boot_linux(void *kernel, unsigned *tags,
* start: Start of the memory region
* size: Size of the memory region
*/
int check_aboot_addr_range_overlap(uint32_t start, uint32_t size)
int check_aboot_addr_range_overlap(uintptr_t start, uint32_t size)
{
/* Check for boundary conditions. */
if ((UINT_MAX - start) < size)
Expand Down Expand Up @@ -1113,7 +1115,7 @@ int boot_linux_from_mmc(void)
boot_verifier_init();
#endif

if (check_aboot_addr_range_overlap((uint32_t) image_addr, imagesize_actual))
if (check_aboot_addr_range_overlap((uintptr_t) image_addr, imagesize_actual))
{
dprintf(CRITICAL, "Boot image buffer address overlaps with aboot addresses.\n");
return -1;
Expand Down Expand Up @@ -1151,7 +1153,7 @@ int boot_linux_from_mmc(void)
if(target_use_signed_kernel() && (!device.is_unlocked))
{
offset = imagesize_actual;
if (check_aboot_addr_range_overlap((uint32_t)image_addr + offset, page_size))
if (check_aboot_addr_range_overlap((uintptr_t)image_addr + offset, page_size))
{
dprintf(CRITICAL, "Signature read buffer address overlaps with aboot addresses.\n");
return -1;
Expand Down Expand Up @@ -2216,6 +2218,7 @@ void cmd_boot(const char *arg, void *data, unsigned sz)
// Initialize boot state before trying to verify boot.img
#if VERIFIED_BOOT
boot_verifier_init();
#endif
/* Handle overflow if the input image size is greater than
* boot image buffer can hold
*/
Expand All @@ -2224,7 +2227,6 @@ void cmd_boot(const char *arg, void *data, unsigned sz)
fastboot_fail("booimage: size is greater than boot image buffer can hold");
return;
}
#endif

/* Verify the boot image
* device & page_size are initialized in aboot_init
Expand Down Expand Up @@ -2516,7 +2518,7 @@ void cmd_flash_mmc_img(const char *arg, void *data, unsigned sz)
}

size = partition_get_size(index);
if (ROUND_TO_PAGE(sz,511) > size) {
if (ROUND_TO_PAGE(sz, mmc_blocksize_mask) > size) {
fastboot_fail("size too large");
return;
}
Expand Down Expand Up @@ -3546,6 +3548,8 @@ void aboot_init(const struct app_descriptor *app)
{
page_size = mmc_page_size();
page_mask = page_size - 1;
mmc_blocksize = mmc_get_device_blocksize();
mmc_blocksize_mask = mmc_blocksize - 1;
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions app/aboot/mdtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static int mdtp_tzbsp_enc_hash_DIP(DIP_t *dec_dip, DIP_t *enc_dip);
uint32_t g_mdtp_version = (((MDTP_MAJOR_VERSION << 16) & 0xFFFF0000) | (MDTP_MINOR_VERSION & 0x0000FFFF));

int scm_random(uint32_t * rbuf, uint32_t r_len);
int check_aboot_addr_range_overlap(uint32_t start, uint32_t size);
extern int check_aboot_addr_range_overlap(uintptr_t start, uint32_t size);

/********************************************************************************/

Expand Down Expand Up @@ -249,7 +249,7 @@ static int verify_partition_block_hash(char *name,

/* initiating parameters for hash calculation using HW crypto */
target_crypto_init_params();
if (check_aboot_addr_range_overlap((uint32_t)buf, ROUNDUP(MDTP_FWLOCK_BLOCK_SIZE, block_size)))
if (check_aboot_addr_range_overlap((uintptr_t)buf, ROUNDUP(MDTP_FWLOCK_BLOCK_SIZE, block_size)))
{
dprintf(CRITICAL, "mdtp: verify_partition_block_hash: %s: image buffer address overlaps with aboot addresses.\n", name);
return -1;
Expand Down
1 change: 1 addition & 0 deletions platform/msm_shared/boot_verifier.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ static bool verify_image_with_sig(unsigned char* img_addr, uint32_t img_size,
}

verify_image_with_sig_error:
boot_verify_send_event(BOOTIMG_VERIFICATION_FAIL);
verify_image_with_sig_done:
return ret;
}
Expand Down
4 changes: 2 additions & 2 deletions platform/msm_shared/dev_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ extern uint32_t target_dev_tree_mem(void *fdt, uint32_t memory_node_offset);
/* TODO: This function needs to be moved to target layer to check violations
* against all the other regions as well.
*/
extern int check_aboot_addr_range_overlap(uint32_t start, uint32_t size);
extern int check_aboot_addr_range_overlap(uintptr_t start, uint32_t size);

int fdt_check_header_ext(const void *fdt)
{
Expand Down Expand Up @@ -486,7 +486,7 @@ void *dev_tree_appended(void *kernel, uint32_t kernel_size, uint32_t dtb_offset,
break;
dtb_size = fdt_totalsize(&dtb_hdr);

if (check_aboot_addr_range_overlap((uint32_t)tags, dtb_size)) {
if (check_aboot_addr_range_overlap((uintptr_t)tags, dtb_size)) {
dprintf(CRITICAL, "Tags addresses overlap with aboot addresses.\n");
return NULL;
}
Expand Down

0 comments on commit 512086b

Please sign in to comment.