Segfault when accessing an Android device right after clicking "accept" on the Android device
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 1.6k
- Forks
- 368
- Avg merge
- 4d 4h
- Merged PRs (30d)
- 2
Description
Distribution
Debian unstable
Package version
6.2.8-1
Frequency
Always
Bug description
Hey.
(I think none of the other segfault issues already reported are the same one than this.)
This is a long standing bug (since years):
Steps to reproduce
- I connect an Android device (it happens with all that I have, which use many different versions of Android) via USB
usbguardasks me the first time whether I want to allow the device to be accessed (which I accept).- I click on the tree-view item for the Android device in
nemo. - Then the Android device itself displays the pop up where it asks me whether I want to allow or reject the connection.
- Right when I accept that,
nemosegfaults like so in the kernel log:Oct 30 16:30:28 heisenberg kernel: nemo[729399]: segfault at 18 ip 00005652b336bdd4 sp 00007ffcb89f9f28 error 4 in nemo[e7dd4,5652b32b5000+106000] likely on CPU 12 (core 20, socket 0) Oct 30 16:30:28 heisenberg kernel: Code: f6 e8 40 b6 f4 ff 48 89 df 5b e9 cf 12 f5 ff 0f 1f 80 00 00 00 00 c3 0f 1f 80 00 00 00 00 5b c3 66 0f 1f 44 00 00 f3 0f 1e fa <48> 8b 47 18 48 8b 10 48 8b 52 18 48 8b 3a 48 85 ff 74 09 48 8b 70 - Along with that, the first USB device, which I've accepted with
usbguardabove is removed from the kernel and a new one appears, for whichusbguardasks me again, whether I want to accept it (to the kernel) or not. I accept it. - If I then start a new
nemo, I can click the Android device in that, and from then on it works (for that device and until I disconnect it).
Expected behavior
Don't crash the first time ;-)
Additional information
With debug symbols installed, I'd get the following backtrace right after the SIGSEV:
$ gdb nemo
GNU gdb (Debian 15.1-1) 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-linux-gnu".
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 nemo...
Reading symbols from /usr/lib/debug/.build-id/84/207c4babdfd219ac42df26ef030bc3007785a1.debug...
(gdb) run
Starting program: /usr/bin/nemo
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff32006c0 (LWP 729919)]
[New Thread 0x7ffff28006c0 (LWP 729920)]
[New Thread 0x7ffff1e006c0 (LWP 729921)]
(nemo:729916): Gtk-WARNING **: 16:33:13.510: Failed to register client: GDBus.Error:org.gnome.SessionManager.AlreadyRegistered: Unable to register client
[New Thread 0x7ffff14006c0 (LWP 729922)]
[New Thread 0x7ffff0a006c0 (LWP 729923)]
(nemo:729916): Nemo-WARNING **: 16:33:13.525: Current gtk theme is not known to have nemo support (Adwaita) - checking...
(nemo:729916): Nemo-WARNING **: 16:33:13.550: The theme appears to have no nemo support. Adding some...
[New Thread 0x7fffeaa006c0 (LWP 729925)]
[New Thread 0x7fffe96006c0 (LWP 729926)]
[New Thread 0x7fffe8c006c0 (LWP 729927)]
[New Thread 0x7fffdf6006c0 (LWP 729928)]
[Thread 0x7fffe96006c0 (LWP 729926) exited]
[Thread 0x7ffff0a006c0 (LWP 729923) exited]
[Thread 0x7fffdf6006c0 (LWP 729928) exited]
[Thread 0x7fffe8c006c0 (LWP 729927) exited]
[New Thread 0x7fffe8c006c0 (LWP 729949)]
[New Thread 0x7fffdf6006c0 (LWP 729961)]
[Thread 0x7fffe8c006c0 (LWP 729949) exited]
Thread 1 "nemo" received signal SIGSEGV, Segmentation fault.
nemo_file_is_desktop_directory (file=file@entry=0x0) at ../libnemo-private/nemo-file.c:1482
warning: 1482 ../libnemo-private/nemo-file.c: No such file or directory
(gdb) bt
#0 nemo_file_is_desktop_directory (file=file@entry=0x0) at ../libnemo-private/nemo-file.c:1482
#1 0x00005555555fcb6c in viewed_file_changed_callback (file=0x555555837f80, slot=0x555555b1fdc0) at ../src/nemo-window-manage-views.c:289
#2 0x00007ffff71cd9c0 in g_closure_invoke () from /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#3 0x00007ffff71e1d83 in ?? () from /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#4 0x00007ffff71e37a9 in ?? () from /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#5 0x00007ffff71e9666 in g_signal_emit_valist () from /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#6 0x00007ffff71e9723 in g_signal_emit () from /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#7 0x0000555555645077 in nemo_file_emit_changed (file=0x555555837f80) at ../libnemo-private/nemo-file.c:7953
#8 0x0000555555622708 in nemo_directory_emit_change_signals (directory=0x5555561a73a0, changed_files=0x555555c06b70) at ../libnemo-private/nemo-directory.c:776
#9 0x0000555555622a19 in call_files_changed_common (directory=<optimized out>, file_list=<optimized out>) at ../libnemo-private/nemo-directory.c:870
#10 call_files_changed_unref_free_list (key=0x5555561a73a0, value=0x555555c06b70, user_data=<optimized out>) at ../libnemo-private/nemo-directory.c:889
#11 0x00007ffff70b1cd3 in g_hash_table_foreach () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#12 0x0000555555622f09 in nemo_directory_notify_files_removed (files=<optimized out>) at ../libnemo-private/nemo-directory.c:1158
#13 0x000055555567548d in nemo_file_changes_consume_changes (consume_all=consume_all@entry=1) at ../libnemo-private/nemo-file-changes-queue.c:314
#14 0x0000555555661c02 in call_consume_changes_idle_cb (not_used=<optimized out>) at ../libnemo-private/nemo-monitor.c:69
#15 0x00007ffff70c37df in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#16 0x00007ffff70c5a17 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#17 0x00007ffff70c6180 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#18 0x00007ffff7303445 in g_application_run () from /lib/x86_64-linux-gnu/libgio-2.0.so.0
#19 0x000055555558d186 in main (argc=1, argv=0x7fffffffdf88) at ../src/nemo-main.c:104
(gdb)
(That's not from the same run, as for which the kernel log message was generated, that I've cited above.)
In terms of kernel log, it looks like that:
Connecting the device:
Oct 30 16:45:59 heisenberg kernel: usb 4-1: new SuperSpeed USB device number 28 using xhci_hcd
Oct 30 16:45:59 heisenberg kernel: usb 4-1: New USB device found, idVendor=04e8, idProduct=6860, bcdDevice= c.00
Oct 30 16:45:59 heisenberg kernel: usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Oct 30 16:45:59 heisenberg kernel: usb 4-1: Product: SAMSUNG_Android
Oct 30 16:45:59 heisenberg kernel: usb 4-1: Manufacturer: SAMSUNG
Oct 30 16:45:59 heisenberg kernel: usb 4-1: SerialNumber: R3CN4013TZY
Oct 30 16:45:59 heisenberg kernel: usb 4-1: Device is not authorized for usage
next I accept it in usbguard:
Oct 30 16:46:21 heisenberg kernel: cdc_acm 4-1:1.1: ttyACM0: USB ACM device
Oct 30 16:46:21 heisenberg kernel: usb 4-1: authorized to connect
next I click on it within `nemo`, Android itself asks me whether I want to accept, which I do, and right after I get:
Oct 30 16:46:30 heisenberg kernel: usb 4-1: USB disconnect, device number 28
Oct 30 16:46:30 heisenberg kernel: nemo[730999]: segfault at 18 ip 00005617ca4dadd4 sp 00007ffee1fa7508 error 4 in nemo[e7dd4,5617ca424000+106000] likely on CPU 15 (core 23, socket 0)
Oct 30 16:46:30 heisenberg kernel: Code: f6 e8 40 b6 f4 ff 48 89 df 5b e9 cf 12 f5 ff 0f 1f 80 00 00 00 00 c3 0f 1f 80 00 00 00 00 5b c3 66 0f 1f 44 00 00 f3 0f 1e fa <48> 8b 47 18 48 8b 10 48 8b 52 18 48 8b 3a 48 85 ff 74 09 48 8b 70
Oct 30 16:46:31 heisenberg kernel: usb 4-1: new SuperSpeed USB device number 29 using xhci_hcd
Oct 30 16:46:31 heisenberg kernel: usb 4-1: New USB device found, idVendor=04e8, idProduct=6860, bcdDevice= c.00
Oct 30 16:46:31 heisenberg kernel: usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Oct 30 16:46:31 heisenberg kernel: usb 4-1: Product: SAMSUNG_Android
Oct 30 16:46:31 heisenberg kernel: usb 4-1: Manufacturer: SAMSUNG
Oct 30 16:46:31 heisenberg kernel: usb 4-1: SerialNumber: R3CN4013TZY
Oct 30 16:46:31 heisenberg kernel: usb 4-1: Device is not authorized for usage
`usbguard` asks me for the "new" device (which I accept):
Oct 30 16:46:35 heisenberg kernel: cdc_acm 4-1:1.1: ttyACM0: USB ACM device
Oct 30 16:46:35 heisenberg kernel: usb 4-1: authorized to connect
here I can now restart `nemo` and actually use the device until I'd disconnect it.
Oct 30 16:46:39 heisenberg kernel: usb 4-1: USB disconnect, device number 29
Thanks,
Chris.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the USB authorization sequence, then inspect viewed_file_changed_callback in src/nemo-window-manage-views.c and nemo_file_is_desktop_directory in libnemo-private/nemo-file.c using the supplied GDB backtrace. Follow the file-removal path through nemo-directory.c, nemo-file-changes-queue.c, and nemo-monitor.c. Done means accepting the Android connection no longer crashes nemo.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, c
- Domain
- desktop, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100