Bug 61616

Summary: empathy-auth-client SIGABRT in tls_certificate_got_all_cb(): cert_data != NULL
Product: Telepathy Reporter: Sebastien Bacher <seb128>
Component: tp-glibAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium CC: guillaume.desmottes
Version: unspecifiedKeywords: patch
Hardware: Other   
OS: All   
Whiteboard: review+
i915 platform: i915 features:

Description Sebastien Bacher 2013-02-28 12:53:44 UTC
the bug has been reported on https://bugs.launchpad.net/ubuntu/+source/empathy/+bug/1064786

Stracktrace on https://launchpadlibrarian.net/119303231/Stacktrace.txt

"#0  0x00007feed9c3b425 in __GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
        resultvar = 0
        pid = <optimized out>
        selftid = 2840
#1  0x00007feed9c3eb8b in __GI_abort () at abort.c:91
        save_stage = 2
        act = {__sigaction_handler = {sa_handler = 0xb00000800, sa_sigaction = 0xb00000800}, sa_mask = {__val = {36721360, 140663832230984, 140663871654352, 140663590041824, 101, 140734715490472, 140663587941569, 4294967295, 125, 125, 38576336, 3100784, 0, 38934064, 38978672, 140663838347264}}, sa_flags = -604313724, sa_restorer = 0x5}
        sigs = {__val = {32, 0 <repeats 15 times>}}
#2  0x00007feeda24ab87 in g_assertion_message (domain=domain@entry=0x7feedb53450b "tp-glib", file=file@entry=0x7feedb571985 "tls-certificate.c", line=line@entry=253, func=func@entry=0x7feedb571f30 "tls_certificate_got_all_cb", message=<optimized out>) at /build/buildd/glib2.0-2.34.0/./glib/gtestutils.c:1877
        lstr = "253\000\377\177\000\000@q\271Z\377\177\000\000\001\000\000\000\000\000\000\000\362\031W\333\356\177\000"
        s = 0x24ca0d0 ""
#3  0x00007feeda24b0a4 in g_assertion_message_expr (domain=domain@entry=0x7feedb53450b "tp-glib", file=file@entry=0x7feedb571985 "tls-certificate.c", line=line@entry=253, func=func@entry=0x7feedb571f30 "tls_certificate_got_all_cb", expr=expr@entry=0x7feedb5719f2 "cert_data != NULL") at /build/buildd/glib2.0-2.34.0/./glib/gtestutils.c:1888
        s = <optimized out>
#4  0x00007feedb5147f6 in tls_certificate_got_all_cb (proxy=proxy@entry=0x23d70d0, properties=<optimized out>, error=error@entry=0x0, user_data=<optimized out>, weak_object=<optimized out>) at tls-certificate.c:253
        cert_data = 0x0
        self = <optimized out>
        state = 0
        i = <optimized out>
        __PRETTY_FUNCTION__ = "tls_certificate_got_all_cb"
#5  0x00007feedb500603 in _tp_cli_dbus_properties_invoke_callback_get_all (weak_object=<optimized out>, user_data=<optimized out>, generic_callback=0x7feedb5145e0 <tls_certificate_got_all_cb>, args=0x2529740, error=0x0, self=0x23d70d0) at _gen/tp-cli-generic-body.h:1210
No locals.
#6  _tp_cli_dbus_properties_invoke_callback_get_all (self=0x23d70d0, error=0x0, args=0x2529740, generic_callback=0x7feedb5145e0 <tls_certificate_got_all_cb>, user_data=<optimized out>, weak_object=<optimized out>) at _gen/tp-cli-generic-body.h:1193
        callback = 0x7feedb5145e0 <tls_certificate_got_all_cb>
#7  0x00007feedb5067d0 in tp_proxy_pending_call_idle_invoke (p=0x250f700) at proxy-methods.c:155
        pc = 0x250f700
        invoke = <optimized out>
        __PRETTY_FUNCTION__ = "tp_proxy_pending_call_idle_invoke"
#8  0x00007feeda228ab5 in g_main_dispatch (context=0x2381970) at /build/buildd/glib2.0-2.34.0/./glib/gmain.c:2715
        dispatch = 0x7feeda225e60 <g_idle_dispatch>
        was_in_call = 0
        user_data = 0x250f700
        callback = 0x7feedb506760 <tp_proxy_pending_call_idle_invoke>
        cb_funcs = 0x7feeda4d69e0
        cb_data = 0x2521630
        current_source_link = {data = 0x252c470, next = 0x0}
        need_destroy = <optimized out>
        source = 0x252c470
        current = 0x23d2d50
        i = <optimized out>
#9  g_main_context_dispatch (context=context@entry=0x2381970) at /build/buildd/glib2.0-2.34.0/./glib/gmain.c:3219
No locals."
Comment 1 Sebastien Bacher 2013-02-28 12:59:47 UTC
The issue has been reported 7969 times since novembre on http://errors.ubuntu.com
Comment 2 Guillaume Desmottes 2013-03-12 09:33:25 UTC
Looks like TpTLSCertificate tries to inspect a Authentication.TLSCertificate object which either doesn't implement the CertificateChainData property or has a bad value for it so tp_asv_get_boxed() fails and return NULL.

AFAIK, Gabble is the only CM implementing TLSCertificate and the property is always implemented so I'm going to assume we are in the second scenario here.

Gabble uses the result of wocky_tls_session_get_peers_certificate() as value for the CertificateChainData, so if this function returns NULL I guess this may fail.

And actually, this function MAY return NULL, if, depending on the backend,:
 - gnutls_certificate_get_peers() returns NULL
 - SSL_get_peer_cert_chain() reutrns NULL

(Ubuntu's Wocky is built with gnutls).

So I think we may have 2 bugs here:
 - Gabble should deal with wocky_tls_session_get_peers_certificate() returning NULL. By invalidating the Certificate channel?
 - tp-glib shouldn't assert in such case and instead invalidate the certificate proxy
Comment 3 Guillaume Desmottes 2013-03-12 10:03:52 UTC
(In reply to comment #2)

> Gabble uses the result of wocky_tls_session_get_peers_certificate() as value
> for the CertificateChainData, so if this function returns NULL I guess this
> may fail.

Looks like dbus-glib crashes if we try to pass NULL as value so thay may not be the reason.
Comment 4 Guillaume Desmottes 2013-03-12 10:15:51 UTC
(In reply to comment #2)

>  - tp-glib shouldn't assert in such case and instead invalidate the
> certificate proxy

Here is a fix for this one
http://cgit.collabora.com/git/user/cassidy/telepathy-glib/log/?h=cert-61616

I would have been happy to wrote a test for it, but didn't find any way to tweak object_props in tp_tests_tls_certificate_class_init() without creating a whole new class. :\
Comment 5 Simon McVittie 2013-06-10 13:57:31 UTC
Sure, let's have this. "Don't be remotely crashable" is among my D-Bus design principles.
Comment 6 Simon McVittie 2013-06-10 14:47:13 UTC
0.20.3, 0.21.1.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.