fix: Add PROT_READ to ctfser mmap flags
authorMichael Jeanson <mjeanson@efficios.com>
Wed, 15 May 2019 18:49:14 +0000 (14:49 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 15 May 2019 20:09:57 +0000 (16:09 -0400)
On Linux PROT_WRITE implies PROT_READ but on other Unices like Solaris,
it's not the case. This resulted in a segfault when reading from the
mapping.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: If11bbcf32e33bf5e682afaade2d3769a141c6583
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1302
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Tested-by: jenkins
ctfser/ctfser.c

index e06972b9801c5d059788ef92543d7eb0ff3e18e7..bb9590ab3741a35f81c7c722bd09b62aac0f93d6 100644 (file)
@@ -52,7 +52,8 @@ uint64_t get_packet_size_increment_bytes(void)
 static inline
 void mmap_align_ctfser(struct bt_ctfser *ctfser)
 {
-       ctfser->base_mma = mmap_align(ctfser->cur_packet_size_bytes, PROT_WRITE,
+       ctfser->base_mma = mmap_align(ctfser->cur_packet_size_bytes,
+               PROT_READ | PROT_WRITE,
                MAP_SHARED, ctfser->fd, ctfser->mmap_offset);
 }
 
This page took 0.024247 seconds and 4 git commands to generate.