void-linux / void-packages

The Void source packages collection
https://voidlinux.org
Other
2.5k stars 2.11k forks source link

MISSING INFO: Crash: Dolphin musl can't paste a file. #51303

Closed hervyqa closed 3 weeks ago

hervyqa commented 1 month ago

Is this a new report?

Yes

System Info

Void 6.6.40_1 x86_64-musl AuthenticAMD uptodate FF

Package(s) Affected

dolphin-24.05.1_2-x86_64-musl

Does a report exist for this bug with the project's home (upstream) and/or another distro?

Expected behaviour

Successful paste.

Actual behaviour

Segmentation fault.

bash:

[hervyqa@void ~]$ dolphin
org.kde.dolphin: Unknown class  ""  in session saved data!
Segmentation fault

fish:

➜  ~ dolphin 
org.kde.dolphin: Unknown class  ""  in session saved data!
fish: Job 1, 'dolphin' terminated by signal SIGSEGV (Address boundary error)
➜  ~ 

gdb dolphin:

➜  ~ gdb dolphin
GNU gdb (GDB) 15.1
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-musl".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from dolphin...
(No debugging symbols found in dolphin)
(gdb) run
Starting program: /usr/bin/dolphin 
[New LWP 3618]
[New LWP 3619]
[New LWP 3620]
[New LWP 3621]
[New LWP 3622]
[New LWP 3623]
[New LWP 3624]
[New LWP 3625]
[New LWP 3626]
[New LWP 3627]
[New LWP 3628]
[New LWP 3629]
[New LWP 3630]
[LWP 3630 exited]
[LWP 3629 exited]
[LWP 3628 exited]
[LWP 3627 exited]
[New LWP 3631]
[New LWP 3632]
[New LWP 3633]
[New LWP 3634]
[LWP 3634 exited]
[LWP 3633 exited]
[LWP 3632 exited]
[LWP 3631 exited]
[New LWP 3635]
[New LWP 3636]
[New LWP 3637]
org.kde.dolphin: Unknown class  ""  in session saved data!
[Detaching after vfork from child process 3638]
[Detaching after vfork from child process 3640]
[New LWP 3642]
[New LWP 3643]
[New LWP 3645]
[Detaching after vfork from child process 3646]
Cannot initialize model with data QJsonObject(). missing: QJsonValue(string, "urls")
[Detaching after vfork from child process 3673]
[Detaching after vfork from child process 3674]
QGestureManager::deliverEvent: could not find the target for gesture
QGestureManager::deliverEvent: could not find the target for gesture

Thread 23 "KIO::WorkerThre" received signal SIGSEGV, Segmentation fault.
[Switching to LWP 3643]
0x00007fffe0014eb9 in ?? () from /usr/lib/qt6/plugins/kf6/kio/kio_file.so
(gdb) bt
#0  0x00007fffe0014eb9 in ?? () from /usr/lib/qt6/plugins/kf6/kio/kio_file.so
#1  0x00007ffff783bb6e in ?? () from /lib/libKF6KIOCore.so.6
#2  0x00007ffff7835043 in ?? () from /lib/libKF6KIOCore.so.6
#3  0x00007ffff7831ede in ?? () from /lib/libKF6KIOCore.so.6
#4  0x00007ffff78ddefe in ?? () from /lib/libKF6KIOCore.so.6
#5  0x00007ffff5a25e63 in ?? () from /lib/libQt6Core.so.6
#6  0x00007ffff7fb7c0e in start (p=0x7fffddd0b780) at src/thread/pthread_create.c:195
#7  0x00007ffff7fc4b5b in __clone () at src/thread/x86_64/clone.s:22
Backtrace stopped: frame did not save the PC
(gdb) 

Steps to reproduce

  1. Create new file, for example: index.html
  2. Copy index.html
  3. Paste index.html
  4. Dolphin crash!

But, copy-paste folder looks fine.

sgn commented 1 month ago

