Can a segmentation fault affect other running programs?
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Can a segmentation fault affect other running programs?
Hi,
So I tried a little C programming, and got a bunch of segmentation fault the first few tries. But from what I understand, the whole purpose of segmentation faults is the protect other programs from the damaging effects of my program. Yet, if I trigger a segfault enough times, weird things happen to my other running programs. I usually run a console inside Kate, and after 10 or so segfaults, Kate sometimes freezes or randomly highlights text, etc. just random behavior. Also, my desktop will occasionally hang and things will start failing, like copying files and such. I have to log out to restore everything to normal, but logging out is difficult since the logout prompt freezes.
I have never experienced such behavior before I began programming, my system has been relatively stable. I run my program from inside Kate's console, so I was wondering if all KDE applications share memory or something, because this has happened once or twice, and only when I trigger a segfault many times. I know segfaults are not good, but they should not affect anything other than itself, right?
So I tried a little C programming, and got a bunch of segmentation fault the first few tries. But from what I understand, the whole purpose of segmentation faults is the protect other programs from the damaging effects of my program. Yet, if I trigger a segfault enough times, weird things happen to my other running programs. I usually run a console inside Kate, and after 10 or so segfaults, Kate sometimes freezes or randomly highlights text, etc. just random behavior. Also, my desktop will occasionally hang and things will start failing, like copying files and such. I have to log out to restore everything to normal, but logging out is difficult since the logout prompt freezes.
I have never experienced such behavior before I began programming, my system has been relatively stable. I run my program from inside Kate's console, so I was wondering if all KDE applications share memory or something, because this has happened once or twice, and only when I trigger a segfault many times. I know segfaults are not good, but they should not affect anything other than itself, right?
thanks,
rabbit2345
For starters, check the 'kate' memory consumption after each segmentation fault. If it increases, I have a theory.
OK, so I checked kate's memory usage after each segfault, and it doesn't seem to be increasing. But then again, I only crashed the program for 5 minutes or so. The buggy behavior only occurred after a day or so of segfaults.
I'm curious what your theory was, as it may very well be what you're thinking, it just happens slowly throughout the day. Also, the test segfault I triggered was caused by trying to print a string with %i. I'm not sure exactly how to reproduce this bug, but I will continue to monitor kate's memory usage.
I'm pretty sure the terminal emulator embedded in kate runs as a part of the same process. This means the kate process also handles the pseudo-terminal; therefore, if whatever leads to the segfault does something strange with the pseudo-terminal it might effect kate. About the only things I can think of that might cause that to happen are output of unprintable characters that the emulator might not know how to handle or an "accidental" call to a termios or ioctl operation.
Kevin Barry
PS Try to run the segfaulting program with nohup a bunch of times in the kate terminal and see if it causes the same errors.
PPS I've had problems in recent versions of kate when programming, but I'm not sure the source. Sometimes when I type the characters the cursor will move behind what I'm typing, putting it in reverse, and sometimes backspace will delete characters that aren't by the cursor. This is always localized to a certain part of the document and normally only happens after pasting multiple lines. Maybe your version of kate is buggy, too. I'm also wondering if your problems coincide with kate's code highlighting or code formatting, since I don't imagine you edited many C files in kate before you started programming.
I checked the process tables and it does look like the terminal is part of kate instead to a seperate process like I thought before. So the repeated segfaults could potentially have an impact, but they still shouldn't since my program and kate don't share memory. I can also see a my program's entry in the process table, as expected. Also, if kate does share memory, then is it shared with the whole KDE system? Since the logout prompt and konqueror and kdesktop all behave strangely as well.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.