Memory protection and picolibc global state


Keith Packard
 

I'm continuing to develop picolibc (https://github.com/picolibc) support
for Zephyr under this PR:

https://github.com/zephyrproject-rtos/zephyr/pull/26545

I'm running the sanity checks under qemu on mps2_an521 which uses the
ARM MPU. On this board, the default memory protection configuration
seems to place all libc globals in a region which is protected against
application access. That includes globals used in managing the malloc
heap, and so application calls to malloc end up generating a MPU fault.

I can fix this in at least a couple of possible ways:

1) Create per-thread malloc heaps and track malloc per-thread.

2) Figure out how to change protection for libc globals

3) Replace the picolibc malloc implementation with a Zephyr custom
implementation.

--
-keith

Join devel@lists.zephyrproject.org to automatically receive all group messages.