vicare
vicare copied to clipboard
Scheme stack overflow is possible
There is no true stack overflow prevention check; a check is present, but it does not guarantee to always detect the danger. Even though it is unlikely to happen, a Scheme stack overflow can happen.
Here is an idea to at least avoid memory corruption: allocate one more stack page and disallow read and write with "mprotect()". When allocating:
mprotect(pcb->stack_base, getpagesize(), PROT_NONE);
when releasing or recofiguring from stack segment to data segment:
mprotect(stack, getpagesize(), PROT_READ|PROT_WRITE);
This is from http://www.rethinkdb.com/blog/handling-stack-overflow-on-custom-stacks/.
Last page protection is now implemented in the head of the devel branch.