Originally Published: Saturday, 21 October 2000 Author: Mike Baker
Published to: interact_articles_irc_recap/IRC Recap Page: 1/1 - [Printable]

Best of IRC for Saturday, October 21st.

It's time once again for another edition of Best of IRC. As always we'll be taking an in-depth look at some of the questions asked on #Linuxhelp. If you haven't already been to #Linuxhelp you'll find instructions on how to get there at the bottom of the Live! page; feel free to stop by and ask questions or possibly even answer a few, we appreciate any help we can get.

   Page 1 of 1  

Segmentation Fault

Signal 11 is SIGSEGV, what that means I have no idea...
<eugene> muks what does signal 11 mean in quake3, do you know?
<md-ZZzz> refer to the manual for gcc for an answer to what "signal 11" is
<md-ZZzz> signal 11 is SIGSEGV
<md-ZZzz> what that means i have no idea
<freon> md-ZZzz : segmentation fault
<md-ZZzz> ahh
<freon> md-ZZzz : it means your program tried to access memory it didn't own
<md-ZZzz> :)
<freon> not good on a multiuser system
<muks> freon: that's untrue
<muks> don't mislead him
<eugene> that's weird
<eugene> :(
<md-ZZzz> not good on any system ;0
<muks> signal 11 is not all about a segmentation fault really.
<freon> muks : what else?
<eugene> the error said
<auknight> int main() { int array[10]; array[11] = 42; return 0; }
<freon> auknight int main() { char *ptr = 0; *ptr = 1 }
<auknight> freon: :)
<freon> muks : from WRS's Advanced programming in the UNIX enviornment :
<freon> SIGSEGV: this signal indicates that the process has made an invalid memory reference
<freon> muks : sure you aren't thinking of SIGILL or SIGTRAP?
<muks> hrm okies. i won't give knowledge from my "useless box of stuff"
<muks> freon: i'm sure =) heh
<auknight> you can get a sig11 from a hardware problem
<auknight> but it's usually a problem with the program itself
<muks> search signal 11
<search> signal 11: http://www.bitwizard.nl/sig11/

Signal 11 aka Segmentation Fault or more commonly known as a segfault occurs when a program attempts to access memory not claimed by the application. The segfault is intended to stop the program before it corrupts the memory of another application or ultimately brings the system down, hence the segfault error is actually protecting your system, not just a pesky unix thing thatmo st people make it out to be. The actual segfault however suggests that there may be something wrong with your system worth checking. The fact that any application would cause a segfault is cause for abit of concern.

Segmentation Faults occur either because of a hardware or software issue. It's not uncommon for a program not to check the validity of the user input and accidentally attempt to write too much data into memory. Although not desirable it does happen from time to time. The more extreme cases occur when a segfault doesn't occur and the program continues on using this corupted data. If malicious data is carefully crafted and fed to such a program, it's possible that the program might be tricked into executing arbitrary commands. Such a situation is referred to as an exploit - reason enough not to run programs as root.

Segmentation Faults can also happen as a result of faulty hardware, typically these are situations where a program may run find 9 ot of 10 times but mysteriously fail on the 10th time, or fail at random places. Segfaults in hardware generally occur either because the computer is overheating or because of errors storing data to memory. If the computer attempts to store a value in memory and later reads back a different value because of hardware error you'll most likely get a segfault when the computer tries to use the data. Likewise, if the computer is overheating the results from the cpu, start becoming unpredictable and everything gets corrupted either causing a segfault or worse - bringing your computer to a halt. Hardware segfaults have a tendency to occur during compiles both because of the extra load on the cpu and the massive ammounts of data going through memory. It's suprisingly common for a computer to seemingly work fine until a compile.

For more information about the Segmentation Fault check out the Sig 11 Faq at http://www.bitwizard.nl/sig11/, note however this focuses on the hardware side.

   Page 1 of 1