Click to See Complete Forum and Search --> : segmentation fault


mnsharif
01-03-2003, 01:59 AM
what possible reasons can be for segmenation fault

??

one is when a process tries to access memory outside of its address space (this point was just explained in a thread here by bastard)

what other reasons can do this....


coz, i only run a C program and then i insert a module into kernel by insmod, and Segmentation Fault occurs in the C program, ??????

why??? i have totally no idea,

anyone have a clue???

ScRapZ_1
01-03-2003, 02:14 AM
Seg faults when loading modules usally means that you're loading a module that isnt suitable for your system. This could mean that your running an i386 system and loading a module thats compiled for an i686... or you're loading a module that searches for a particular piece of hardware that you dont have... just a couple of examples...

...make sure that the module you are loading is the right one for your system(tm)

TTFN,
Scrapz :P

bastard23
01-03-2003, 08:59 AM
mnsharif,
Why don't you debug the C program with gdb (or a front end like ddd or xxgdb)? Then you can see where your program is failing. Is your C program interacting with the kernel module?

Good Luck,
chris

Stuka
01-03-2003, 10:25 AM
As you said, segfaults occur when you access memory outside your process's address space. This happens more often than not because you used an invalid pointer somewhere. A good place to start checking is anywhere you get a pointer back from a function call - did you check to make sure it wasn't NULL? Another possibility is that you passed in an uninitialized variable to a function, and the random junk in the variable caused the error.