With or Without segments
Posted: Wed Dec 04, 2002 3:17 am
The segmentation unit of the IA-32 is almost always under-used in operating systems ... This is a pity while it could make YOUR OS more reliable that main-stream OSes
1. Using a separate segment for your stack can prevent stack overflows (even malicious ones). A common trick for stack overflow is to leave a non-allocated page at the top of your stack but
1. Using a separate segment for your stack can prevent stack overflows (even malicious ones). A common trick for stack overflow is to leave a non-allocated page at the top of your stack but
- this means that a char[4096] could go over that protection page and still result in a stack overflow
- this is not appliable to kernel stacks (and i suggest your kernel stack don't use on-demand memory allocation, but rather real allocation) because the page fault exception could not be handled if the stack is invalid (an option would be to have a task gate for paging exception, but you probably don't want it for performances purpose).