Re: i386 ABI and the stack



On Fri, 2006-06-23 at 22:43 -0400, Albert Cahalan wrote:
On 6/23/06, Linus Torvalds <torvalds@xxxxxxxx> wrote:
On Fri, 23 Jun 2006, H. Peter Anvin wrote:

The x86-64 ABI has a 128-byte(*) zone that is safe from signals etc, so you
can use a small amount of stack below the stackpointer safely. Not so on
x86.

Adding a small redzone like this to i386 would be easy, though -- just drop
the stack pointer by that much when creating a signal frame. 128 bytes isn't
enough to interfere with libraries.

However, any binaries created with that in mind would be
buggy-by-definition on older kernels, so I don't think it's worth it.

Since gcc-2.96 would access 256 bytes below the stack pointer
(according to the valgrind man page), the kernel needs to allow
for this in signal handlers anyway.

only a handful buggy editions of that compiler did in a few corner
cases. And they were really buggy, and they were corner cases. Nobody
should be using a compiler like that; and nobody is expected to compile
software with a broken version of that compiler (iirc the window in
which it was broken was really small). There is a limit to userspace
brokenness that the kernel should work around. This imo is on the other
side of the line.

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



Relevant Pages

  • Re: Do buffers always start with the lowest memory address being the first element?
    ... > The C standard does not assume a downward-growing stack, ... > an upward-growing stack. ... C allows but does not require that the array produced ... > machine depends on both the C compiler and the machine. ...
    (comp.lang.c)
  • Re: switch statement, was compiler, status...
    ... Primary Register, Secondary Register, ... Stack, and abit of storage does it. ... This version of Small-C is copyrighted as a revision to Ron Cain's ... Croatia) is "Calculator Compiler" by Senko Rasik. ...
    (alt.lang.asm)
  • Re: Partial string loss with sprintf/strcat
    ... As already suggested collecting information about the ... The stack and heap size ... A good suggestion but it's been years since I inspected assembler level ... compiler" that compiles to EM byte-code. ...
    (comp.lang.c)
  • Re: 2.6.25-git2: BUG: unable to handle kernel paging request at ffffffffffffffff
    ... since the compiler is totally free to spill and reload the local variable ... So forget about the prefetch, ... variable onto the stack, since it did that volatime memory access through ... the insane "store and immediately reload from ...
    (Linux-Kernel)
  • Re: Index a #define string
    ... In this case, i wouldn't use an array myself but a const char * const, but ... should one make it of static storage? ... If they were on the stack, where do you think their values ... You mean that the compiler optimises it out. ...
    (comp.lang.cpp)