1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00
samba-mirror/lib/tevent
Volker Lendecke 1828011317 tevent: Fix a race condition in tevent context rundown
We protect setting tctx->event_ctx=NULL with tctx->event_ctx_mutex.
But in _tevent_threaded_schedule_immediate we have the classic
TOCTOU race: After we checked "ev==NULL", looking at
tevent_common_context_destructor the event context can go after
_tevent_threaded_schedule_immediate checked. We need to serialize
things a bit by keeping tctx->event_ctx_mutex locked while we
reference "ev", in particular in the

DLIST_ADD_END(ev->scheduled_immediates,im);

I think the locking hierarchy is still maintained, tevent_atfork_prepare()
first locks all the tctx locks, and then the scheduled_mutex.  Also,
I don't think this will impact parallelism too badly: event_ctx_mutex
is only used to protect setting tctx->ev.

Found by staring at code while fixing the FreeBSD memleak due to
not destroying scheduled_mutex.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jun  9 00:45:26 CEST 2017 on sn-devel-144
2017-06-09 00:45:26 +02:00
..
ABI tevent: version 0.9.31 2016-10-05 15:32:35 +02:00
doc tevent_tutorial: Fix tevent_thread referencing 2016-09-16 05:16:00 +02:00
bindings.py pytalloc: Improve timer wrapper, and test it 2015-06-10 06:06:19 +02:00
configure ldb/tevent: Fix detection of waf paths. 2010-09-28 09:12:41 +02:00
doxy.config tevent: Link the tutorial on the mainpage. 2013-06-12 19:54:30 +02:00
echo_server.c lib: tevent: Use struct sockaddr_storage to cope with IPv6. 2016-05-29 09:13:30 +02:00
Makefile waf: ensure "make dist" works from a clean git tree for all libraries 2011-01-08 02:35:22 +01:00
pytevent.c pytevent: add a TeventTimer_Object_ref helper structure to make the code clearer 2015-06-12 17:08:19 +02:00
testsuite.c tevent: Add tevent_re_initialise to threaded test 2017-06-08 20:38:19 +02:00
tevent_debug.c lib/tevent: Add trace point callback 2012-06-08 19:00:05 +02:00
tevent_epoll.c tevent: Add threaded immediate activation 2016-08-24 01:33:48 +02:00
tevent_fd.c Return NULL if tevent_add_fd() is passed a negative fd 2011-02-14 17:47:03 +01:00
tevent_immediate.c tevent: remove unneeded type argument from DLIST_ADD_END 2016-02-06 21:48:17 +01:00
tevent_internal.h tevent: Make talloc_free safe when threaded_contexts exist 2016-10-05 00:06:21 +02:00
tevent_liboop.c tevent: Fix a comment 2013-01-18 00:05:37 +01:00
tevent_poll.c tevent: Add threaded immediate activation 2016-08-24 01:33:48 +02:00
tevent_port.c tevent: Add threaded immediate activation 2016-08-24 01:33:48 +02:00
tevent_queue.c tevent: Fix a typo 2016-08-20 05:51:10 +02:00
tevent_req.c tevent: Add tevent_req_reset_endtime 2016-10-05 00:06:22 +02:00
tevent_select.c tevent: Add threaded immediate activation 2016-08-24 01:33:48 +02:00
tevent_signal.c tevent: Move the async wakeup pipe to common 2016-08-24 01:33:48 +02:00
tevent_standard.c tevent: Clarify apparently useless conditions 2016-07-12 13:56:41 +02:00
tevent_threads.c tevent: Fix a race condition in tevent context rundown 2017-06-09 00:45:26 +02:00
tevent_timed.c tevent: Add tevent_update_timer() 2016-10-05 00:06:21 +02:00
tevent_util.c tevent: Set FD_CLOEXEC on epoll handle 2011-08-11 14:38:53 -04:00
tevent_util.h Revert "tevent: avoid -Wtautological-compare errors with gcc6" 2016-07-15 00:54:12 +02:00
tevent_wakeup.c tevent: Remove a pointless goto 2013-08-16 16:50:23 +02:00
tevent.c tevent: Fix a memleak on FreeBSD 2017-06-08 20:38:19 +02:00
tevent.h tevent: Fix a typo 2017-06-08 20:38:19 +02:00
tevent.pc.in tevent: Update flags in tevent pkgconfig file 2014-04-04 21:35:34 +02:00
tevent.py tevent: remove shebang from tevent.py 2016-12-08 22:12:12 +01:00
wscript waf: disable-python - align tevent wscript 2017-03-10 07:31:12 +01:00