zephyr/tests/subsys/llext
Luca Burelli 11c350e2e6 llext: fix handling of unimplemented syscalls
When building an LLEXT-enabled kernel, 62b19ef65c added weak aliases
of all syscall implementation functions to a pointer to NULL, with the
assumption that LLEXT would check the required symbols at link time and
fail if any of them were found.

This check, however, is ineffective in the current implementation: the
actual address that is exported is the rather normal-looking location of
the variable containing the NULL pointer. This defeats the NULL symbol
validity checks in llext_link.c and causes the extension to crash at
runtime by jumping to a location containing a few zeroes in read-only
data memory.

This commit makes sure the alias target is actually placed at address 0
using the llext-sections.ld linker fragment, so that undefined syscall
implementations are exported as NULLs and as such properly flagged at
link time.

The test for this functionality is also updated to reflect the change.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-10-08 16:59:50 +02:00
..
simple llext: fix handling of unimplemented syscalls 2024-10-08 16:59:50 +02:00