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

From: Davide Libenzi (davidel_at_xmailserver.org)
Date: 10/14/03

  • Next message: Brian Gerst: "Re: [x86] Access off the bottom of stack causes a segfault?"
    Date:	Tue, 14 Oct 2003 11:37:37 -0700 (PDT)
    To: Chris Lattner <sabre@nondot.org>
    
    

    On Tue, 14 Oct 2003, Chris Lattner wrote:

    >
    > My compiler is generating accesses off the bottom of the stack (address
    > below %esp). Is there some funny kernel interaction that I should be
    > aware of with this? I'm periodically getting segfaults.
    >
    > Example:
    >
    > int main() {
    > int test[4000];
    > ...
    > return 0;
    > }
    >
    > Generated code:
    > .intel_syntax
    > ...
    > main:
    > mov DWORD PTR [%ESP - 16004], %EBP # Save EBP to stack
                             ^^^^^^^^^^^^

    Yes, this is the problem (even Windows does that IIRC).

    - Davide

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


  • Next message: Brian Gerst: "Re: [x86] Access off the bottom of stack causes a segfault?"

    Relevant Pages

    • [patch] flexible-mmap-update.patch, 2.6.7-mm5
      ... > as an inviolable request to reserve that much for the stack: ... > much less VM available than bottom up, ... (if the stack ulimit has been set to RLIM_INFINITY) ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [x86] Access off the bottom of stack causes a segfault?
      ... Why exactly is accessing the stack below %esp always a bug? ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: KSTK_EIP and KSTK_ESP
      ... remember the indexes are in multiples of 32 bit, eg the bottom of the ... stack, since it's close to the end of the pagesize... ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: 4k stacks in 2.6
      ... > at the bottom of the stack and is referenced by masking bits off %esp. ... > So the stack size must be constant whether in process context or IRQ ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Kernel stack
      ... All of these 160K always occupy the kernel (kernel memory ... When a process actives, ESP would switch to ... point to the corresponding stack. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)