mission-control-5 crashed with SIGABRT in __libc_message()

Bug #1143463 reported by Pavan Kiran Pulapalli
44
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Telepathy Mission Control 5
Fix Released
Medium
telepathy-mission-control-5 (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

crash

ProblemType: Crash
DistroRelease: Ubuntu 13.04
Package: telepathy-mission-control-5 1:5.14.0-0ubuntu1
ProcVersionSignature: Ubuntu 3.8.0-9.18-generic 3.8.1
Uname: Linux 3.8.0-9-generic i686
ApportVersion: 2.8-0ubuntu4
Architecture: i386
Date: Sun Mar 3 13:23:08 2013
ExecutablePath: /usr/lib/telepathy/mission-control-5
InstallationDate: Installed on 2012-04-17 (320 days ago)
InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Release i386 (20111012)
MarkForUpload: True
ProcCmdline: BOOT_IMAGE=/boot/vmlinuz-3.8.0-9-generic root=UUID=98089200-ea70-444a-a0d7-d13d5821abe9 ro quiet splash vt.handoff=7
ProcEnviron:
 SHELL=/bin/false
 XDG_RUNTIME_DIR=<set>
 PATH=(custom, no user)
 LANGUAGE=en_IN:en
 LANG=en_IN
Signal: 6
SourcePackage: telepathy-mission-control-5
StacktraceTop:
 raise () from /lib/i386-linux-gnu/libc.so.6
 abort () from /lib/i386-linux-gnu/libc.so.6
 ?? () from /lib/i386-linux-gnu/libc.so.6
 ?? () from /lib/i386-linux-gnu/libc.so.6
 ?? () from /lib/i386-linux-gnu/libc.so.6
Title: mission-control-5 crashed with SIGABRT in raise()
UpgradeStatus: Upgraded to raring on 2012-08-19 (196 days ago)
UserGroups:

Revision history for this message
Pavan Kiran Pulapalli (pavanpulapalli) wrote :
Revision history for this message
Apport retracing service (apport) wrote :

StacktraceTop:
 __libc_message (do_abort=do_abort@entry=2, fmt=fmt@entry=0xb7087530 "*** Error in `%s': %s: 0x%s ***\n") at ../sysdeps/unix/sysv/linux/libc_fatal.c:199
 malloc_printerr (action=<optimized out>, str=<optimized out>, ptr=0x93b35b8) at malloc.c:4902
 _int_free (av=0xb70c8440 <main_arena>, p=0x93b35b0, have_lock=0) at malloc.c:3758
 standard_free (mem=0x93b35b8) at /build/buildd/glib2.0-2.35.8/./glib/gmem.c:98
 g_free (mem=mem@entry=0x93b35b8) at /build/buildd/glib2.0-2.35.8/./glib/gmem.c:252

Revision history for this message
Apport retracing service (apport) wrote : Stacktrace.txt
Revision history for this message
Apport retracing service (apport) wrote : StacktraceSource.txt
Revision history for this message
Apport retracing service (apport) wrote : ThreadStacktrace.txt
Changed in telepathy-mission-control-5 (Ubuntu):
importance: Undecided → Medium
summary: - mission-control-5 crashed with SIGABRT in raise()
+ mission-control-5 crashed with SIGABRT in __libc_message()
tags: removed: need-i386-retrace
tags: added: saucy
Revision history for this message
Launchpad Janitor (janitor) wrote :

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

Changed in telepathy-mission-control-5 (Ubuntu):
status: New → Confirmed
Revision history for this message
In , Sebastien Bacher (seb128) wrote :

Created attachment 89967
reset the error to NULL, so the next call is working

That bug exists in 5.16 but doesn't apply to trunk due to some refactoring

Way to trigger it:
- create a user/.local/share/telepathy where the user has no write rights
- try running mission-control
- see the warnings and segfault

Stacktrace
#0 0xb77d1424 in __kernel_vsyscall ()
#1 0xb7039aff in __GI_raise (sig=sig@entry=6)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#2 0xb703d083 in __GI_abort () at abort.c:90
#3 0xb7076a95 in __libc_message (do_abort=do_abort@entry=2,
    fmt=fmt@entry=0xb717a0d0 "*** Error in `%s': %s: 0x%s ***\n")
    at ../sysdeps/unix/sysv/linux/libc_fatal.c:199
