-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
heap_caps_malloc(n, MALLOC_CAP_EXEC) returns non-executable RAM on ESP32-S2 (IDFGH-14012) #14835
Comments
For this ESP32 case mentioned in the "More Information", it seems like 0x400bf21c is executable[^] so the bug is in [^] Verified by running the test code from #14836 |
Hi @projectgus, thanks for reporting this. I found and fixed the issue. In the memory_layout.c file of the esp32s2, the IRAM starting address for the RTC entry in the soc_memory_regions array was not set properly. I will have a look at #14836 next. I thought both would be related but after briefly checking the issue on C6 you mentioned, it doesn't seem to be directly related to this issue. Concerning #14837, I have an ongoing MR that makes your idea straightforward to implement. I will try to update it to make non exec heap a compile time error. I will let you know about the status of each reported issue in their respective ticket from now on. |
Hi @SoucheSouche, thanks for the very quikc follow-up and sorry it took me a little while to get back to you. Is there any chance this fix will be backported? (We ran into it on 5.2.2 but even 5.3 would be appreciated!) |
Hi @projectgus, the fix for this issue is under review. |
Answers checklist.
IDF version.
v5.2.3, and master (v5.4-dev-4076-gce6085349f)
Espressif SoC revision.
ESP32-S2
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-S2-Saola
Power Supply used.
USB
What is the expected behavior?
heap_caps_malloc(n, MALLOC_CAP_EXEC) should return NULL or memory which is executable.
What is the actual behavior?
It seems RTC FAST memory is added to the executable heap space but the address returned is the Data Bus mapping not the Instruction Bus mapping.
Steps to reproduce.
idf.py set-target esp32s2
idf.py menuconfig
and setESP_SYSTEM_MEMPROT_FEATURE
ton
(to allow executable heap)idf.py flash monitor
Debug Logs.
More Information.
While running the test program above on other SoCs to see if the problem is only on ESP32-S2 I noticed this output with original ESP32 running on v5.2.3 and the master branch:
It seems like
esp_ptr_executable(0x400bf21c)
isfalse
. According to the TRM this is the "Remap" region of "Internal SRAM 1", so I'm not sure if the bug here is that this address should not be returned forMALLOC_CAP_EXEC
or thatesp_ptr_executable()
is returning false for an executable address. I can open a second issue for this if it is helpful.The text was updated successfully, but these errors were encountered: