Fix: get_wait_shm() ust mutex deadlock
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 17 Sep 2012 16:01:14 +0000 (12:01 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 17 Sep 2012 16:04:43 +0000 (12:04 -0400)
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 <zheng.chang@emc.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
liblttng-ust/lttng-ust-comm.c

index 67438117408715cff1e009123d392544dcb9bd96..51eb75b55ab873795356fef5543839c5f44e755f 100644 (file)
@@ -535,9 +535,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
This page took 0.027221 seconds and 4 git commands to generate.