coredump of stack overflow

1. caused by stack overflow occurs in the core are often recursive call.

   See when gdb features are:

     Stack missing, the current stack address unreadable. According to the characteristics of the stack is growing reverse (reverse growing stack, so it is prone to overflow coverage array-like function return address, address error causes the function to exit), you can increase the stack to find the location by address.

     Often after finding effective stack will find duplicate addresses repeat, this is actually caused by recursive, according to the function address can be found along the recursive function calls several corresponding formed. Further analysis of the formed recursive process.

 

2. The core stack overflow initiator may also be present in a single stack becomes excessive.

    gdb see the same stack is missing, but because this is not a function call causes, often the problem is variable in the current line of code assigned to emerge.

    Had previously encountered a problem, you can start a process under normal conditions, but under certain circumstances (such as pulled by other processes) will be off the core, core location is just entering the main function, I feel very Mongolia.

        The final analysis result is directly below the main function is to generate a generate a target, because the template is packaged before distribution did not notice the local objects. The actual discovery of this object actually have 80MB, more than linux default stack size. It will lead the process but not when it is the direct successor to the parent process when the stack is set ulimit -s modify the size of the stack, and then pull up the process in other processes, can not be met by more than 80MB at startup through its own startup script start up.

 

3. ulimit -s does affect the size of the process stack space, but note that it can only affect the main thread stack space of the process, because only the main thread is pulled through the shell, the various sub-process thread is created by the main thread calls api, the child thread size of the space is controlled by the main thread.

4. stack overflow caused by the fact it is core signal 11, Segmentation fault. Signal 11, or officially know as "segmentation fault", means that theprogram accessed a memory location that was not assigned. That'susually a bug in the program. That access unallocated memory is not mapped to a physical memory address space in the process. So stack overflow does not necessarily core immediately. But just went to the address after the stack overflow or the process is not over-allocation will address core out. 

5. By default, default through glibc allocating memory unit 128K is allocated for the memory, even though only assign a char, but also have assigned 128K. Yet appears, the program is taking up 128K of memory, it would create a process 128K memory map, so not have access to a program unallocated addresses will be core, because it seems that this operating system memory is 128K process. Of course, this pot should be back by the glibc, not the operating system. Glibc-intentioned but also reduce the number of blocks allocated to reduce the operating pressure of the system before doing so embarrassing.

 

Analog stack overflow core examples:

Linux and say goodbye to the core: stack overflow

 

Guess you like

Origin www.cnblogs.com/dongzhiquan/p/core_because_stack_overflow.html