😮‍💨

Can you install kf6-kio-dbg and show the backtrace!

sgn commented 1 month ago

Is this the system with packages from Void or built by you?

sgn commented 1 month ago

Does a report exist for this bug with the project's home (upstream) and/or another distro?

* [https://bugs.kde.org/show_bug.cgi?id=452778 (Dolphin can't copy a file into network folder with samba version 1.0)](https://bugs.kde.org/show_bug.cgi?id=452778)

* [https://bugs.kde.org/show_bug.cgi?id=479557 (unable to copy/paste files from steamdeck to another path)](https://bugs.kde.org/show_bug.cgi?id=452778)

Does your problem invoke network, e.g. NFS, samba? If not, why do you link those problem?

hervyqa commented 1 month ago

😮‍💨

Can you install kf6-kio-dbg and show the backtrace!

unfortunately I've moved to x86_64 (glibc) architecture.

Is this the system with packages from Void or built by you?

from voidlinux, install kde5.

Does your problem invoke network, e.g. NFS, samba? If not, why do you link those problem?

not samba. but, maybe related. there are keywords that cannot be copied/pasted, even though they are in samba or steamdeck.

sgn commented 1 month ago

So, this is unactionable.

nekopsykose commented 1 month ago

dolphin needs a raised default stack size (-Wl,-z,stack-size=0x200000) to not crash in that spawned kio thread due to stack overflow on musl

Plut0nio commented 1 month ago

So, this is unactionable.

* We don't have a crystal ball to guess your problem.

* We have some people running KDE on musl but they're fine. So, there must be something specific in your setup, e.g. filesystem, timestamp, etc...

* Your link to other bug reports is meaningless, your back trace is useless.

I'm having pretty much this exact same issue on Void musl, though my backtrace looks a bit different.

gdb dolphin
GNU gdb (GDB) 15.1
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-musl".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from dolphin...
(No debugging symbols found in dolphin)
(gdb) run
Starting program: /usr/bin/dolphin 
[New LWP 19951]
[New LWP 19952]
[New LWP 19953]
[New LWP 19954]
[LWP 19954 exited]
[New LWP 19955]
[LWP 19955 exited]
[New LWP 19957]
[New LWP 19958]
[New LWP 19959]
[New LWP 19960]
[New LWP 19961]
[Detaching after vfork from child process 19965]
[Detaching after vfork from child process 19967]
[New LWP 19969]
[New LWP 19970]
[New LWP 19972]
[New LWP 19973]
[Detaching after vfork from child process 19974]
[LWP 19969 exited]

Thread 15 "KIO::WorkerThre" received signal SIGSEGV, Segmentation fault.
[Switching to LWP 19973]
0x00007fffe0ab4eb9 in FileProtocol::copy (this=0x55555627dfc0, srcUrl=..., destUrl=..., _mode=420, _flags=...) at ../src/kioworkers/file/file_unix.cpp:530
warning: 530    ../src/kioworkers/file/file_unix.cpp: No such file or directory
(gdb) Quit
(gdb) Quit
(gdb) quit
A debugging session is active.

        Inferior 1 [process 19947] will be killed.

Quit anyway? (y or n) y

KDE Plasma Version: 6.1.3 KDE Frameworks Version 6.3.0 Qt Version 6.7.2 Kernel Version: 6.6.43_1 (64-bit) Graphics Platform: X11 Dolphin Version: 24.05.1

It might be worth noting that I built and installed kio-admin v24.07.80 (Qt6 version) from GitHub since it wasn't in the Void repos (I need it to open folders in admin mode), but I don't think it affects this issue since I still got the issue without kio-admin installed.

nekopsykose commented 1 month ago

you can prove it's a stack overflow with like

# crashing frame
(lldb) f 0
# note down the 0x address
(lldb) reg read $sp
# frame that the thread starts at (__clone)
(lldb) f 7
# note it again
(lldb) reg read $sp

then in python

0xsecondone - 0xfirstone

gives you a value larger than 128KiB, so the stack has overflowed. the -Wl link args i posted would fix it

Plut0nio commented 1 month ago

you can prove it's a stack overflow with like

# crashing frame
(lldb) f 0
# note down the 0x address
(lldb) reg read $sp
# frame that the thread starts at (__clone)
(lldb) f 7
# note it again
(lldb) reg read $sp

then in python

0xsecondone - 0xfirstone

gives you a value larger than 128KiB, so the stack has overflowed. the -Wl link args i posted would fix it

f 7 gave me error: Frame index (7) out of range., so I had to use f 1 instead. Here's my output:

$ lldb dolphin
(lldb) target create "dolphin"
Current executable set to '/usr/bin/dolphin' (x86_64).
(lldb) run
Process 23321 launched: '/usr/bin/dolphin' (x86_64)
Process 23321 stopped
* thread #11, name = 'KIO::WorkerThre', stop reason = signal SIGSEGV: invalid permissions for mapped object (fault address: 0x7fffe05b13a8)
    frame #0: 0x00007fffe0ab4eb9
->  0x7fffe0ab4eb9: orq    $0x0, (%rsp)
    0x7fffe0ab4ebe: cmpq   %r11, %rsp
    0x7fffe0ab4ec1: jne    0x7fffe0ab4eb2
    0x7fffe0ab4ec3: subq   $0x2c8, %rsp              ; imm = 0x2C8 
(lldb) f 0
frame #0: 0x00007fffe0ab4eb9
->  0x7fffe0ab4eb9: orq    $0x0, (%rsp)
    0x7fffe0ab4ebe: cmpq   %r11, %rsp
    0x7fffe0ab4ec1: jne    0x7fffe0ab4eb2
    0x7fffe0ab4ec3: subq   $0x2c8, %rsp              ; imm = 0x2C8 
(lldb) reg read $sp
     rsp = 0x00007fffe05b13a8
(lldb) f 7
error: Frame index (7) out of range.
(lldb) f 1
frame #1: 0x00007fffe05d2520
->  0x7fffe05d2520: movabsb -0x4fffffaaaaa9c8c5, %al
    0x7fffe05d2529: cmpl   (%rdi), %esi
    0x7fffe05d252b: pushq  %rsi
    0x7fffe05d252c: pushq  %rbp
(lldb) f 2
error: Frame index (2) out of range.
(lldb) f 1
frame #1: 0x00007fffe05d2520
->  0x7fffe05d2520: movabsb -0x4fffffaaaaa9c8c5, %al
    0x7fffe05d2529: cmpl   (%rdi), %esi
    0x7fffe05d252b: pushq  %rsi
    0x7fffe05d252c: pushq  %rbp
(lldb) reg read $sp
     rsp = 0x00007fffe05d23f8

According to Python, 0x00007fffe05d23f8 - 0x00007fffe05b13a8 = 135248, which is indeed greater than 128 kibibytes (131072 bytes).

I have no idea how to use those -Wl,-z,stack-size=0x200000 flags, though. Is that for linking/building? All my KDE stuff (except for kio-admin) was downloaded and installed from the Void repos.

nekopsykose commented 1 month ago

I have no idea how to use those -Wl,-z,stack-size=0x200000, though. Is that for linking/building? All my KDE stuff (except for kio-admin) was downloaded and installed from the Void repos.

yeah, it would have to be in ldflags in the template

Plut0nio commented 1 month ago

I tried building and installing Dolphin with the additional LDFLAGS by doing the following (I adapted these instructions from https://old.reddit.com/r/voidlinux/comments/yziqyr/microsoft_office_fonts_on_libreoffice/ix0hzh2/):

However, I still get the same issue where copying and pasting a file makes it crash with a segfault. I'm pretty sure it installed the locally-built Dolphin package instead of the one from the official repo. Here's the output of xi dolphin:

[*] Updating repository `https://repo-default.voidlinux.org/current/musl/x86_64-musl-repodata' ...
x86_64-musl-repodata: 1878KB [avg rate: 4080KB/s]
[*] Updating repository `https://repo-default.voidlinux.org/current/musl/nonfree/x86_64-musl-repodata' ...
[*] Updating repository `https://repo-default.voidlinux.org/current/musl/debug/x86_64-musl-repodata' ...
x86_64-musl-repodata: 874KB [avg rate: 27GB/s]

Name    Action    Version           New version            Download size
dolphin install   -                 24.05.1_2              - 

Size required on disk:          14MB
Space available on disk:       444GB

Do you want to continue? [Y/n] y

[*] Verifying package integrity
dolphin-24.05.1_2: verifying SHA256 hash...

[*] Collecting package files
dolphin-24.05.1_2: collecting files...

[*] Unpacking packages
dolphin-24.05.1_2: unpacking ...

[*] Configuring unpacked packages
dolphin-24.05.1_2: configuring ...
Updating GTK+ icon cache for /usr/share/icons/hicolor...
Updating MIME database...
dolphin-24.05.1_2: installed successfully.

0 downloaded, 1 installed, 0 updated, 1 configured, 0 removed.

Maybe there's something obvious that I'm missing here? I'm still more or less a Linux noob.

nekopsykose commented 1 month ago

Add -Wl,-z,stack-size=0x200000 to the LDFLAGS line (LDFLAGS=" -Wl,-rpath-link,../bin,-Wl,-z,stack-size=0x200000")

this syntax looks incorrect (-Wl, starts a list of args to the linker, and -Wl is repeated inside the list, so you would want to drop the second one, i.e. -Wl,-rpath-link,../bin,-z,stack-size=0x200000)

Plut0nio commented 1 month ago

Just built and installed Dolphin with the fixed flags. I still get a segfault, however. Maybe xi dolphin is installing a cached, previously-downloaded or previously-built version of the package? Idk what's going on here.

nekopsykose commented 1 month ago

i dunno how that works, maybe you have to increment the revision= field

Plut0nio commented 1 month ago

I rebuilt and reinstalled with revision= incremented to 3 in the template. I still get a segfault when copying and pasting and I still get the same value 135248 when subtracting the addresses found using the lldb backtrace. I guess I'll just stick to using PCManFM-Qt for now.

nekopsykose commented 1 month ago

that means that for some reason the gnu_stack header is missing (or rather, is not set to a nonzero value), it would look like:

$ readelf --program-headers /usr/bin/dolphin

Elf file type is DYN (Position-Independent Executable file)
Entry point 0x67370
There are 11 program headers, starting at offset 64

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  PHDR           0x0000000000000040 0x0000000000000040 0x0000000000000040
                 0x0000000000000268 0x0000000000000268  R      0x8
  INTERP         0x00000000000002a8 0x00000000000002a8 0x00000000000002a8
                 0x0000000000000019 0x0000000000000019  R      0x1
      [Requesting program interpreter: /lib/ld-musl-x86_64.so.1]
  LOAD           0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x000000000006636c 0x000000000006636c  R      0x1000
  LOAD           0x0000000000066370 0x0000000000067370 0x0000000000067370
                 0x000000000008df30 0x000000000008df30  R E    0x1000
  LOAD           0x00000000000f42a0 0x00000000000f62a0 0x00000000000f62a0
                 0x000000000000cdb0 0x000000000000dd60  RW     0x1000
  LOAD           0x0000000000101050 0x0000000000104050 0x0000000000104050
                 0x0000000000002408 0x000000000000268a  RW     0x1000
  DYNAMIC        0x00000000000fdbe8 0x00000000000ffbe8 0x00000000000ffbe8
                 0x0000000000000430 0x0000000000000430  RW     0x8
  GNU_RELRO      0x00000000000f42a0 0x00000000000f62a0 0x00000000000f62a0
                 0x000000000000cdb0 0x000000000000dd60  R      0x1
  GNU_EH_FRAME   0x000000000004fea0 0x000000000004fea0 0x000000000004fea0
                 0x0000000000003ac4 0x0000000000003ac4  R      0x4
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000200000  RW     0x0

note the GNU_STACK with a memsiz of 0x200000. if it's there then that would mean the musl in void doesn't read it for some reason, but the version here is new enough to support that so i dunno

Plut0nio commented 1 month ago

Here's my output of readelf --program-headers /usr/bin/dolphin:

Elf file type is DYN (Position-Independent Executable file)
Entry point 0x572b7
There are 13 program headers, starting at offset 64

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  PHDR           0x0000000000000040 0x0000000000000040 0x0000000000000040
                 0x00000000000002d8 0x00000000000002d8  R      0x8
  INTERP         0x0000000000000318 0x0000000000000318 0x0000000000000318
                 0x0000000000000019 0x0000000000000019  R      0x1
      [Requesting program interpreter: /lib/ld-musl-x86_64.so.1]
  LOAD           0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x000000000004eca8 0x000000000004eca8  R      0x1000
  LOAD           0x000000000004f000 0x000000000004f000 0x000000000004f000
                 0x00000000000a78f5 0x00000000000a78f5  R E    0x1000
  LOAD           0x00000000000f7000 0x00000000000f7000 0x00000000000f7000
                 0x0000000000033450 0x0000000000033450  R      0x1000
  LOAD           0x000000000012a680 0x000000000012b680 0x000000000012b680
                 0x00000000000116a0 0x0000000000011aa8  RW     0x1000
  DYNAMIC        0x00000000001354e0 0x00000000001364e0 0x00000000001364e0
                 0x0000000000000480 0x0000000000000480  RW     0x8
  NOTE           0x0000000000000338 0x0000000000000338 0x0000000000000338
                 0x0000000000000030 0x0000000000000030  R      0x8
  NOTE           0x0000000000000368 0x0000000000000368 0x0000000000000368
                 0x0000000000000024 0x0000000000000024  R      0x4
  GNU_PROPERTY   0x0000000000000338 0x0000000000000338 0x0000000000000338
                 0x0000000000000030 0x0000000000000030  R      0x8
  GNU_EH_FRAME   0x000000000010c578 0x000000000010c578 0x000000000010c578
                 0x0000000000004504 0x0000000000004504  R      0x4
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  RW     0x10
  GNU_RELRO      0x000000000012a680 0x000000000012b680 0x000000000012b680
                 0x000000000000e980 0x000000000000e980  R      0x1

 Section to Segment mapping:
  Segment Sections...
   00     
   01     .interp 
   02     .interp .note.gnu.property .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt 
   03     .init .plt .plt.got .text .fini 
   04     .rodata .eh_frame_hdr .eh_frame 
   05     .init_array .fini_array .data.rel.ro .dynamic .got .data .qtversion .bss 
   06     .dynamic 
   07     .note.gnu.property 
   08     .note.gnu.build-id 
   09     .note.gnu.property 
   10     .eh_frame_hdr 
   11     
   12     .init_array .fini_array .data.rel.ro .dynamic .got 

For some reason, my GNU_STACK memsize is 0x0000000000000000. Are my linker flags being overridden by something?

nekopsykose commented 1 month ago

reading the dolphin template (i didn't read it before), you say you edited the LDFLAGS line, but that line is behind if [ "$CROSS_BUILD" ];

instead put it in

if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
    LDFLAGS="$LDFLAGS -Wl,-z,stack-size=0x200000"
    makedepends+=" musl-fts-devel"
fi

or something like that

Plut0nio commented 1 month ago

^That finally fixed it. I can now copy and paste files in Dolphin (at least when running as non-admin). Thanks!

hervyqa commented 1 month ago

Your link to other bug reports is meaningless, your back trace is useless.

yes. my back trace is useless. @sgn