SLAU847D October 2022 – May 2024 MSPM0L1105 , MSPM0L1106 , MSPM0L1117 , MSPM0L1227 , MSPM0L1228 , MSPM0L1228-Q1 , MSPM0L1303 , MSPM0L1304 , MSPM0L1304-Q1 , MSPM0L1305 , MSPM0L1305-Q1 , MSPM0L1306 , MSPM0L1306-Q1 , MSPM0L1343 , MSPM0L1344 , MSPM0L1345 , MSPM0L1346 , MSPM0L2227 , MSPM0L2228 , MSPM0L2228-Q1
Buffer overflows are a common source of exploits wherein, for example, a corrupt return address can cause execution to jump to malicious code. In order to mitigate such exploits, an SRAM code protection feature is available, wherein the SRAM can be partitioned into two regions:
Region 1: Read-Write (RW)
Region 2: Read-Execute (RX)
This is set up by configuring the SYSCTL.SOCLOCK.SRAMBOUNDARY register with an address A such that:
Addresses >= A will be permitted for read-execute and not for writes
Addresses < A will be permitted for read-write and not for execution (instruction fetch)
Configuring A equal to the total SRAM capacity implies that the entire SRAM is for RW only and no code execution from SRAM is enabled.
A = 0 is treated as entire SRAM being RWX. This is the reset state of the SRAM.
In security-enabled devices, the SRAMBOUNDARY configuration can be locked by the CSC by configuring the SYSCTL.SECCFG.FWENABLE.SRAMBOUNDARYLOCK bit. Setting the LOCK ensures that the untrusted application can not change the SRAM protection. In devices without the security add-on, the SRAMBOUNDARY functionality is still available but the LOCK functionality is not present. This enables applications to use this feature to catch memory access problems.