Skip to content

Commit 1d1b1dd

Browse files
lyakhlgirdwood
authored andcommitted
library_manager: llext: don't try to copy .bss
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]>
1 parent 5b98a5c commit 1d1b1dd

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/library_manager/llext_manager.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,12 @@ static int llext_manager_load_data_from_storage(const struct llext *ext,
9898
/* found a section within the region */
9999
size_t offset = shdr->sh_offset - init_offset;
100100

101-
ret = memcpy_s((__sparse_force void *)shdr->sh_addr, size - offset,
102-
load_base + offset, shdr->sh_size);
103-
if (ret < 0)
104-
return ret;
101+
if (shdr->sh_type != SHT_NOBITS) {
102+
ret = memcpy_s((__sparse_force void *)shdr->sh_addr, size - offset,
103+
load_base + offset, shdr->sh_size);
104+
if (ret < 0)
105+
return ret;
106+
}
105107
}
106108

107109
/*

0 commit comments

Comments
 (0)