#4 0xb70817c2 in malloc_printerr (action=<optimized out>,
    str=<optimized out>, ptr=0x863b728) at malloc.c:4923
#5 0xb7082510 in _int_free (av=0xb71bb440 <main_arena>, p=0x863b720,
    have_lock=0) at malloc.c:3779
#6 0xb72265d0 in g_free (mem=mem@entry=0x863b728)
    at /build/buildd/glib2.0-2.38.1/./glib/gmem.c:197
#7 0x08085bdd in _commit (self=self@entry=0x85da000, am=am@entry=0x8638a78,
    account=account@entry=0x0) at mcd-account-manager-default.c:259
#8 0x08085ec0 in _list (self=0x85da000, am=0x8638a78)
    at mcd-account-manager-default.c:364
#9 0xb7797442 in mcp_account_storage_list (storage=storage@entry=0x85da000,
    am=am@entry=0x8638a78) at account-storage.c:952
#10 0x0808376e in mcd_storage_load (self=0x8638a78) at mcd-storage.c:740
#11 0x08070937 in _mcd_account_manager_constructed (obj=0x85d8680)
    at mcd-account-manager.c:1682

The code does g_error_free() an error to reuse it, but without resetting it to NULL, which makes the next call not set a new one and the g_warning hit an invalid read.

Revision history for this message
In , Xavier Claessens (zdra) wrote :

You should use g_clear_error() instead. I'm actually tempted to do a big s/g_error_free/g_clear_error/ and ban g_error_free() in our coding style checker, like we already banned some _free() in favor of their corresponding _unref().

Revision history for this message
In , Simon McVittie (smcv) wrote :

(In reply to comment #1)
> You should use g_clear_error() instead

I agree...

> I'm actually tempted to do a big s/g_error_free/g_clear_error/

... but I think this is going too far - it's often obvious that the error is both non-NULL and no longer used, for instance in this idiom for dealing with errors that there's no way to signal (yes that's a design flaw, but often one that we're stuck with medium-term):

static void
foo (void)
{
  GError *error = NULL;

  if (do_a_thing (&error))
    {
      WARNING ("%s", error->message);
      g_error_free (error);
    }
}

or when interacting with dbus-glib:

static void
do_something_on_dbus (DBusGMethodInvocation *context)
{
  GError *error = NULL;

  if (do_something (&error))
    {
      dbus_g_method_return (context);
    }
  else
    {
      dbus_g_method_return_error (context, error);
      g_error_free (error);
    }
}

Revision history for this message
In , Sebastien Bacher (seb128) wrote :

Created attachment 90260
new version using g_clear_error

ok, updated to use g_clear_error, I've only done that specific change and not tried to replace other uses

Revision history for this message
In , Simon McVittie (smcv) wrote :

Comment on attachment 90260
new version using g_clear_error

Review of attachment 90260:
-----------------------------------------------------------------

Looks good to me.

information type: Private → Public
Revision history for this message
In , Simon McVittie (smcv) wrote :

Comment on attachment 90260
new version using g_clear_error

Review of attachment 90260:
-----------------------------------------------------------------

Actually, I take that back. This is g_clear_error (error), it needs to be g_clear_error (&error). Did you test this?

Revision history for this message
In , Simon McVittie (smcv) wrote :

Fixed in git for 5.16.1; I added the necessary "&" to make it work.

Changed in mission-control-5:
importance: Unknown → Medium
status: Unknown → Fix Released
Revision history for this message
In , Sebastien Bacher (seb128) wrote :

ups, sorry about that, I test built but didn't test run in the buggy condition ... thanks for catching the error!

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package telepathy-mission-control-5 - 1:5.16.0-1ubuntu4

---------------
telepathy-mission-control-5 (1:5.16.0-1ubuntu4) trusty; urgency=low

  * debian/apparmor-profile:
    - give access to the telepathy-glib avatars cache,
      thanks Jamie Strandboge (lp: #1257816)
  * debian/patches/git_correct_error_handling.patch:
    - don't hit an invalid free if the config directory is not writable
      (lp: #1143463)
 -- Sebastien Bacher <email address hidden> Wed, 04 Dec 2013 18:22:16 +0100

Changed in telepathy-mission-control-5 (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.