Skip to content

Commit

Permalink
library_manager: llext: don't try to copy .bss
Browse files Browse the repository at this point in the history
When copying LLEXT modules from DRAM to SRAM we allocate and copy
.data and .bss together because they have the same access flags, but
.bss doesn't have to be copied, this can in fact generate an error
because it isn't present in the ELF image. Only copy valid sections.

Reported-by: Tomasz Leman <[email protected]>
Signed-off-by: Guennadi Liakhovetski <[email protected]>
  • Loading branch information
lyakh authored and lgirdwood committed Feb 20, 2025
1 parent 5b98a5c commit 1d1b1dd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/library_manager/llext_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,12 @@ static int llext_manager_load_data_from_storage(const struct llext *ext,
/* found a section within the region */
size_t offset = shdr->sh_offset - init_offset;

ret = memcpy_s((__sparse_force void *)shdr->sh_addr, size - offset,
load_base + offset, shdr->sh_size);
if (ret < 0)
return ret;
if (shdr->sh_type != SHT_NOBITS) {
ret = memcpy_s((__sparse_force void *)shdr->sh_addr, size - offset,
load_base + offset, shdr->sh_size);
if (ret < 0)
return ret;
}
}

/*
Expand Down

0 comments on commit 1d1b1dd

Please sign in to comment.