Comment 16 for bug 128624

Revision history for this message
In , Mark Seaborn (mseaborn-cmedresearch) wrote :

I hit this problem in the version of dbus in Ubuntu hardy (1.1.20-1ubuntu3.2). I can reproduce it using valgrind or electric-fence.

With valgrind (note that the version in hardy doesn't work; I used the version from Ubuntu jaunty):
$ valgrind dbus-1.1.20/bus/dbus-daemon --session --print-address=10 10>/tmp/dbus-address
(and in another terminal:)
$ DBUS_SESSION_BUS_ADDRESS=$(cat /tmp/dbus-address) python -c "import dbus; dbus.SessionBus()"

valgrind produces the following warning twice:
==9193== Invalid read of size 1
==9193== at 0x56A09EE: strcmp (mc_replace_strmem.c:337)
==9193== by 0x135BCC: find_generic_function (dbus-hash.c:918)
==9193== by 0x1357FE: _dbus_hash_table_insert_string_preallocated (dbus-hash.c:1680)
==9193== by 0x135AD1: _dbus_hash_table_insert_string (dbus-hash.c:1443)
==9193== by 0x13E6ED: _dbus_user_database_lookup (dbus-userdb.c:208)
==9193== by 0x13E822: _dbus_user_database_get_username (dbus-userdb.c:659)
==9193== by 0x13EB2F: _dbus_credentials_add_from_user (dbus-userdb.c:505)
==9193== by 0x145570: handle_server_data_external_mech (dbus-auth.c:1066)
==9193== by 0x14454C: process_data (dbus-auth.c:1607)
==9193== by 0x1447AA: handle_server_state_waiting_for_auth (dbus-auth.c:1659)
==9193== by 0x143BF4: _dbus_auth_do_work (dbus-auth.c:2101)
==9193== by 0x132B45: _dbus_transport_get_is_authenticated (dbus-transport.c:687)
==9193== Address 0x77e6030 is 0 bytes inside a block of size 9 free'd
==9193== at 0x569EDFA: free (vg_replace_malloc.c:323)
==9193== by 0x138360: dbus_free (dbus-memory.c:644)
==9193== by 0x13E31F: _dbus_user_info_free (dbus-userdb.c:78)
==9193== by 0x13E3A5: _dbus_user_info_free_allocated (dbus-userdb.c:49)
==9193== by 0x1357AF: _dbus_hash_table_insert_ulong (dbus-hash.c:1610)
==9193== by 0x13E6CC: _dbus_user_database_lookup (dbus-userdb.c:201)
==9193== by 0x13E822: _dbus_user_database_get_username (dbus-userdb.c:659)
==9193== by 0x13EB2F: _dbus_credentials_add_from_user (dbus-userdb.c:505)
==9193== by 0x145570: handle_server_data_external_mech (dbus-auth.c:1066)
==9193== by 0x14454C: process_data (dbus-auth.c:1607)
==9193== by 0x1447AA: handle_server_state_waiting_for_auth (dbus-auth.c:1659)
==9193== by 0x143BF4: _dbus_auth_do_work (dbus-auth.c:2101)

With gdb:
$ gdb --args dbus-1.1.20/bus/dbus-daemon --session --print-address=12 12>/tmp/dbus-address
(gdb) set environment LD_PRELOAD /usr/lib/libefence.so.0.0
(gdb) run
(and in another terminal:)
$ DBUS_SESSION_BUS_ADDRESS=$(cat /tmp/dbus-address) python -c "import dbus; dbus.SessionBus()"

To fix, apply the patch in Bug 15588 and use --enable-userdb-cache.