2024-09-17 04:17 AM
I've seen other posts to resolve the compiler warning of "elf has a LOAD segment with RWX permissions", but I'm receiving this warning only when calling functions in RAM using the .RamFunc segment attribute.
From the map file I've verified the function is being loaded into RAM. I could disable the warning, but would like to understand the underlying issue.
I'm working with the latest STMCubeIDE version 1.16.0, but also saw this in 1.15.0. I'm building code for the STM3H735 and STM32H745 families.
2024-09-17 06:18 AM
The underlying issue is that the RAM segment has both write and execute access. This can lead to arbitrary code execution if there is a bug such as a buffer overflow which allows you to overwrite the instruction code.
If you want to fix, split up the RAM into two segments, one with "rx" permissions where the functions get loaded.