Age | Commit message (Collapse) | Author | Files | Lines |
|
This commit works around systemd -> dbus -> (nss) -> systemd deadlock
occuring in Tizen.
Situation is depicted on diagram below:
systemd dbus nss
| . .
| . .
1> reads config . .
| . .
2> reg. nofification . .
| for dbus.service . .
| . .
| . .
3> exec. services . .
| | . .
| (start srv...) . .
| | . .
| 4>------------(exec) .
| | .
*-<---(notification)=<| .
\ | .
.\> call dbus.serv | .
. handler | .
. | 4a> read config .
. |> conn. to bus | .
. | 4b> resolve user .
. |> call dbus . and groups .
. \ . initgroups() .
. ------------>. | .
. (blocking) . \---------->select module
. . (blocking) based on conf.
. . |
(below not executed) . |> security-manager
. . | module selected
. . |
. . |
[sec-manager.socket]<---------------------<| call security-manager
. . (DEADLOCK) . on unix socket
. . .
Solid line (|) means active thread of execution, dot (.) means
code not executed (blocked).
The root cause of the problem is that systemd calls external
API in blocking manner, which, due to system configuration, requires
systemd to handle its request for successful completion.
(systemd should start security-manager service via sec-manager.socket
activation).
The exact place this situation is triggered is in dbus' initialization.
This commits works around this problem by delaying dbus.service readyness
notification - effectively - resolving the problem.
Situation becomes:
systemd dbus nss security-manager
| . . .
| . . .
1> reads config . . .
| . . .
2> reg. nofification . . .
| for dbus.service . . .
| . . .
| . . .
3> exec. services . . .
| | . . .
| (start srv...) . . .
| | . . .
| 4>------------(exec) . .
| | . .
| | . .
| | . .
| | . .
| | . .
| 4a> read config . .
| | . .
| 4b> resolve user . .
| . and groups . .
| . initgroups() . .
| . | . .
| . \---------->select module .
| . (blocking) based on conf. .
| . | .
| . |> security-manager .
| . | module selected .
| . | .
| . | .
[sec-manager.socket]<---------------------<| call security-manager .
. | . . on unix socket .
. | . .
. |> exec service ----------------------------------------------->(exec)
. | . . |
<--| . |<-------------------------<| handle call
| . | |
| |<-----------------| |
| | . |
| | . |
.\> call dbus.serv |>finish conf. file. |
. handler | parsing . |
. | | . |
*-<---(notification)-<|> explicitly . |
.\ | | notify startup . |
. \> call dbus.serv | finished . |
| handler | . |
. | | . |
. |> conn. to bus | . |
. | | . |
. |> call dbus | . |
. \ | . |
. ------------>* dispatch loop . |
. (blocking) | . |
. | . |
|<--------------------< handle call . |
| | . |
Change-Id: Ifeaf299fc8653b583cd06ca9fd4f9f8045a2bde0
|
|
When a message is created with dbus_message_new() it gets no fields.
Then, while appending some values, but before setting path, interface,
etc. a single field appears - signature. If there would be more fields,
then after deleting the last field we would need to remove padding
from second-to-last field. In case of a single field, we have
no second-to-last field, only empty dictionary. Empty dictionaries do
not have padding at the end, so we do not need to remove it.
Change-Id: Idb15f3999a3ff0117f906ec632f462eb5cdaab09
(cherry picked from commit 1d825017e4c6766fc5aee6520f6655333cf72d29)
|
|
Change-Id: Ifce97dae8b9390d492708bfd7d7467c1af1ed132
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
(cherry picked from commit 73d29ba2d5bdd7d89c414cd967cd510d48c58bfa)
|
|
Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
Change-Id: I47f8ab71c96c69c054e8674850d99934336e77c3
|
|
Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
Change-Id: I7efde6c1223acc8d978726993e09960a7235e57c
|
|
Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
Change-Id: Ia5721297e86c9e423e87ef57e609af540011705a
|
|
For disconnection connections, _dbus_connection_get_dispatch_status_unlocked always returns DBUS_DISPATCH_DATA_REMAINS.
So __bus_loop_dispatch is going around in an infinite loop.
If _dbus_loop_dispatch is out of the loop, _dbus_connection_get_dispatch_status_unlocked returns DBUS_DISPATCH_COMPLETE as normal.
It is dead-lock.
====================== reproduce ==================
su - owner
dbus-send --type=method_call --system --dest=org.tizen.system.deviced /Org/Tizen/System/DeviceD/Display org.tizen.system.deviced.display.CustomBrightness
dbus-send --type=method_call --system --dest=org.tizen.system.deviced /Org/Tizen/System/DeviceD/Display org.tizen.system.deviced.display.CustomBrightness
dbus-send --type=method_call --system --dest=org.tizen.system.deviced /Org/Tizen/System/DeviceD/Display org.tizen.system.deviced.display.CustomBrightness
dbus-send --type=method_call --system --dest=org.tizen.system.deviced /Org/Tizen/System/DeviceD/Display org.tizen.system.deviced.display.CustomBrightness
dbus-send --type=method_call --system --dest=org.tizen.system.deviced /Org/Tizen/System/DeviceD/Display org.tizen.system.deviced.display.CustomBrightness
===================================================
Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
Change-Id: I8565a757a62b50a27d2c6b6931e125af452ff74e
(cherry picked from commit 30f31f92bbe969e88386ac484061e715837d6aca)
|
|
dbus_connection_get_is_connected ()
Since dbus-daemon uses asynchronous cynara functions, some cynara functions are delayed.
In the cynara delay function, check if connection is valid or not.
If the connection is lost, the "connection->slot_list" is cleared. So bus_connection_is_active() will cause crash.
Since dbus_connection_get_is_connected() only checks for "connection->transport->disconnected" variables, it works fine if only the reference count is valid.
====================================================================================================================================
0 bus_connection_is_active (connection=<optimized out>) at connection.c:1291
1 0xb6f08134 in bus_deferred_message_dispatch (deferred_message=0xb7c93668) at check.c:498
2 0xb6f0c7ce in bus_connection_dispatch_deferred (connection=0xb7ca0008) at connection.c:2677
3 0xb6f0826a in bus_check_queued_message_reply_callback (deferred_message=0xb7cb5870, result=<optimized out>) at check.c:188
4 0xb6f0cdda in bus_cynara_check_response_callback (check_id=<optimized out>, cause=<optimized out>, response=<optimized out>, user_response_data=0xb7cb5870) at cynara.c:333
5 0xb6db2994 in Cynara::Logic::processCheckResponse (this=this@entry=0xb7c0cdb8, checkResponse=...) at /usr/src/debug/cynara-0.14.7/src/client-async/logic/Logic.cpp:277
6 0xb6db3a8e in Cynara::Logic::processResponses (this=this@entry=0xb7c0cdb8) at /usr/src/debug/cynara-0.14.7/src/client-async/logic/Logic.cpp:324
7 0xb6db4578 in Cynara::Logic::processIn (this=this@entry=0xb7c0cdb8) at /usr/src/debug/cynara-0.14.7/src/client-async/logic/Logic.cpp:348
8 0xb6db45d8 in Cynara::Logic::process (this=0xb7c0cdb8) at /usr/src/debug/cynara-0.14.7/src/client-async/logic/Logic.cpp:175
9 0xb6daf35a in operator() (this=<optimized out>) at /usr/lib/gcc/armv7l-tizen-linux-gnueabi/4.9.2/include/c++/functional:2439
10 Cynara::tryCatch(std::function<int ()> const&) (func=...) at /usr/src/debug/cynara-0.14.7/src/common/exceptions/TryCatch.h:42
11 0xb6dafa5e in cynara_async_process (p_cynara=0xb7c0c7a0) at /usr/src/debug/cynara-0.14.7/src/client-async/api/client-async-api.cpp:236
12 0xb6f0cdb4 in bus_cynara_watch_callback (watch=<optimized out>, flags=<optimized out>, data=<optimized out>) at cynara.c:288
13 0xb6f14f5a in _dbus_loop_iterate (loop=loop@entry=0xb7c0b618, block=block@entry=1) at dbus-mainloop.c:819
14 0xb6f1506c in _dbus_loop_run (loop=0xb7c0b618) at dbus-mainloop.c:883
15 0xb6f046f6 in main (argc=<optimized out>, argv=<optimized out>) at main.c:661
(gdb) info locals
d = 0x0
(gdb) f 1
(gdb) p *deferred_message->sender
$27 = {refcount = {value = 1}, mutex = 0xb7c41c70, dispatch_mutex = 0xb7c41cb0, dispatch_cond = 0xb7c41cd0, io_path_mutex = 0xb7c41c90, io_path_cond = 0xb7c41d08, outgoing_messages = 0x0, incoming_messages = 0x0, expired_messages = 0x0, message_borrowed = 0x0,
n_outgoing = 0, n_incoming = 0, outgoing_counter = 0xb7c41df8, transport = 0xb7c41778, watches = 0xb7c41b20, timeouts = 0xb7c41b40, filter_list = 0x0, slot_mutex = 0xb7c41d40, slot_list = {slots = 0xb7c41fc0, n_slots = 1}, pending_replies = 0xb7c41b60,
client_serial = 10, disconnect_message_link = 0x0, wakeup_main_function = 0x0, wakeup_main_data = 0x0, free_wakeup_main_data = 0x0, dispatch_status_function = 0x0, dispatch_status_data = 0x0, free_dispatch_status_data = 0x0, last_dispatch_status = DBUS_DISPATCH_COMPLETE,
objects = 0xb7c41f20, server_guid = 0x0, peer_smack_label = 0xb7c41c60 "System", dispatch_acquired = 0, io_path_acquired = 0, dispatch_disabled = 0, shareable = 0, exit_on_disconnect = 0, route_peer_messages = 1, disconnected_message_arrived = 1,
disconnected_message_processed = 1, have_connection_lock = 0, generation = 1}
(gdb) p deferred_message->sender->slot_list
$28 = {slots = 0xb7c41fc0, n_slots = 1}
(gdb) p *deferred_message->sender->slot_list->slots
$31 = {data = 0x0, free_data_func = 0x0}
(gdb) p connection_data_slot
$32 = 0
(gdb) p deferred_message->sender->slot_list->slots[0]
$35 = {data = 0x0, free_data_func = 0x0}
(gdb) p deferred_message->sender->transport->disconnected
$33 = 1
====================================================================================================================================
Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
Change-Id: Iab2abfb63030d15e380e11c057ee1f99124e102e
(cherry picked from commit 62fd017b7dbf577f736de7f8d44e6a94b4334472)
|
|
socket.target.wants/dbus.socket" into tizen_3.0
|
|
Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
Change-Id: Iad33b6770458d2e3e4e8507cfae5b1489da5bf0c
|
|
dbus_connection_get_is_connected ()
Since dbus-daemon uses asynchronous cynara functions, some cynara functions are delayed.
In the cynara delay function, check if connection is valid or not.
If the connection is lost, the "connection->slot_list" is cleared. So bus_connection_is_active() will cause crash.
Since dbus_connection_get_is_connected() only checks for "connection->transport->disconnected" variables, it works fine if only the reference count is valid.
====================================================================================================================================
0 bus_connection_is_active (connection=<optimized out>) at connection.c:1291
1 0xb6f08134 in bus_deferred_message_dispatch (deferred_message=0xb7c93668) at check.c:498
2 0xb6f0c7ce in bus_connection_dispatch_deferred (connection=0xb7ca0008) at connection.c:2677
3 0xb6f0826a in bus_check_queued_message_reply_callback (deferred_message=0xb7cb5870, result=<optimized out>) at check.c:188
4 0xb6f0cdda in bus_cynara_check_response_callback (check_id=<optimized out>, cause=<optimized out>, response=<optimized out>, user_response_data=0xb7cb5870) at cynara.c:333
5 0xb6db2994 in Cynara::Logic::processCheckResponse (this=this@entry=0xb7c0cdb8, checkResponse=...) at /usr/src/debug/cynara-0.14.7/src/client-async/logic/Logic.cpp:277
6 0xb6db3a8e in Cynara::Logic::processResponses (this=this@entry=0xb7c0cdb8) at /usr/src/debug/cynara-0.14.7/src/client-async/logic/Logic.cpp:324
7 0xb6db4578 in Cynara::Logic::processIn (this=this@entry=0xb7c0cdb8) at /usr/src/debug/cynara-0.14.7/src/client-async/logic/Logic.cpp:348
8 0xb6db45d8 in Cynara::Logic::process (this=0xb7c0cdb8) at /usr/src/debug/cynara-0.14.7/src/client-async/logic/Logic.cpp:175
9 0xb6daf35a in operator() (this=<optimized out>) at /usr/lib/gcc/armv7l-tizen-linux-gnueabi/4.9.2/include/c++/functional:2439
10 Cynara::tryCatch(std::function<int ()> const&) (func=...) at /usr/src/debug/cynara-0.14.7/src/common/exceptions/TryCatch.h:42
11 0xb6dafa5e in cynara_async_process (p_cynara=0xb7c0c7a0) at /usr/src/debug/cynara-0.14.7/src/client-async/api/client-async-api.cpp:236
12 0xb6f0cdb4 in bus_cynara_watch_callback (watch=<optimized out>, flags=<optimized out>, data=<optimized out>) at cynara.c:288
13 0xb6f14f5a in _dbus_loop_iterate (loop=loop@entry=0xb7c0b618, block=block@entry=1) at dbus-mainloop.c:819
14 0xb6f1506c in _dbus_loop_run (loop=0xb7c0b618) at dbus-mainloop.c:883
15 0xb6f046f6 in main (argc=<optimized out>, argv=<optimized out>) at main.c:661
(gdb) info locals
d = 0x0
(gdb) f 1
(gdb) p *deferred_message->sender
$27 = {refcount = {value = 1}, mutex = 0xb7c41c70, dispatch_mutex = 0xb7c41cb0, dispatch_cond = 0xb7c41cd0, io_path_mutex = 0xb7c41c90, io_path_cond = 0xb7c41d08, outgoing_messages = 0x0, incoming_messages = 0x0, expired_messages = 0x0, message_borrowed = 0x0,
n_outgoing = 0, n_incoming = 0, outgoing_counter = 0xb7c41df8, transport = 0xb7c41778, watches = 0xb7c41b20, timeouts = 0xb7c41b40, filter_list = 0x0, slot_mutex = 0xb7c41d40, slot_list = {slots = 0xb7c41fc0, n_slots = 1}, pending_replies = 0xb7c41b60,
client_serial = 10, disconnect_message_link = 0x0, wakeup_main_function = 0x0, wakeup_main_data = 0x0, free_wakeup_main_data = 0x0, dispatch_status_function = 0x0, dispatch_status_data = 0x0, free_dispatch_status_data = 0x0, last_dispatch_status = DBUS_DISPATCH_COMPLETE,
objects = 0xb7c41f20, server_guid = 0x0, peer_smack_label = 0xb7c41c60 "System", dispatch_acquired = 0, io_path_acquired = 0, dispatch_disabled = 0, shareable = 0, exit_on_disconnect = 0, route_peer_messages = 1, disconnected_message_arrived = 1,
disconnected_message_processed = 1, have_connection_lock = 0, generation = 1}
(gdb) p deferred_message->sender->slot_list
$28 = {slots = 0xb7c41fc0, n_slots = 1}
(gdb) p *deferred_message->sender->slot_list->slots
$31 = {data = 0x0, free_data_func = 0x0}
(gdb) p connection_data_slot
$32 = 0
(gdb) p deferred_message->sender->slot_list->slots[0]
$35 = {data = 0x0, free_data_func = 0x0}
(gdb) p deferred_message->sender->transport->disconnected
$33 = 1
====================================================================================================================================
Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
Change-Id: Iab2abfb63030d15e380e11c057ee1f99124e102e
|
|
patch from upstream
https://cgit.freedesktop.org/dbus/dbus/commit/?id=529600397bcab47b9bed5da9208c2df05c8b86b4
author Michal Koutn? <mkoutny@suse.com> 2016-05-24 09:14:11 (GMT)
committer Simon McVittie <smcv@debian.org> 2017-02-01 10:42:50 (GMT)
commit 529600397bcab47b9bed5da9208c2df05c8b86b4 (patch)
tree 17e9af27f973a4e0132ee23e405ed7d52fdb0771
parent befd186c0b005f1e1130cb3e4923c689085a8dbc (diff)
bus: Fix timeout restarts
The code counting pending fds relied on restart of timeouts when they are
enabled. This patch adds function that ensures that such enabled timeouts
have their timekeeping data reset (and not only when timeout is
registered into event loop processing).
When timeouts weren't reset, they'd fire at rather random and mainly
incorrect moments leading to interruption of connections of dbus-daemon.
Every time we reset the interval, we also need to re-enable the timeout
and mark its end time to be recalculated by the event loop, so combine
the old set_enabled(TRUE) with set_interval() as a new restart() method.
This leaves all the set_enabled() calls having a FALSE parameter, so
remove the parameter and rename the method to disable().
[smcv: fix minor coding style issues]
[smcv: replace set_reenabled()/set_interval() pair with restart()]
[smcv: replace set_enabled(FALSE) with disable()]
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=95619
Change-Id: Ia80641554800ae09ae22d4615b87eda0697c5f3e
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
(cherry picked from commit ffc72625ab9b18f9ff67c16aebc4ad93d4767b6f)
|
|
/usr/lib/systemd/user/sockets.target.wants/dbus.socket
Until now, dbus.socket of user session was not running in the sockets.target.
dbus.socket has been triggered by dbus.service's dependencies.
The dbus.service is included in basic.target.
Therefore, there are some dependency issues.
If a service runs before dbus.service, the service can not accesses dbus system.
(Since dbus.socket is not yet activated, so you can not make a dbus connection.)
I have modified dbus.service to be explicitly run in sockets.target.
On the session bus, sockets.target is guaranteed to run before all services.
Signed-off-by: INSUN PYO <insun.pyo@ubuntu1604.playinsun.pe.kr>
Change-Id: Ic46f1a46b458e2017b0025c6e564ac1204eb8cc8
|
|
The adbd's privilege has been changed form "System::Privileged" to "User::Shell".
So, pgrep does not work with smack errors when accessing /proc.
If it fails to find DBUS address, the fixed address is used.
Signed-off-by: INSUN PYO <insun.pyo@ubuntu1604.playinsun.pe.kr>
Change-Id: I4f9e0bc0939de2ecd7b866df8a2f266b4258338b
|
|
Change-Id: I2e509fe1a4f275c9f5b35290bdd2d218c4b3692a
|
|
Change-Id: I127f90398b4fe33b3c3b412ef84a42ab2683efd5
|
|
Change-Id: Icf4a2b514abfeb458305c58ab99aad4cfbab325d
|
|
Change-Id: I0175a6c710e418be7f3b06f1df6ad13396e40f8c
Signed-off-by: Krystian Kisielak <k.kisielak@samsung.com>
|
|
There is a requirement for fixed-size tuples:
size of such tuple must be a multiply of its required alignment.
That part was overlooked in the implementation.
This commit adds padding accounting for both reading and writing.
Change-Id: I0825be6436b93b836dc333f5a395fdf1021f2a06
|
|
Change-Id: If84df57e9985f484e3c3c63854df5ff666cc1794
|
|
Change-Id: Ifcc7dacb077615c8f5392a6b213d402d4775af05
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
|
|
Change-Id: I3d9aa7f2d608e6706600a87ad5dc570033244f98
|
|
To keep compatibility with dbus1, GetConnectionSELinuxSecurityContext
method call should always return SELinuxSecurityContextUnknown error
on systems without SELinux (even if other LSM systems, like for example
SMACK, are available on platform).
Change-Id: I347cdf665a03fc047d267752b23c4503bf5218e3
|
|
|
|
Change-Id: I9fd1720e5c2a1edaa1fcd66b78df0b0238e9ce9f
|
|
Change-Id: I1eb91da587469381f69ada2939a980d8ea1f40e1
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
|
|
Change-Id: I6f7c2e39c8872ebae8a68157515ef247325b3cc4
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
|
|
default.target.wants to basic.target.wants
Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
Change-Id: I5ec89ce65fe196d54a4b130e41a83a82acb40101
|
|
http://suprem.sec.samsung.net/confluence/display/SFH/Lazy+mount
Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
Change-Id: I4b9f4a435f2aae9215bb7d77bb423715884d01e1
|
|
|
|
Change-Id: Ib8a1c138983124a2597b0c700f5c6a2c7dd4744e
|
|
Additionally, added some documentation for _kdbus_list().
Change-Id: I267100ec123f33a1b10f3ce1c9aca3004ac1e9fc
|
|
|
|
Change-Id: I8710e8d2ff1911ea11b48984ebda227a0a8658fe
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
|
|
Change-Id: I0f5c1882a9ffcc9a0186a834ad73e72a10b9f239
|
|
|
|
|
|
Change-Id: I683f77755c6fefafbcc255107839f10362abadb0
|
|
Change-Id: Icc74194668757c9e7ebc79d63d4a3b2ec65d0c34
|
|
Change-Id: Ib10e3eb7c102f63a5d63c550858ad4a5edee8c2b
|
|
GVariant keeps body inside structs. This fact is kept hidden from
libdbus user. Thus, struct parentheses have to be added, removed
in proper places. There was one such place in
_dbus_type_reader_gvariant_init(). However, it was not sufficient
and get_const_signature() also got stripping code. Unfortunately,
I didn't notice that stripping should be removed in the first
of these functions. This commit fixes that.
Change-Id: I5c2e6c7c8212d283fd6da1cc998a2711038905f3
|
|
Change-Id: I9281352c2afa0bb39c69df35ce28054fab83b994
|
|
|
|
Change-Id: Iea127741bfe3f5fbe68eb13d98933307420007b2
|
|
Change-Id: I5041323980664baecdde25a65230e7c6a3608bac
|
|
Change-Id: I725049c020a107774f79cf2685c7505497b6723d
|
|
The maximum value of unsigned long is 4294967295 which is too small
for storing nano second. It makes the overflow in calculation.
Use LLU instead of LU for timeout calculation.
======================================================================
Subject: [PATCH 2/2] kdbus: adjust the default value for timeout to 50 sec
This definition is used by the default value for timeout value.
But in the other places, 50 sec is used by default value for timeout,
instead of using it.
Let's align it with the others
Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
Change-Id: Idddaf3f095ad47206f8b6ac11bc46c43c3bc8bd3
|
|
members" into tizen
|
|
appended" into tizen
|
|
Information about required sender credentials is cached in internal
structures at authentication stage.
Change-Id: Ibe0b3ba8b608728c11347d406c9ab2e4495cafc7
|