mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
If a multithreaded caller creates a thread which calls xs_read_watch, before it has set any watches with xs_watch, the thread in xs_read_watch will enter read_message and sit reading the xenstored fd without the appropriate locks held. Other threads can then concurrently read the xenstored fd, which naturally does not work very well. Symptoms of this bug which I have been able to reproduce include failure of xend startup to finish, due to a deadlock; results could also include reading corrupted data from xenstore. In this patch we arrange for xs_read_watch to always rely on the reader thread created by xs_watch. If no watches have been set, then xs_read_watch will block until one has been. If the library is compiled non-threaded xs_read_watch unconditionally does the reading in the current thread. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
The following files are imported from the Samba project. We use the versions from Samba 3, the current stable branch. talloc.c: samba-trunk/source/lib/talloc.c r14291 2006-03-13 04:27:47 +0000 talloc.h: samba-trunk/source/include/talloc.h r11986 2005-12-01 00:43:36 +0000