5 ms·
Well assuming you run in virtual mode you could always leave the page/segment directly below the stack unmapped, this way if the stack overflows it'll trigger a
by simias 13y ago
Well assuming you run in virtual mode you could always leave the page/segment directly below the stack unmapped, this way if the stack overflows it'll trigger an exception by accessing invalid addresses.
- prutschman 13y agoThere is an enormous class of embedded devices not running on chips capable of address virtualization.
- ctz 13y agoYou don't need virtual memory, just memory protection. Many microprocessors and microcontrollers offer just an MPU, without the full fat of address translation machinery needed for an MMU.
- sitkack 13y agohttp://www.freertos.org/FreeRTOS-MPU-memory-protection-unit.html http://www.freertos.org/FreeRTOS-MPU-memory-protection-unit....
- robryk 13y agoUnless you move the stack pointer by more than a page (the stack in Linux grows automatically: IIRC any access to at most 64k below the stack pointer is considered to be an attempt to grow the stack, because the compiler may very well reorder a change in SP in a function's prelude and an access to the newly-allocated stack frame). Edit: I'm sorry, I was somewhat wrong. Accessing stack below SP is considered a bug, but x86 enter instruction can make it seem like such an access has taken place if it faults: http://lxr.free-electrons.com/source/arch/x86/mm/fault.c?v=3.2#L1136 http://lxr.free-electrons.com/source/arch/x86/mm/fault.c?v=3...