After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 635694 - gdbus aborting due to unauthorized socket in DBUS_SESSION_BUS_ADDRESS
gdbus aborting due to unauthorized socket in DBUS_SESSION_BUS_ADDRESS
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gdbus
2.27.x
Other Linux
: Normal normal
: ---
Assigned To: David Zeuthen (not reading bugmail)
gtkdev
Depends on:
Blocks:
 
 
Reported: 2010-11-24 13:49 UTC by Guido Berhoerster
Modified: 2011-04-13 19:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
minimal example to trigger the bug (626 bytes, text/plain)
2010-11-24 13:49 UTC, Guido Berhoerster
  Details
gdbusconnection: Avoid tripping assertion if we fail to authenticate twice (1.64 KB, patch)
2011-04-13 18:06 UTC, Colin Walters
committed Details | Review

Description Guido Berhoerster 2010-11-24 13:49:31 UTC
Created attachment 175165 [details]
minimal example to trigger the bug

When DBUS_SESSION_BUS_ADDRESS is set to the valid socket of another user glib will abort due to an assertion failure when more than one connection attempt via gdbus is made. In practice this often happens when users try to execute GTK applications which use GConf through su/sudo without properly clearing the environment. glib should handle invalid environment variables gracefully rather than crashing.
A minimal example which triggers the problem is attached (note that in order to reproduce DBUS_SESSION_BUS_ADDRESS must be set to a valid socket of another user, bogus values will be handled correctly by returning an error)

Backtrace:
Starting program: /home/gber/gdbus-test 
[New Thread 0xb7b3bb70 (LWP 24927)]

Program received signal SIGABRT, Aborted.
0xffffe430 in __kernel_vsyscall ()
  • #0 __kernel_vsyscall
  • #1 raise
    from /lib/libc.so.6
  • #2 abort
    from /lib/libc.so.6
  • #3 g_assertion_message
    at gtestutils.c line 1358
  • #4 g_assertion_message_expr
    at gtestutils.c line 1369
  • #5 initable_init
    at gdbusconnection.c line 2152
  • #6 g_initable_init
    at ginitable.c line 105
  • #7 g_bus_get_sync
    at gdbusconnection.c line 6121
  • #8 try_connect
    at gdbus-test.c line 14
  • #9 main
    at gdbus-test.c line 36

	Inferior 1 [process 24924] will be killed.

Quit anyway? (y or n)
Comment 1 pistazienfresser 2011-03-16 21:43:25 UTC
See also on for openSUSE on Novell's bugzilla:

Bug 655751 - gdbus aborting due to unauthorized socket in DBUS_SESSION_BUS_ADDRESS
https://bugzilla.novell.com/show_bug.cgi?id=655751
with the duplicates:
Bug 648558 - yast sw module crashes from root console
https://bugzilla.novell.com/show_bug.cgi?id=648558
and
Bug 672793 - GLib-GIO:ERROR:gdbusconnection.c:2279:initable_init: assertion failed: (connection->initialization_error == NULL)
https://bugzilla.novell.com/show_bug.cgi?id=672793
and
Bug 671355 - OpenSuse 11.4 RC1 - zypper dup - GLib-GIO:ERROR:gdbusconnection.c:2279:initable_init: assertion failed:
https://bugzilla.novell.com/show_bug.cgi?id=671355
and
Bug 671996 - Zypper display the GIO:ERROR warning
https://bugzilla.novell.com/show_bug.cgi?id=671996
and
Bug 677911 - It is not possible to start yast2 from the command line
https://bugzilla.novell.com/show_bug.cgi?id=677911

Compare also on the openSUSE forums:
Thread: After zypper dup to 11.4 , most of the (graphical) YaST modules do not start via YaST
http://forums.opensuse.org/english/get-technical-help-here/pre-release-beta/455279-after-zypper-dup-11-4-most-graphical-yast-modules-do-not-start-via-yast.html

Regards
Martin
(pistazienfresser)
Comment 2 David Zeuthen (not reading bugmail) 2011-03-25 22:13:02 UTC
(repasting comments lost in outage)

--- Comment #2 from Colin Walters <walters@verbum.org> 2011-03-24 14:58:43 UTC ---
David, did you fix this one?  I thought I saw it go by, but I'm not seeing a
commit for it.

--- Comment #3 from David Zeuthen <zeuthen@gmail.com> 2011-03-24 15:40:06 UTC ---
(In reply to comment #2)
> David, did you fix this one?  I thought I saw it go by, but I'm not seeing a
> commit for it.

No, haven't fixed it yet. I agree it would be nice to have a bug-fix (and
test-case as well) for this... I'll look at it soon.
Comment 3 Colin Walters 2011-04-13 18:06:07 UTC
Created attachment 185897 [details] [review]
gdbusconnection: Avoid tripping assertion if we fail to authenticate twice

If g_bus_get_sync() fails in authentication (because e.g. the process
uid, doesn't match the expected in EXTERNAL), a secondary call to
g_bus_get_sync() would notice we aren't initialized, and try
to initialize.

The assertion here is just wrong; we now explicitly and clearly handle
both cases where we already have an error, or we already succeeded.
Comment 4 Colin Walters 2011-04-13 18:07:05 UTC
(In reply to comment #2)
>
> No, haven't fixed it yet. I agree it would be nice to have a bug-fix (and
> test-case as well)

A test case turns out to be a pain to write because we need to simulate an authentication error; I just punted on this.  The new code is pretty clearly right IMO.
Comment 5 Matthias Clasen 2011-04-13 18:52:48 UTC
Patch looks right to me (was looking at this very same bug yesterday...)
Comment 6 Colin Walters 2011-04-13 19:01:50 UTC
Attachment 185897 [details] pushed as 68b16de - gdbusconnection: Avoid tripping assertion if we fail to authenticate twice
Comment 7 David Zeuthen (not reading bugmail) 2011-04-13 19:40:06 UTC
Looks good to me. Thanks for fixing this. Agree we can punt on the test case for now...