Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | From b8f84bd39485d3977625c9a8b8e8cff5d23be56f Mon Sep 17 00:00:00 2001 |
| 2 | From: Roy Li <rongqing.li@windriver.com> |
| 3 | Date: Thu, 27 Feb 2014 09:05:02 +0800 |
| 4 | Subject: [PATCH] dbus: clear guid_from_server if send_negotiate_unix_fd |
| 5 | failed |
| 6 | |
| 7 | Upstream-Status: Submitted |
| 8 | |
| 9 | bus-test dispatch test failed with below information: |
| 10 | ./bus/bus-test: Running message dispatch test |
| 11 | Activating service name='org.freedesktop.DBus.TestSuiteEchoService' |
| 12 | Successfully activated service 'org.freedesktop.DBus.TestSuiteEchoService' |
| 13 | 6363: assertion failed "_dbus_string_get_length (& DBUS_AUTH_CLIENT (auth)->guid_from_server) == 0" file "dbus-auth.c" line 1545 function process_ok |
| 14 | ./bus/bus-test(_dbus_print_backtrace+0x29) [0x80cb969] |
| 15 | ./bus/bus-test(_dbus_abort+0x14) [0x80cfb44] |
| 16 | ./bus/bus-test(_dbus_real_assert+0x53) [0x80b52c3] |
| 17 | ./bus/bus-test() [0x80e24da] |
| 18 | ./bus/bus-test(_dbus_auth_do_work+0x388) [0x80e3848] |
| 19 | ./bus/bus-test() [0x80aea49] |
| 20 | ./bus/bus-test() [0x80affde] |
| 21 | ./bus/bus-test(_dbus_transport_handle_watch+0xb1) [0x80ad841] |
| 22 | ./bus/bus-test(_dbus_connection_handle_watch+0x104) [0x8089174] |
| 23 | ./bus/bus-test(dbus_watch_handle+0xd8) [0x80b15e8] |
| 24 | ./bus/bus-test(_dbus_loop_iterate+0x4a9) [0x80d1509] |
| 25 | ./bus/bus-test(bus_test_run_clients_loop+0x5d) [0x808129d] |
| 26 | ./bus/bus-test() [0x806cab0] |
| 27 | ./bus/bus-test() [0x806e0ca] |
| 28 | ./bus/bus-test() [0x806da6f] |
| 29 | ./bus/bus-test(_dbus_test_oom_handling+0x18c) [0x80b5c8c] |
| 30 | ./bus/bus-test() [0x806f723] |
| 31 | ./bus/bus-test(bus_dispatch_test+0x3c) [0x8071aac] |
| 32 | ./bus/bus-test(main+0x1b7) [0x805acc7] |
| 33 | /lib/libc.so.6(__libc_start_main+0xf3) [0x45f919b3] |
| 34 | ./bus/bus-test() [0x805ae39] |
| 35 | |
| 36 | The stack is below: |
| 37 | #0 0xffffe425 in __kernel_vsyscall () |
| 38 | #1 0x45fa62d6 in raise () from /lib/libc.so.6 |
| 39 | #2 0x45fa9653 in abort () from /lib/libc.so.6 |
| 40 | #3 0x080cfb65 in _dbus_abort () at dbus-sysdeps.c:94 |
| 41 | #4 0x080b52c3 in _dbus_real_assert (condition=0, |
| 42 | condition_text=condition_text@entry=0x8117a38 "_dbus_string_get_length (& DBUS_AUTH_CLIENT (auth)->guid_from_server) == 0", |
| 43 | file=file@entry=0x8117273 "dbus-auth.c", line=line@entry=1545, |
| 44 | func=func@entry=0x8117f8e <__FUNCTION__.3492> "process_ok") |
| 45 | data=0x8157290) at dbus-connection.c:1515 |
| 46 | #0 0x00000033fee353e9 in raise () from /lib64/libc.so.6 |
| 47 | #1 0x00000033fee38508 in abort () from /lib64/libc.so.6 |
| 48 | #2 0x000000000047d585 in _dbus_abort () at dbus-sysdeps.c:94 |
| 49 | #3 0x0000000000466486 in _dbus_real_assert (condition=<optimized out>, |
| 50 | condition_text=condition_text@entry=0x4c2988 "_dbus_string_get_length (& DBUS_AUTH_CLIENT (auth)->guid_from_server) == 0", |
| 51 | file=file@entry=0x4c21a5 "dbus-auth.c", line=line@entry=1546, |
| 52 | func=func@entry=0x4c2fce <__FUNCTION__.3845> "process_ok") |
| 53 | at dbus-internals.c:931 |
| 54 | #4 0x000000000048d424 in process_ok (args_from_ok=0x7fffffffe480, |
| 55 | auth=0x6ff340) at dbus-auth.c:1546 |
| 56 | #5 handle_client_state_waiting_for_data (auth=0x6ff340, |
| 57 | command=<optimized out>, args=0x7fffffffe480) at dbus-auth.c:1996 |
| 58 | #6 0x000000000048e789 in process_command (auth=0x6ff340) at dbus-auth.c:2208 |
| 59 | #7 _dbus_auth_do_work (auth=0x6ff340) at dbus-auth.c:2458 |
| 60 | #8 0x000000000046091d in do_authentication ( |
| 61 | transport=transport@entry=0x6ffaa0, do_reading=do_reading@entry=1, |
| 62 | do_writing=do_writing@entry=0, |
| 63 | auth_completed=auth_completed@entry=0x7fffffffe55c) |
| 64 | at dbus-transport-socket.c:442 |
| 65 | #9 0x0000000000461d08 in socket_handle_watch (transport=0x6ffaa0, |
| 66 | watch=0x6f4190, flags=1) at dbus-transport-socket.c:921 |
| 67 | #10 0x000000000045fa3a in _dbus_transport_handle_watch (transport=0x6ffaa0, |
| 68 | |
| 69 | Once send_negotiate_unix_fd failed, this failure will happen, since |
| 70 | auth->guid_from_server has been set to some value before |
| 71 | send_negotiate_unix_fd. send_negotiate_unix_fd failure will lead to |
| 72 | this auth be handled by process_ok again, but this auth->guid_from_server |
| 73 | is not zero. |
| 74 | |
| 75 | So we should clear auth->guid_from_server if send_negotiate_unix_fd failed |
| 76 | |
| 77 | Signed-off-by: Roy Li <rongqing.li@windriver.com> |
| 78 | --- |
| 79 | dbus/dbus-auth.c | 9 +++++++-- |
| 80 | 1 file changed, 7 insertions(+), 2 deletions(-) |
| 81 | |
| 82 | diff --git a/dbus/dbus-auth.c b/dbus/dbus-auth.c |
| 83 | index d2c37a7..37b45c6 100644 |
| 84 | --- a/dbus/dbus-auth.c |
| 85 | +++ b/dbus/dbus-auth.c |
| 86 | @@ -1571,8 +1571,13 @@ process_ok(DBusAuth *auth, |
| 87 | _dbus_verbose ("Got GUID '%s' from the server\n", |
| 88 | _dbus_string_get_const_data (& DBUS_AUTH_CLIENT (auth)->guid_from_server)); |
| 89 | |
| 90 | - if (auth->unix_fd_possible) |
| 91 | - return send_negotiate_unix_fd(auth); |
| 92 | + if (auth->unix_fd_possible) { |
| 93 | + if (!send_negotiate_unix_fd(auth)) { |
| 94 | + _dbus_string_set_length (& DBUS_AUTH_CLIENT (auth)->guid_from_server, 0); |
| 95 | + return FALSE; |
| 96 | + } |
| 97 | + return TRUE; |
| 98 | + } |
| 99 | |
| 100 | _dbus_verbose("Not negotiating unix fd passing, since not possible\n"); |
| 101 | return send_begin (auth); |
| 102 | -- |
| 103 | 1.7.10.4 |
| 104 | |