One for the bottom and one for the top!midir wrote: One other thing, why do you want 2 guard pages? Is there an advantage to using 2 rather than 1?
I don´t know if you got the thing I said right or if I misunderstand you. I mean that writing code to secure the system of buffer overflows and such things, prevent the a app programmer to not write code that doesn´t has such leaks.Owen wrote: Huh? Address space layout randomization doesn't prevent someone from writing working code, just prevents them from writing exploits. Return-to-Libc attacks are one of the biggest classes at the moment.
Another point is, that I want to get the damn thing working So I will do the best I can get, but I do not want to make things too complicated.
Maybe I need to explain my idea of guard pages.
The 1st thread will get, e.g. 16kb of stack:
Code: Select all
0x500000 - 0x501000 stack guard page
0x501000 - 0x505000 stack mem
0x505000 - 0x506000 stack guard page
But what happens if the thread only got a stack of 16kb and the heap is so big that it is just before the stack. So when this app now writes at a position which is far away from its stack it will overwrite the heap and I don´t think that any operating system can do anything about such a problem.Owen wrote: (Incidentally, I have an app here which allocates ~32kb of RAM on the stack in one go regularly; it would quite readily jump past any guard pages unintentionally)
This is only an example:
Code: Select all
0x00400000 - 0xBFFFC000 heap
0xBFFFC000 - 0xC0000000 stack
Code: Select all