Open projectgus opened 2 weeks ago
Hi @projectgus. The problem was located in memory_layout.c. CONFIG_ESP_SYSTEM_MEMPROT_FEATURE
was used to define the common caps used in soc_memory_types
array instead of CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT
. The fix is created and will be reviewed now.
Thanks again for pointing this one out as well as for the rest of MALLOC_CAP_EXEC related tickets.
Answers checklist.
IDF version.
v5.2.3, release/v5.2 branch (v5.2.3-262-g2b35c55820)
Espressif SoC revision.
ESP32-C6FH4 (QFN32) (revision v0.1)
Operating System used.
Linux
How did you build your project?
Command line with idf.py
If you are using Windows, please specify command line type.
None
Development Kit.
ESP32-C6-DevKitM-1
Power Supply used.
USB
What is the expected behavior?
Calling
heap_caps_malloc(n, MALLOC_CAP_EXEC)
should return NULL or memory which is executable.What is the actual behavior?
On ESP32-C6 with the default configuration,
heap_caps_malloc(n, MALLOC_CAP_EXEC)
returns a pointer to memory which is not executable and crashes on instruction fetch.This bug seems to be fixed on master and release/v5.3 branch, but it would be great if fix could please be backported to v5.2.
Steps to reproduce.
Debug Logs.
More Information.
idf.py menuconfig
and disablingESP_SYSTEM_PMP_IDRAM_SPLIT
causes the returned memory to be executable as expected.