Skip to content

Commit

Permalink
core: prevent allocation when exception index tables are empty
Browse files Browse the repository at this point in the history
This change prevent the core from allocating memory, mapping and
other resources to map exception index tables that are all empty.

Signed-off-by: Etienne Carriere <[email protected]>
Reviewed-by: Jerome Forissier <[email protected]>
  • Loading branch information
etienne-lms authored and jforissier committed Oct 5, 2018
1 parent 1330634 commit b2322fd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/arch/arm/kernel/user_ta.c
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,13 @@ static TEE_Result set_exidx(struct user_ta_ctx *utc)
TAILQ_FOREACH(elf, &utc->elfs, link)
exidx_sz += elf->exidx_size;

if (!exidx_sz) {
/* The empty table from first segment will fit */
utc->exidx_start = exe->exidx_start;
utc->exidx_size = exe->exidx_size;
return TEE_SUCCESS;
}

utc->mobj_exidx = alloc_ta_mem(exidx_sz);
if (!utc->mobj_exidx)
return TEE_ERROR_OUT_OF_MEMORY;
Expand Down

0 comments on commit b2322fd

Please sign in to comment.