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

From: Chris Lattner
Date: Tue Oct 14 2003 - 14:37:25 EST


> Any interrupt causes the return address to be pushed onto the
> stack. This will overwrite any data you've put there. In principle,
> in user-mode, you can write below the stack-pointer because an
> interrupt uses the kernel stack. However, your data will still
> get corrupted by signal delivery, etc. So as to not corrupt your
> user-mode stack, the kernel calls your signal code, just like
> a nested call. This means the new return address will be below
> the non-signal user-mode stack-pointer value. This will surely
> corrupt anything you have written below the stack-pointer.

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.

Thanks again,

-Chris

--
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/

-
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/