Sponsored Content
Operating Systems Linux Ubuntu Stack overflow i guess while insmod Post 302523640 by sunilsukumar4u on Thursday 19th of May 2011 08:59:19 AM
Old 05-19-2011
Stack overflow i guess while insmod

I have built kernel 2.6.35 on my Ubuntu system with some specific requirement. I also built some app defined module with the same kernel. I booted up the built version and I find it did not work properly as there is some gui and other modules missing problem. But the system booted up and I did a insmod app.ko. I faced a crash. I found out that it is a stack problem. A caller function in the APP is passing address of two local variable. like int a, b; add (&a, &b); I checked the values of &a and &b before passing and it remained non-null but when i receive the same in the calling function, both the &a, &b are NULL or some garbage value. I increased the stack size but nothing happened. When i skipped the function call, I could see that many allocation of memory has also failed. So I think it should be memory problem. Is there anything I should be checking for gcc option to define the stack or check for stack overflow. Any hints on this could help me a lot. Thanks in advance. I just made some abstract examples since the original code section takes lot of time to explain. It could be helpful if some one give me hints to proceed.


Code:
main()
    {

    struct DMAINFO* pDmaInfo;
    struct DESC* pDesc;
            /*  printk("The function aruguments are Desc = %p and DmaInfo %p", &pDesc, &pDmaInfo); */

    Create_DMA(&pDesc, &pDmaInfo);
    }


void Create_DMA(**ppDesc, **ppDmaInfor)
    {
    printk("The function aruguments are Desc = %p and DmaInfo %p", ppDesc, ppDmaInfo);
    }

The printk statement inside create_DMA gives me NULL values, but the
same print statement in the main function before the create_DMA call has
some values. I am really confused and any sort of useful advice could help me a lot.

Last edited by radoulov; 05-19-2011 at 10:17 AM.. Reason: Code tags.
 

6 More Discussions You Might Find Interesting

1. BSD

stack overflow in function psync_status Abort (core dumped)

I am running Open BSD 3.8 (3.5 upgrade) on a Pent Pro. 200, 64 Megs Ram, Nvedia Vanta TNT 16 Megs, Realtech 8139 Nic. When running ifconfig -a I get this error back. I've run searches on google no deal. I can get Stack overflow or psync, but not both. So I would really like to know how to fix it. ... (0 Replies)
Discussion started by: jmcpreach
0 Replies

2. Shell Programming and Scripting

guess the fault :)

I really cant understand whats wrong with this: File looks like this: 55 11 Code: cost=30 a= cut -c9-12 File let a=${a}+${cost} echo $a The answer echo should echo 11+30(cost) however the output looks like this: 11 30 And also is there anyway to grep $2 without awk? or maybe... (4 Replies)
Discussion started by: maskot
4 Replies

3. HP-UX

Problem with stack overflow

Hi, I get a problem with stack overflow on HP-UX, when running a C program. Pid 28737 received a SIGSEGV for stack growth failure. Possible causes: insufficient memory or swap space, or stack size exceeded maxssiz. The possible cause i found, was that the definition of a structure had... (0 Replies)
Discussion started by: karthikb23
0 Replies

4. AIX

IBM xlf "parser stack overflow" error

Hello, Does anybody know how to increase IBM xlf parser stack to get rid of the "parser stack overflow" error? Thanks Ping (1 Reply)
Discussion started by: luop0812
1 Replies

5. UNIX for Dummies Questions & Answers

perform stack overflow

Help! I have an AIX system that has a power outage. When I logged in as root and got the system up and running it all looked ok. But.....when a user tries to log in they receive the error: The perform stack has overflowed OP=2117 PC=2124 E=46 in emmcshflif icrun is finished How can I fix... (1 Reply)
Discussion started by: dlegnar
1 Replies

6. Hardware

Stack Overflow Questions Tags Users Badges Unanswered Ask Question Ask for the explanation of types

I have read a document which tells me the following 4 things are done by the RAM embedded on disk driver controller. But I don't know what's difference between buffer and cache. Thanks! RAM on disk drive controllers 1 firmware 2 speed matching buffer 3 prefetching buffer 4 cache (1 Reply)
Discussion started by: 915086731
1 Replies
ALLOCA(3)						     Linux Programmer's Manual							 ALLOCA(3)

NAME
alloca - allocate memory that is automatically freed SYNOPSIS
#include <alloca.h> void *alloca(size_t size); DESCRIPTION
The alloca() function allocates size bytes of space in the stack frame of the caller. This temporary space is automatically freed when the function that called alloca() returns to its caller. RETURN VALUE
The alloca() function returns a pointer to the beginning of the allocated space. If the allocation causes stack overflow, program behavior is undefined. ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7). +----------+---------------+---------+ |Interface | Attribute | Value | +----------+---------------+---------+ |alloca() | Thread safety | MT-Safe | +----------+---------------+---------+ CONFORMING TO
This function is not in POSIX.1. There is evidence that the alloca() function appeared in 32V, PWB, PWB.2, 3BSD, and 4BSD. There is a man page for it in 4.3BSD. Linux uses the GNU version. NOTES
The alloca() function is machine- and compiler-dependent. For certain applications, its use can improve efficiency compared to the use of malloc(3) plus free(3). In certain cases, it can also simplify memory deallocation in applications that use longjmp(3) or siglongjmp(3). Otherwise, its use is discouraged. Because the space allocated by alloca() is allocated within the stack frame, that space is automatically freed if the function return is jumped over by a call to longjmp(3) or siglongjmp(3). Do not attempt to free(3) space allocated by alloca()! Notes on the GNU version Normally, gcc(1) translates calls to alloca() with inlined code. This is not done when either the -ansi, -std=c89, -std=c99, or the -std=c11 option is given and the header <alloca.h> is not included. Otherwise, (without an -ansi or -std=c* option) the glibc version of <stdlib.h> includes <alloca.h> and that contains the lines: #ifdef __GNUC__ #define alloca(size) __builtin_alloca (size) #endif with messy consequences if one has a private version of this function. The fact that the code is inlined means that it is impossible to take the address of this function, or to change its behavior by linking with a different library. The inlined code often consists of a single instruction adjusting the stack pointer, and does not check for stack overflow. Thus, there is no NULL error return. BUGS
There is no error indication if the stack frame cannot be extended. (However, after a failed allocation, the program is likely to receive a SIGSEGV signal if it attempts to access the unallocated space.) On many systems alloca() cannot be used inside the list of arguments of a function call, because the stack space reserved by alloca() would appear on the stack in the middle of the space for the function arguments. SEE ALSO
brk(2), longjmp(3), malloc(3) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. GNU
2017-09-15 ALLOCA(3)
All times are GMT -4. The time now is 12:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy