From: Mathieu Desnoyers Date: Mon, 17 Sep 2012 16:01:14 +0000 (-0400) Subject: Fix: get_wait_shm() ust mutex deadlock X-Git-Tag: v2.1.0-rc2~43 X-Git-Url: http://git.liburcu.org/?p=lttng-ust.git;a=commitdiff_plain;h=b0c1425d1dbdd356172125a2dde4af4602a17326 Fix: get_wait_shm() ust mutex deadlock The main issue is that get_wait_shm() bypass the fork() wrapper (with lttng_ust_nest_count), which is responsible for holding the UST mutex across fork(). Therefore, when exiting the context of the child process, we execute the destructor, which try to grab the UST mutex, which might be in pretty much any state. Given that we don't want this process to try to register to lttng-sessiond (because this is internal to lttng-ust), we might want to let it skip the destructor execution. This would actually be the easiest way out. Reported-by: changz Signed-off-by: Mathieu Desnoyers --- diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c index be64acd0..596fd7df 100644 --- a/liblttng-ust/lttng-ust-comm.c +++ b/liblttng-ust/lttng-ust-comm.c @@ -616,9 +616,9 @@ int get_wait_shm(struct sock_info *sock_info, size_t mmap_size) ret = ftruncate(wait_shm_fd, mmap_size); if (ret) { PERROR("ftruncate"); - exit(EXIT_FAILURE); + _exit(EXIT_FAILURE); } - exit(EXIT_SUCCESS); + _exit(EXIT_SUCCESS); } /* * For local shm, we need to have rw access to accept