0x4000

0x3010

0x3000

0x0000

Memory Protection Unit

Region 2

Region 1

Figure 7-1 Overlapping memory regions

Example of using regions that overlap

You can use overlapping regions for stack protection. For example:

allocate to region 1 the appropriate size for all stacks

allocate to region 2 the minimum region size, 32 bytes, and position it at the end of the stack for the current process

set the region 2 access permissions to No Access.

If the current process overflows the stack it uses, a write access to region 2 by the processor causes the MPU to raise a permission fault.

0x4000

Region 1

0x0000

Region 2

Figure 7-2 Overlay for stack protection

Example of using subregions

You can use subregions for stack protection. For example:

Allocate to region 1 the appropriate size for all stacks.

Set the least-significant subregion disable bit. That is, set the subregion disable field, bits [15:8], of the CP15 MPU Region Size Register to 0x01.

If the current process overflows the stack it uses, a write access by the processor to the disabled subregion causes the MPU to raise a background fault.

ARM DDI 0363E

Copyright © 2009 ARM Limited. All rights reserved.

7-5

ID013010

Non-Confidential, Unrestricted Access

 

Page 188
Image 188
ARM r1p3, R4F manual Example of using regions that overlap, Example of using subregions