xdg-desktop-portal crashed with SIGSEGV

Bug #1691649 reported by none on 2017-05-18
This bug affects 19 people
Affects Status Importance Assigned to Milestone
xdg-desktop-portal (Ubuntu)
James Henstridge
James Henstridge

Bug Description

Test Case:
1. Boot desktop image to the live session and wait.


ProblemType: Crash
DistroRelease: Ubuntu 17.10
Package: xdg-desktop-portal 0.6-1
ProcVersionSignature: Ubuntu 4.10.0-21.23-generic 4.10.11
Uname: Linux 4.10.0-21-generic x86_64
ApportVersion: 2.20.5-0ubuntu3
Architecture: amd64
CrashCounter: 1
Date: Wed May 17 13:02:30 2017
ExecutablePath: /usr/lib/xdg-desktop-portal/xdg-desktop-portal
InstallationDate: Installed on 2017-04-11 (37 days ago)
InstallationMedia: Ubuntu 16.10 "Yakkety Yak" - Release amd64 (20161012.2)
ProcCmdline: /usr/lib/xdg-desktop-portal/xdg-desktop-portal
 PATH=(custom, no user)
 Segfault happened at: 0x5593a88781c8: mov 0x8(%rax),%rcx
 PC (0x5593a88781c8) ok
 source "0x8(%rax)" (0x00000008) not located in a known VMA region (needed readable region)!
 destination "%rcx" ok
SegvReason: reading NULL VMA
Signal: 11
SourcePackage: xdg-desktop-portal
 () at /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
 () at /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
 () at /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
Title: xdg-desktop-portal crashed with SIGSEGV
UpgradeStatus: Upgraded to artful on 2017-05-17 (1 days ago)

none (misakurarin) wrote :

 export_portal_implementation (connection=0x5593a9126000, skeleton=0x0) at src/xdg-desktop-portal.c:316
 on_bus_acquired (connection=0x5593a9126000, name=<optimized out>, user_data=<optimized out>) at src/xdg-desktop-portal.c:340
 connection_get_cb (source_object=<optimized out>, res=0x5593a9132910, user_data=0x5593a9130d70) at ../../../../gio/gdbusnameowning.c:480
 g_task_return_now (task=0x5593a9132910) at ../../../../gio/gtask.c:1145
 g_task_return (task=0x5593a9132910, type=<optimized out>) at ../../../../gio/gtask.c:1203

Changed in xdg-desktop-portal (Ubuntu):
importance: Undecided → Medium
tags: removed: need-amd64-retrace
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in xdg-desktop-portal (Ubuntu):
status: New → Confirmed
tags: added: bugpattern-needed
tags: added: bionic
information type: Private → Public
Changed in xdg-desktop-portal (Ubuntu):
importance: Medium → High
description: updated
Will Cooke (willcooke) on 2018-10-09
Changed in xdg-desktop-portal (Ubuntu):
assignee: nobody → James Henstridge (jamesh)
James Henstridge (jamesh) wrote :

So judging by the logs in some of the related error reports, we get the following log messages:

   xdg-desktop-por[3113]: Failed to create file chooser proxy: Error calling StartServiceByName for org.freedesktop.impl.portal.desktop.gtk: Timeout was reached
   xdg-desktop-por[3113]: g_dbus_interface_skeleton_set_flags: assertion 'G_IS_DBUS_INTERFACE_SKELETON (interface_)' failed
   xdg-desktop-por[3113]: invalid (NULL) pointer instance
   xdg-desktop-por[3113]: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
   xdg-desktop-por[3113]: g_dbus_interface_skeleton_export: assertion 'G_IS_DBUS_INTERFACE_SKELETON (interface_)' failed

This centres around the following code, which is the first portal whose export depends on the presence of a UI implementation:


  implementation = find_portal_implementation ("org.freedesktop.impl.portal.FileChooser");
  if (implementation != NULL)
    export_portal_implementation (connection,
        file_chooser_create (connection, implementation->dbus_name));

The first line looks up a backend implementation of the FileChooser portal based on the implementations registered in /usr/share/xdg-desktop-portal/portals, and picks xdg-desktop-portal-gtk.

The file_chooser_create method then tries to activate the selected D-Bus name:


This corresponds to the first log message, and indicates that starting xdg-desktop-portal-gtk timed out. It returns NULL, and export_portal_implementation() contains no checks for NULL as a second argument leading to the other messages. It ends with a g_return_val_if_fail() check causing g_dbus_interface_skeleton_export() to return FALSE without setting an error. We then get a segfault trying to dereference a NULL GError pointer.

So there's two issues to address:

 1. xdg-desktop-portal-gtk startup is timing out in some instances.
 2. xdg-desktop-portal is not handling this timeout error correctly.

I'll look at addressing (2) since it is the immediate cause of the crash reports, but portals are of limited use if they can't rely on any of the GUI helpers for things like file choosers.

James Henstridge (jamesh) wrote :

I've submitted a patch upstream here:


I'll give them a chance to respond and then look at putting together an update to our package.

Ubuntu QA Website (ubuntuqa) wrote :

This bug has been reported on the Ubuntu ISO testing tracker.

A list of all reports related to this bug can be found here:

tags: added: iso-testing
James Henstridge (jamesh) wrote :

The patch was accepted upstream as is, so we can backport it:


While chatting on IRC, Alex suggested the following set of crash fixes for the xdg-document-portal from 1.0.3 that we may want to consider including:


I'm not sure whether it is worth trying to include them or wait to SRU a later xdg-document-portal post release.

Changed in xdg-desktop-portal (Ubuntu Cosmic):
status: Confirmed → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package xdg-desktop-portal - 1.0.2-1ubuntu1

xdg-desktop-portal (1.0.2-1ubuntu1) cosmic; urgency=medium

  * debian/patches/git_timeout_segfault.patch:
    - backport fix from James Henstridge to not segfault when the frontend
      hits a timeout, which seems common on the live session (lp: #1691649)

 -- Sebastien Bacher <email address hidden> Fri, 12 Oct 2018 15:10:27 +0200

Changed in xdg-desktop-portal (Ubuntu Cosmic):
status: Fix Committed → Fix Released
To post a comment you must log in.