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

segfault when running org.freedesktop.Platform/x86_64/19.08 #433

Closed
mat8913 opened this issue Dec 24, 2019 · 0 comments · Fixed by #434
Closed

segfault when running org.freedesktop.Platform/x86_64/19.08 #433

mat8913 opened this issue Dec 24, 2019 · 0 comments · Fixed by #434

Comments

@mat8913
Copy link
Contributor

mat8913 commented Dec 24, 2019

To reproduce:

  1. Run flatpak run org.freedesktop.Platform/x86_64/19.08 in separate terminal window/tab
  2. In your main terminal, run systemctl --user restart xdg-desktop-portal.service
  3. Get this error
    Dec 24 17:46:42 gallium systemd[1298]: Starting Portal service...
    Dec 24 17:46:42 gallium .xdg-desktop-po[30884]: Failed connect to PipeWire: Couldn't connect PipeWire remote
    Dec 24 17:46:43 gallium systemd[1298]: xdg-desktop-portal.service: Main process exited, code=killed, status=11/SEGV
    Dec 24 17:46:43 gallium systemd[1298]: xdg-desktop-portal.service: Failed with result 'signal'.
    Dec 24 17:46:43 gallium systemd[1298]: Failed to start Portal service.
    Dec 24 17:46:43 gallium systemd-coredump[30892]: Process 30884 (.xdg-desktop-po) of user 1000 dumped core.
    

Here's my gdb transcript:

(gdb) run
Starting program: /nix/store/whnnn9rajnmrpddh0nv5v1zjiv3ha74n-xdg-desktop-portal-1.4.2/libexec/.xdg-desktop-portal-wrapped 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/nix/store/xhpwab5kavygbr1fswawmdyqvmn3wa4i-glibc-2.27/lib/libthread_db.so.1".
[New Thread 0x7fffecd08700 (LWP 28793)]
[New Thread 0x7fffe7fff700 (LWP 28794)]
[New Thread 0x7fffe77fe700 (LWP 28795)]
[New Thread 0x7fffe6ffd700 (LWP 28796)]
[New Thread 0x7fffe66dd700 (LWP 28797)]
[Thread 0x7fffe66dd700 (LWP 28797) exited]

** (/nix/store/whnnn9rajnmrpddh0nv5v1zjiv3ha74n-xdg-desktop-portal-1.4.2/libexec/.xdg-desktop-portal-wrapped:28787): WARNING **: 17:30:26.453: Failed connect to PipeWire: Couldn't connect PipeWire remote
[New Thread 0x7fffe66dd700 (LWP 28798)]

Thread 7 ".xdg-desktop-po" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe66dd700 (LWP 28798)]
0x00007ffff7acbe30 in g_str_hash () from /nix/store/3y35pzzm1fqjxj4gp9pwya9z01d2kdd7-glib-2.62.3/lib/libglib-2.0.so.0
(gdb) backtrace 
#0  0x00007ffff7acbe30 in g_str_hash () from /nix/store/3y35pzzm1fqjxj4gp9pwya9z01d2kdd7-glib-2.62.3/lib/libglib-2.0.so.0
#1  0x00007ffff7acaeef in g_hash_table_lookup () from /nix/store/3y35pzzm1fqjxj4gp9pwya9z01d2kdd7-glib-2.62.3/lib/libglib-2.0.so.0
#2  0x000000000041da66 in get_one_app_state (app_id=app_id@entry=0x0, app_states=app_states@entry=0x5e9e40) at src/background.c:483
#3  0x000000000041e18c in check_background_apps () at src/background.c:720
#4  0x000000000041e3d8 in background_monitor (data=<optimized out>) at src/background.c:803
#5  0x00007ffff7b060fd in g_thread_proxy () from /nix/store/3y35pzzm1fqjxj4gp9pwya9z01d2kdd7-glib-2.62.3/lib/libglib-2.0.so.0
#6  0x00007ffff7a70ef7 in start_thread () from /nix/store/n5xvawbb855dihh8a4l4an06rmz3awb8-glibc-2.27/lib/libpthread.so.0
#7  0x00007ffff79a622f in clone () from /nix/store/n5xvawbb855dihh8a4l4an06rmz3awb8-glibc-2.27/lib/libc.so.6
(gdb) frame 2
#2  0x000000000041da66 in get_one_app_state (app_id=app_id@entry=0x0, app_states=app_states@entry=0x5e9e40) at src/background.c:483
483	  return (AppState)GPOINTER_TO_INT (g_hash_table_lookup (app_states, app_id));
(gdb) print app_states
$1 = (GHashTable *) 0x5e9e40
(gdb) print app_id
$2 = 0x0
(gdb) frame 3
#3  0x000000000041e18c in check_background_apps () at src/background.c:720
720	      idata->state = get_one_app_state (app_id, app_states);
(gdb) print app_id
$3 = 0x0
(gdb) print instance
$4 = (FlatpakInstance *) 0x7fffd0014170
(gdb) print i
$5 = 3
(gdb) print id
$6 = 0x7fffd0019980 "2712149621"
(gdb) print child_pid
$7 = 27962

Process id 27962 corresponds to the bwrap instance for the sandbox spawned in step 1.

mat8913 added a commit to mat8913/xdg-desktop-portal that referenced this issue Dec 24, 2019
`flatpak_instance_get_app` returns NULL for sandboxes that don't have an
application, but `get_one_app_state` expects a non-NULL app_id. This
causes a segfault if a flatpak runtime is being run directly (eg.
"flatpak run org.freedesktop.Platform/x86_64/19.08") during
`check_background_apps`.

Fixes: 0ad363f ("background: Monitor running apps")
Closes: flatpak#433
Signed-off-by: Matthew Harm Bekkema <id@mbekkema.name>
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

Successfully merging a pull request may close this issue.

1 participant