Re: [x86] Access off the bottom of stack causes a segfault?

From: Jamie Lokier
Date: Fri Oct 17 2003 - 18:57:26 EST


Chris Lattner wrote:
> Thanks to everyone for all of the answers. :) I guess the moral of the
> story is to not perform leaf function optimization on X86. At least
> frame-pointer elimination is still safe.

Chris,

You _can_ do the leaf optimisation, but you have to be more careful.

Firstly, you'll need to use sigaltstack() to ensure signals are not
delivered on the current stack.

Secondly, you'll need to install a SIGSEGV signal handler which
detects when the kernel doesn't like you accessing below %esp, and
forces the vma to expand by manipulating %esp and doing some accesses,
then returns.

-- Jamie
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/