Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] unhandled segfault in crashHandler on process exit #2053

Open
1 task done
lkr0n opened this issue Jan 5, 2025 · 0 comments
Open
1 task done

[Bug] unhandled segfault in crashHandler on process exit #2053

lkr0n opened this issue Jan 5, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@lkr0n
Copy link

lkr0n commented Jan 5, 2025

Operating System

Linux

What's the issue you encountered?

imhex exited with an unhandled segfault during imhex exit.
No crash.json could be found.
Log-file does not contain any crash-relevant entries.
The cause for imhex exiting was likely my Xorg-server crashing.
So this bug might not be critical but I am reporting it anyway.

Expected Behaviour:

  • segfault is handled properly through crash handler installed by ImHex
  • crash.json is available

Analysis

Can provide coredump file if necessary.
Here the backtrace of the generated imhex coredump:

(gdb) bt
#0  0x00007f11507885cf in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
#1  0x00007f1150789c2a in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1
#2  0x00007f115078a269 in _Unwind_Resume_or_Rethrow () from /lib/x86_64-linux-gnu/libgcc_s.so.1
#3  0x00007f114f4b32d2 in __cxa_rethrow () from /lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007f114f593988 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007f114f5937cd in std::filesystem::__cxx11::path::_List::_List(std::filesystem::__cxx11::path::_List const&) () from /lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007f11501a3345 in hex::ProjectFile::getPath[abi:cxx11]() () from /lib/x86_64-linux-gnu/libimhex.so.1.37.0.WIP
#7  0x000055877ec3bd29 in hex::crash::saveCrashFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
#8  0x000055877ec3c7f4 in hex::crash::handleCrash(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
#9  0x000055877ec3caf6 in hex::crash::signalHandler(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
#10 0x000055877ec3cdd8 in hex::crash::setupCrashHandlers()::{lambda(int)#1}::_FUN(int) ()
#11 <signal handler called>
#12 0x00007f11240f3330 in ?? ()
#13 0x00007f11501a40f7 in hex::AutoReset<std::vector<hex::ProjectFile::ProviderHandler, std::allocator<hex::ProjectFile::ProviderHandler> > >::~AutoReset() () from /lib/x86_64-linux-gnu/libimhex.so.1.37.0.WIP
#14 0x00007f114f165c91 in __cxa_finalize (d=0x7f1150552140) at ./stdlib/cxa_finalize.c:97
#15 0x00007f114fc80e17 in __do_global_dtors_aux () from /lib/x86_64-linux-gnu/libimhex.so.1.37.0.WIP
#16 0x00007f115082f170 in ?? ()
#17 0x00007f11508380d2 in _dl_call_fini (closure_map=0x7fff844e1230, closure_map@entry=0x7f115082f170) at ./elf/dl-call_fini.c:43
#18 0x00007f115083b0ee in _dl_fini () at ./elf/dl-fini.c:114
#19 0x00007f114f1661a1 in __run_exit_handlers (status=1, listp=0x7f114f30b680 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at ./stdlib/exit.c:108
#20 0x00007f114f16625a in __GI_exit (status=<optimized out>) at ./stdlib/exit.c:138
#21 0x00007f114d9004d4 in _XDefaultIOError () from /lib/x86_64-linux-gnu/libX11.so.6
#22 0x00007f114d9007e3 in _XIOError () from /lib/x86_64-linux-gnu/libX11.so.6
#23 0x00007f114d8fe688 in _XReply () from /lib/x86_64-linux-gnu/libX11.so.6
#24 0x00007f114d8e2edd in _XGetWindowAttributes () from /lib/x86_64-linux-gnu/libX11.so.6
#25 0x00007f114d8e303d in XGetWindowAttributes () from /lib/x86_64-linux-gnu/libX11.so.6
#26 0x00007f114f7f68af in ?? () from /lib/x86_64-linux-gnu/libglfw.so.3
#27 0x000055877ec52734 in hex::Window::loop() ()
#28 0x000055877ec98477 in hex::init::runImHex() ()
#29 0x000055877ec3652e in main ()

Xorg-server also crashed at the same time that imhex crashed.
That is mostly likely why imhex itselfs exits and (I suspect) also why the AutoReset destructor is interrupted by a signal handler.
The crash handler segfaults then while calling ProjectFile::getPath which from cursory look into the code relies on at least one allocation wrapped in AutoReset. I suspect that this allocation has been already freed leading to the segfault.

How can the issue be reproduced?

I have not found a way to repro this.

ImHex Version

1.37.0.WIP 3dec4cc

ImHex Build Type

  • Nightly or built from sources

Installation type

sudo ninja install

Additional context?

imhex was linked with mold 2.35.0

@lkr0n lkr0n added the bug Something isn't working label Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant