Commit 158518d
committed
llext: userspace: clear cold segment descriptors when sections are absent
llext_manager_rm_mod_domain() removes the .cold and .coldrodata memory
partitions of a module from its domain if the corresponding
mctx->segment[] descriptor has a non-zero address. Those descriptors are
only ever populated by llext_manager_add_mod_domain() when the module
actually contains a .cold / .coldrodata section.
The module context array is allocated with rmalloc() (non-zeroing) and
llext_manager_mod_init() initialises every field except the segment[]
array. The LIB_MANAGER_TEXT/RODATA/DATA/BSS descriptors are filled in
during linking, but LIB_MANAGER_COLD / LIB_MANAGER_COLDRODATA are left
holding uninitialised heap data for any module that has no such section.
As a result, when such a module is freed, rm_mod_domain() sees a garbage
non-zero address and tries to remove a partition that was never added:
<err> os.k_mem_domain_remove_partition: no matching partition found
<err> lib_manager.llext_manager_rm_mod_domain: failed to remove
.coldrodata memory partition: -2
Reproduced at end-of-stream of a DMIC capture (arecord -Dhw:0,4), whose
EQIIR / TDFB / DRC modules carry no .coldrodata section.
Make add_mod_domain() the sole owner of these descriptors: explicitly
zero them when the section is absent, so rm_mod_domain() only ever
removes partitions that were really added.
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>1 parent 90687ac commit 158518d
1 file changed
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
952 | 952 | | |
953 | 953 | | |
954 | 954 | | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
955 | 965 | | |
956 | 966 | | |
957 | 967 | | |
| |||
964 | 974 | | |
965 | 975 | | |
966 | 976 | | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
967 | 981 | | |
968 | 982 | | |
969 | 983 | | |
| |||
0 commit comments