@amaury.forgeotdarc: It looks like PyOS_CheckStack() is only
implemented for Windows. It uses alloca() + __try/__except +
_resetstkoflw(). The GNU libc nor Linux kernel don't check stack
pointer on alloca(), it's just $esp += <alloca argument>. Using
alloca() you may also be able to able outside the stack to move your
stack pointer to the heap or another memory mapping. PyOS_CheckStack()
doesn't really protect the stack: if a function use alloca() or a
similar construction like « void test(int size) { char
allocated_on_the_stack[size]; ... } », you will not catch this error.
PyOS_CheckStack() only checks one type of error: stack overflow. It
doesn't check invalid memory read / write (see my first example,
read.py).