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

SIGSEGV running FDM #2103

Open
tsingkong opened this issue Dec 3, 2024 · 6 comments
Open

SIGSEGV running FDM #2103

tsingkong opened this issue Dec 3, 2024 · 6 comments
Assignees

Comments

@tsingkong
Copy link

Steps to reproduce:
clone sources from git
$ mkdir build; cd build; cmake .. -D LARCH64=1 -D BO64=1 -D BO64_BINFMT=1 -D CMAKE_BUILD_TYPE=RelWithDebInfo
$ make -j4
extract FDM(https://files2.freedownloadmanager.org/6/latest/freedownloadmanager.deb) to /opt
$ export BOX64_LD_LIBRARY_PATH=/data/ACE/bookworm-env/usr/lib/x86_64-linux-gnu:/opt/freedownloadmanager/lib
$ BOX64_TRACE_FILE=/tmp/box64-002.log BOX64_LOG=debug /opt/freedownloadmanager/fdm

box64-002.log

@ksco ksco self-assigned this Dec 3, 2024
@ksco
Copy link
Collaborator

ksco commented Dec 3, 2024

I'll look into this soon.

Note on the issue submission: 1) please do not use BOX64_LOG=debug unless asked to, it's almost always too verbose for debugging; 2) there are no such parameters in box64: -D BO64=1 -D BO64_BINFMT=1, so these does not have any effects, please read the compilation documentation here: https://github.com/ptitSeb/box64/blob/main/docs/COMPILE.md.

@ksco
Copy link
Collaborator

ksco commented Dec 3, 2024

I've added the missing wrappers in #2105, but there are still other issues.

@tsingkong
Copy link
Author

I've added the missing wrappers in #2105, but there are still other issues.

