You are not logged in.

#1 2022-01-14 20:41:00

dakota
Member
Registered: 2016-05-20
Posts: 273

[SOLVED] What Can I Do with a Segfault?

At various times I have experienced programs which segfault: for example, Anki, Verecrypt, and TeamViewer.

Sometimes other people experience the same problem, but most of the time it seems like it is just me. Sometimes the problem is fixed with the next update, sometimes not.

As I understand it, a segfault happens when a program tries to access memory that it is not allowed to access. That doesn't sound like anything that I (as a user, not a programmer) can control.

However, because the problems seem to affect only me, I wonder if program and/or system configuration is the root cause?

Is there anything I can do to troubleshoot and remedy this situation?

The most recent example is a re-occurence of a previous TeamViewer problem. The problem originally disappeared after an update, but has recently returned. (Just like the problem with Anki periodically appears and disappears.)

Most recent journal: http://ix.io/3MbZ

Any help with the TeamViewer problem is appreciated, but what I'm really looking for is a strategy for dealing with these kinds of problems in the future, keeping in mind that I'm not a programmer.

Cheers,

Last edited by dakota (2022-01-15 18:53:06)


"Before Enlightenment chop wood, carry water. After Enlightenment chop wood, carry water." -- Zen proverb

Offline

#2 2022-01-14 23:51:44

Zod
Member
From: Hoosiertucky
Registered: 2019-03-10
Posts: 629

Re: [SOLVED] What Can I Do with a Segfault?

I have found that sometimes hardware can cause segfaults..

Test your ram, move things to different ports , re-seat things.

If you can leave a thing disconnected, do so for a period of time.

Offline

#3 2022-01-15 01:24:20

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: [SOLVED] What Can I Do with a Segfault?

Just saying it was a segfault doesn't mean a whole lot.  You'd need to debug where the fault actually is.  Build the package with debugging symbols, then if / when you get a segfault you can use gdb and related tools to gather information that could then be used to trace it further.  We can help with that here, but only if you collect that data first.

You might then see a common theme.  In a previous thread there was some speculation about whether it might be video driver related.  Given that two of your problematic programs depend on qt5-webengine, I'd not be all that suprised.  qt5-webengine has some pretty crappy memory handling issues that crop up selectively with specific video drivers.

But what is your video hardware and driver?


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#4 2022-01-15 09:02:06

seth
Member
Registered: 2012-09-03
Posts: 49,971

Re: [SOLVED] What Can I Do with a Segfault?

Binary incompatibility?
Anki turned out to be a dated package from the repo, rebuilding it from the AUR fixed it.
Teamviewer is a binary only release, compiled for debian/ubuntu and segfaults in some private/stripped functions

                                                #0  0x0000000000e0a23f n/a (TeamViewer + 0xa0a23f)
                                                #1  0x0000000000e01b10 n/a (TeamViewer + 0xa01b10)
                                                #2  0x0000000000dd452b n/a (TeamViewer + 0x9d452b)
                                                #3  0x0000000000dd020e n/a (TeamViewer + 0x9d020e)
                                                #4  0x0000000000da0174 n/a (TeamViewer + 0x9a0174)
                                                #5  0x0000000000d3055d n/a (TeamViewer + 0x93055d)
                                                #6  0x000000000137f848 n/a (TeamViewer + 0xf7f848)
                                                #7  0x00007fd6b007d259 start_thread (libpthread.so.0 + 0x9259)
                                                #8  0x00007fd6afe605e3 __clone (libc.so.6 + 0xfe5e3)

"debug-enabled build" is probably not a thing here sad

The veracrypt bug is kinda underspecified (because the post is fro 2018 and the screenshots are now 404) but graphical glitches are not segfaults.

Online

#5 2022-01-15 17:17:50

dakota
Member
Registered: 2016-05-20
Posts: 273

Re: [SOLVED] What Can I Do with a Segfault?

@Zod
Thanks. Good to know. However, in each of these cases I was able to duplicate the problem on different hardware. I'll keep this is mind for the future, however.

What do you mean by "If you can leave a thing disconnected, do so for a period of time"? Do you mean that hardware problems might be intermittent? And that it might take a while to show up?

====================

@Trilby
I'm confused. I was under the impression that the kernel handled memory management and that software asked the kernel for a bank of memory to use and then limited itself to that area. So... a "segfault" would be kernel-related and would invariably affect many users.

It sounds like you're saying that it's much more complicated than that... that a piece of software (program) interacts with memory in many ways and that to troubleshoot this problem I need to pinpoint exactly where that interaction fails. It may fail where the program interacts with the kernel... but it also may fail where the program interacts with other programs or libraries (any of which might be unique to my system).

If the program is available as source code, then I can compile it with debugging symbols and then use tools to trace the execution of that program (and identify where it fails).

Have I got that right?

Unfortunately,

arojas wrote:

Anki is a python program. There is nothing to build, rebuilding it will just give you a package identical to the one in the repos.

seth wrote:

Teamviewer is a binary only release, compiled for debian/ubuntu and segfaults in some private/stripped functions

However, the information you have given me is very valuable and I have a path forward (collecting information about the video hardware and drivers).

Thank you.

====================

@seth
Yes, anki was an outdated package. The next rebuild fixed it. But the one after that failed. And the next one worked. And the next one failed. And I finally gave up on it.

Sorry about bringing up veracrypt. I was thinking that it, too, was based on qt, but I now see that it is based on gtk3.

seth wrote:

Teamviewer ... segfaults in some private/stripped functions

Can you explain a little more what "private/stripped functions" means?

Cheers,


"Before Enlightenment chop wood, carry water. After Enlightenment chop wood, carry water." -- Zen proverb

Offline

#6 2022-01-15 17:39:20

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,739

Re: [SOLVED] What Can I Do with a Segfault?

dakota wrote:

I'm confused. I was under the impression that the kernel handled memory management and that software asked the kernel for a bank of memory to use and then limited itself to that area. So... a "segfault" would be kernel-related and would invariably affect many users.

And, when a program tries to access memory outside the region assigned to it (which, if allowed, could see and/or change memory assigned to other programs), what is it that you think the kernel does?   That is right, the memory management unit raises an exception and the kernel reacts by sending a segfault to the program that is violating its memory boundaries, usually killing it.  How can this happen?  Dereferencing  an invalid pointer and buffer overruns are a couple popular means.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#7 2022-01-15 18:06:24

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: [SOLVED] What Can I Do with a Segfault?

dakota wrote:

... and that software asked the kernel for a bank of memory to use and then limited itself to that area

If it actually did that properly, there'd never be a seg fault.  But the rest of your summary sounds about right.  A seg fault means *something* *somewhere* attempted to access memory it shouldn't.  But this could be in the code of the program you deliberately ran, and it could be in lots of different components of that program, or it could be in a library that said program links to, and even in such cases, it may be a problem in the main program *misusing* a library component.  It really could be an enormously vast array of things.  So saying a program seg faults is only slightly more informative than the famous Gnome popup saying "Oh no! something has gone wrong."

dakota wrote:

Can you explain a little more what "private/stripped functions" means?

Debuggers like gdb can help us identify what binary object (i.e., the program itself vs a library) resulted in the seg fault.  It can also identify what module and function it occurred in, and generally even the exact line of code.  But this process depends on symbols embedded in the binary.  These symbols are stripped (removed) from most installed binaries as they are not often useful and they take up a fair bit of space.

In one sense, these symbols can be thought of like comments in the binary code.  The binary code itself is not readable to a human, but the symbols can be with the help of a debugger.  But once those symbols are removed (the comments are gone) we have no more frame of reference.   This can be seen in backtaces.  The backtrace of a non-stripped binary will show a sequence of function calls and you can literally trace the flow of execution through the source code (main called do-something which in turn called printf which in turn called ...).  But once the symbols are stripped, all we see is a sequence of memory addresses that can't really be mapped onto any meaning (a function at address 7639827564 called another function at address 9786239 which in turn called one at 098721604 ...)

If the program in question has the source code available, we can rebuild it with the symbols intact, and (try to) replicate the error.  We can then get a very good idea exactly what bit of code actually did something wrong.  But if it is a closed-source / proprietary program, we can't do much with it but send a pretty vacuous bug report upstream noting that *something* went wrong.

Last edited by Trilby (2022-01-15 18:09:10)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#8 2022-01-15 18:52:42

dakota
Member
Registered: 2016-05-20
Posts: 273

Re: [SOLVED] What Can I Do with a Segfault?

Thank you all so much! This is much, much clearer!

@ewaller
Some words are like hieroglyphics in my mind. I've heard them for years and even though I think I know what they mean, they are really more like placeholders. Your explanation really hit home and made 'segfault' finally mean something.

@Trilby
Very clear. Especially the explanation of how a debugger works and why "segfault" isn't very useful without additional information!

Trilby wrote:

This can be seen in backtaces.  The backtrace of a non-stripped binary will show a sequence of function calls and you can literally trace the flow of execution through the source code (main called do-something which in turn called printf which in turn called ...)

That is just... so... cool. smile

Cheers,


"Before Enlightenment chop wood, carry water. After Enlightenment chop wood, carry water." -- Zen proverb

Offline

#9 2022-01-15 19:33:11

seth
Member
Registered: 2012-09-03
Posts: 49,971

Re: [SOLVED] What Can I Do with a Segfault?

dakota wrote:

Unfortunately,

arojas wrote:

Anki is a python program. There is nothing to build, rebuilding it will just give you a package identical to the one in the repos.

Fww, idk anything about anki, but there're two versions in the AUR, one's "-bin" (which pip-installs some modules) and the build instruction in the PKGBUILD of the other does "export LDSHARED="/usr/bin/clang -shared"" and runs "bazel build -c opt dist" what very much sounds like something is being compiled there.

Online

#10 2022-01-15 21:56:37

dakota
Member
Registered: 2016-05-20
Posts: 273

Re: [SOLVED] What Can I Do with a Segfault?

Thanks seth!

That sounds like a good project for me to look at next...


"Before Enlightenment chop wood, carry water. After Enlightenment chop wood, carry water." -- Zen proverb

Offline

Board footer

Powered by FluxBB