From: Mathieu Desnoyers Date: Thu, 23 Feb 2012 00:44:56 +0000 (-0500) Subject: freebsd: fchmod is not supported on posix shm X-Git-Tag: v2.0.0-rc3~43 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=409a0c56eb6e089c182dfa8f2a7a63dc95b04917;hp=89831a7431103178268b5f1dccbf094e7c4f4095 freebsd: fchmod is not supported on posix shm It is OK not to the the fchmod. However, if UST apps start before lttng-sessiond, they will have write access to the futex shm. Signed-off-by: Mathieu Desnoyers --- diff --git a/src/bin/lttng-sessiond/shm.c b/src/bin/lttng-sessiond/shm.c index 77c09995c..55d00e67f 100644 --- a/src/bin/lttng-sessiond/shm.c +++ b/src/bin/lttng-sessiond/shm.c @@ -104,11 +104,15 @@ static int get_wait_shm(char *shm_path, size_t mmap_size, int global) exit(EXIT_FAILURE); } +#ifndef __FreeBSD__ ret = fchmod(wait_shm_fd, mode); if (ret < 0) { perror("fchmod"); exit(EXIT_FAILURE); } +#else +#warning "FreeBSD does not support setting file mode on shm FD. Remember that for secure use, lttng-sessiond should be started before applications linked on lttng-ust." +#endif DBG("Got the wait shm fd %d", wait_shm_fd);