Thanks for your effort.
I checkout the patch(#2105) and rebuild box64, the new log as following:

Box64 with Dynarec v0.3.1 f4eed3a2 built on Dec  3 2024 16:58:26
Debug level is 1
Dynarec for LoongArch with extension LSX LASX LBT_X86 LAM_BH LAMCAS SCQ PageSize:16384 Running on Loongson-3A6000-HV with 8 Cores
Will use time-based emulation for rdtsc, even if hardware counter are available
Will use Software counter measured at 1.0 GHz emulating 2.0 GHz
Params database has 14 entries
Params database has 14 entries
Box64 with Dynarec v0.3.1 f4eed3a2 built on Dec  3 2024 16:58:26
BOX64: Detected 48bits at least of address space
Warning, older then 2.34 pthread_kill not found, using current one
Counted 75 Env var
BOX64 LIB PATH: BOX64 BIN PATH: ./:bin/:/usr/local/bin/:/usr/bin/:/bin/:/usr/local/games/:/usr/games/:/data/harmony/command-line-tools/sdk/default/openharmony/toolchains/:/data/harmony/command-line-tools/bin/
Looking for /opt/freedownloadmanager/fdm
Rename process to "fdm"
Using native(wrapped) libcrypto.so.3
Using emulated /opt/freedownloadmanager/lib/libvmsclshared.so.6
Using emulated /opt/freedownloadmanager/lib/liblogger.so.6
Using emulated /opt/freedownloadmanager/lib/libdownloadsjsp.so.6
Using emulated /opt/freedownloadmanager/lib/libquazip.so.6
Using emulated /opt/freedownloadmanager/lib/libQt6QuickControls2.so.6
Using emulated /opt/freedownloadmanager/lib/libQt6Quick.so.6
Using emulated /opt/freedownloadmanager/lib/libQt6Widgets.so.6
Using emulated /opt/freedownloadmanager/lib/libQt6Multimedia.so.6
Using emulated /opt/freedownloadmanager/lib/libQt6Gui.so.6
Using emulated /opt/freedownloadmanager/lib/libQt6Qml.so.6
Using emulated /opt/freedownloadmanager/lib/libQt6Network.so.6
Using emulated /opt/freedownloadmanager/lib/libQt6Sql.so.6
Using emulated /opt/freedownloadmanager/lib/libQt6Core5Compat.so.6
Using emulated /opt/freedownloadmanager/lib/libQt6DBus.so.6
Using emulated /opt/freedownloadmanager/lib/libQt6Core.so.6
Using emulated /data/ACE/bookworm-env/usr/lib/x86_64-linux-gnu/libstdc++.so.6
Using native(wrapped) libm.so.6
Using emulated /data/ACE/bookworm-env/usr/lib/x86_64-linux-gnu/libgcc_s.so.1
Using native(wrapped) libc.so.6
Using native(wrapped) ld-linux-x86-64.so.2
Using native(wrapped) libpthread.so.0
Using native(wrapped) libdl.so.2
Using native(wrapped) libutil.so.1
Using native(wrapped) libresolv.so.2
Using native(wrapped) librt.so.1
Using native(wrapped) libbsd.so.0
Error initializing native libicui18n.so.73 (last dlerror is libicui18n.so.73: cannot open shared object file: No such file or directory)
Using emulated /opt/freedownloadmanager/lib/libicui18n.so.73
Error initializing native libicuuc.so.73 (last dlerror is libicuuc.so.73: cannot open shared object file: No such file or directory)
Using emulated /opt/freedownloadmanager/lib/libicuuc.so.73
Using emulated /opt/freedownloadmanager/lib/libicudata.so.73
Using native(wrapped) libglib-2.0.so.0
Using native(wrapped) libz.so.1
Using native(wrapped) libgthread-2.0.so.0
Using native(wrapped) libdbus-1.so.3
Using native(wrapped) libgssapi_krb5.so.2
Look for __dn_expand in loaded elfs
Warning, function __dn_expand not found in lib libresolv.so.2
Look for __dn_expand in loaded elfs
Warning, function __dn_expand not found in lib libresolv.so.2
Using native(wrapped) libEGL.so.1
Using native(wrapped) libfontconfig.so.1
Using native(wrapped) libexpat.so.1
Using native(wrapped) libfreetype.so.6
Using native(wrapped) libX11.so.6
Using native(wrapped) libxcb.so.1
Using native(wrapped) libXau.so.6
Using native(wrapped) libXdmcp.so.6
Using native(wrapped) libxkbcommon.so.0
Using native(wrapped) libGL.so.1
Using native(wrapped) libpulse.so.0
Using emulated /opt/freedownloadmanager/lib/libQt6QmlModels.so.6
Using emulated /opt/freedownloadmanager/lib/libQt6OpenGL.so.6
Using emulated /opt/freedownloadmanager/lib/libQt6QuickTemplates2.so.6
Using emulated /opt/freedownloadmanager/lib/libdownloadsms.so.6
990946|SIGSEGV @0x7fffee43798c (???(0x7fffee43798c)) (x64pc=0x7fff0e25ad2a/"/opt/freedownloadmanager/lib/libQt6Core.so.6 + 0x25ad2a", rsp=0x7ffff0fec758, stack=0x7ffff07f0000:0x7ffff0ff0000 own=(nil) fp=0x1c), for accessing 0x5f8bc000 (code=1/prot=0), db=0x7fffec93c3a0(0x7fffee437610:0x7fffee438300/0x7fff0e25ac70:0x7fff0e25afd5//opt/freedownloadmanager/lib/libQt6Core.so.6 + 0x25ac70:clean, hash:41be986b/41be986b) handler=(nil)
RAX:0x00000000ffffffa2 RCX:0x00000000ffffff82 RDX:0x000000005f8b7bc4 RBX:0x000000005f8b1e90 
RSP:0x00007ffff0fec758 RBP:0x000000000000001c RSI:0x000000005f8bc000 RDI:0x000000005f8bc001 
 R8:0x00007fff0e25ac70  R9:0x0000000000000000 R10:0x00007ffffb833330 R11:0x000000005f8af168 
R12:0x00007ffff0fec808 R13:0x000000005f8af168 R14:0x000000005f8bbfff R15:0x00007ffff0fec7a0 
ES:0x002b CS:0x0033 SS:0x002b DS:0x002b FS:0x0043 GS:0x0053 
RSP-0x20:0x000000005f8b1f00 RSP-0x18:0x000000005f8b1e90 RSP-0x10:0x000000000000001c RSP-0x08:0x00007ffff0fec7a0
RSP+0x00:0x00007fff0e25e005 RSP+0x08:0x000000005f8b1e90 RSP+0x10:0x000000000000001c RSP+0x18:0x00007ffff0fec870 x64opcode=88 06 49 39 D2 76 1B 0F (opcode=2900024c)

@ksco
Copy link
Collaborator

ksco commented Dec 3, 2024

I added another fix above, it goes further, but still not enough :(

Logs:

Using emulated /home/ksco/Downloads/freedownloadmanager/plugins/tls/libqopensslbackend.so
Using emulated /home/ksco/Downloads/freedownloadmanager/plugins/tls/libqcertonlybackend.so
Using native(wrapped) libssl.so.3
Using emulated /home/ksco/Downloads/freedownloadmanager/plugins/sqldrivers/libqsqlite.so
Unsupported option 'PRAGMA journal_mode=WAL'
Using emulated /home/ksco/Downloads/freedownloadmanager/plugins/networkinformation/libqglib.so
Using native(wrapped) libgobject-2.0.so.0
Using native(wrapped) libgio-2.0.so.0
Using native(wrapped) libgmodule-2.0.so.0
Using emulated /home/ksco/Downloads/freedownloadmanager/plugins/networkinformation/libqnetworkmanager.so
25629|SIGSEGV @0x7ffff13f5850 (dbus_pending_call_get_completed(/usr/lib/libdbus-1.so.3)) (x64pc=0x300e0113/"???", rsp=0x7fffdf98b978, stack=0x7fffdf18c000:0x7fffdf98c000 own=0x7fffdf18c000 fp=0x7fffd8026ce0), for accessing 0x20 (code=1/prot=0), db=(nil)((nil):(nil)/(nil):(nil)/???:clean, hash:0/0) handler=(nil)
RSP-0x20:0x00007fffd8026ce0 RSP-0x18:0x00007fffdf98b998 RSP-0x10:0x00000000497540d0 RSP-0x08:0x000000000000002e
RSP+0x00:0x00007fff0d04d719 RSP+0x08:0x00007fffdf98b9a0 RSP+0x10:0x00007fffdf98b9c0 RSP+0x18:0x0000000000000000
RAX:0x00007fff0d0c8ae0 RCX:0x00007fff0e6e1b48 RDX:0x0000000000000004 RBX:0x00007fffdf98b9e0 
RSP:0x00007fffdf98b978 RBP:0x00007fffd8026ce0 RSI:0x0000000049bdf080 RDI:0x0000000000000000 
 R8:0x0000000000000001  R9:0x0000000000000003 R10:0x00007fffdf98b9a0 R11:0x00007fffdf98bad0 
R12:0x00007fffdf98b998 R13:0x00007fffdf98bb70 R14:0x00007fffdf98ba20 R15:0x00007fff0d0c8ae0 
ES:0x002b CS:0x0033 SS:0x002b DS:0x002b FS:0x0043 GS:0x0053  x64opcode=C3 00 00 02 BD 75 49 00 (opcode=28c08084)
段错误(核心已转储)

@ksco ksco changed the title SIGSEGV running FDM on loongarch64 SIGSEGV running FDM Dec 3, 2024
@ksco
Copy link
Collaborator

ksco commented Dec 3, 2024

But now, the error is exactly the same on aarch64 too, so this becomes a box64 issue in general, I updated the title.

@xiangzhai
Copy link
Contributor

Hi,

box64 patch:

diff --git a/src/librarian/library.c b/src/librarian/library.c
index bba84224..26cbd51d 100644
--- a/src/librarian/library.c
+++ b/src/librarian/library.c
@@ -263,7 +263,7 @@ static void initWrappedLib(library_t *lib, box64context_t* context) {
     for (int i=0; i<nb; ++i) {
         wrappedlib_t* w = box64_is32bits?(&wrappedlibs32[i]):(&wrappedlibs[i]);
         if(strcmp(lib->name, w->name)==0) {
-            if(w->init(lib, context)) {
+            if (w->init(lib, context) || strcmp(lib->name, "libdbus-1.so.3") == 0) {
                 // error!
                 const char* error_str = dlerror();
                 if(error_str)   // don't print the message if there is no error string from last error
diff --git a/src/wrapped/wrappedgio2_private.h b/src/wrapped/wrappedgio2_private.h
index 33caa31f..8f9aaacf 100644
--- a/src/wrapped/wrappedgio2_private.h
+++ b/src/wrapped/wrappedgio2_private.h
@@ -1146,6 +1146,7 @@ GO(g_network_monitor_can_reach_finish, iFppp)
 GO(g_network_monitor_get_connectivity, iFp)
 GO(g_network_monitor_get_default, pFv)
 GO(g_network_monitor_get_network_available, iFp)
+GO(g_network_monitor_get_network_metered, iFp)
 GO(g_network_monitor_get_type, LFv)
 GO(g_network_service_get_domain, pFp)
 GO(g_network_service_get_protocol, pFp)

dbus patch:

--- dbus-1.14.10/dbus/dbus-pending-call.c	2022-10-02 22:06:53.000000000 +0800
+++ dbus-1.14.10.mod/dbus/dbus-pending-call.c	2024-12-04 17:54:54.771841364 +0800
@@ -22,6 +22,7 @@
  */
 
 #include <config.h>
+#include <stdio.h>
 #include "dbus-internals.h"
 #include "dbus-connection-internal.h"
 #include "dbus-message-internal.h"
@@ -763,6 +764,7 @@
 void
 dbus_pending_call_block (DBusPendingCall *pending)
 {
+  printf("DEBUG: %s:%d pending: 0x%lx\n", __func__, __LINE__, (long unsigned int) pending);
   _dbus_return_if_fail (pending != NULL);
 
   _dbus_connection_block_pending_call (pending);

Put libdbus-1.so.3 under lib, then not reproduced the dbus issue for KP920 or 3A5000, but slipped into infinite loop:

Using emulated /home/zhaixiang/FDM/opt/freedownloadmanager/lib/libdbus-1.so.3
Using emulated /home/zhaixiang/FDM/opt/freedownloadmanager/lib/libsystemd.so.0
Using native(wrapped) liblzma.so.5
Using emulated /home/zhaixiang/FDM/opt/freedownloadmanager/lib/liblz4.so.1
...
=>DEBUG: dbus_pending_call_block:767 pending: 0xffec01ff70
...
Using emulated /home/zhaixiang/FDM/opt/freedownloadmanager/qml/QtQml/WorkerScript/libworkerscriptplugin.so
Using emulated /home/zhaixiang/FDM/opt/freedownloadmanager/qml/QtQml/WorkerScript/../../../lib/libQt6QmlWorkerScript.so.6
Using emulated /home/zhaixiang/FDM/opt/freedownloadmanager/qml/QtQuick/Window/libquickwindowplugin.so
Using emulated /home/zhaixiang/FDM/opt/freedownloadmanager/qml/QtQuick/Controls/libqtquickcontrols2plugin.so
Using emulated /home/zhaixiang/FDM/opt/freedownloadmanager/qml/QtQuick/Controls/../../../lib/libQt6QuickControls2Impl.so.6
Using emulated /home/zhaixiang/FDM/opt/freedownloadmanager/qml/QtQuick/Controls/Fusion/libqtquickcontrols2fusionstyleplugin.so
Using emulated /home/zhaixiang/FDM/opt/freedownloadmanager/qml/QtQuick/Controls/Fusion/../../../../lib/libQt6QuickControls2Fusion.so.6
Using emulated /home/zhaixiang/FDM/opt/freedownloadmanager/lib/libQt6QuickControls2FusionStyleImpl.so.6
Using emulated /home/zhaixiang/FDM/opt/freedownloadmanager/qml/QtQuick/Controls/Basic/libqtquickcontrols2basicstyleplugin.so
Using emulated /home/zhaixiang/FDM/opt/freedownloadmanager/qml/QtQuick/Controls/Basic/../../../../lib/libQt6QuickControls2Basic.so.6
Using emulated /home/zhaixiang/FDM/opt/freedownloadmanager/lib/libQt6QuickControls2BasicStyleImpl.so.6
...

Looking for wrapper dbus root cause...

Thanks,
Leslie Zhai

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants