The init values shared mapping should not be shared across fork. Use
madvise MADV_DONTFORK on the memory range to ensure those pages are not
shared with children processes across fork.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I4b3541d21401227ca568ef6e8105d088746341cb
MAP_SHARED | MAP_FIXED, memfd, 0) != (void *) range->init) {
goto error_alloc;
}
+ /*
+ * Make sure the init values shared mapping is not
+ * shared with the children processes across fork.
+ */
+ if (madvise(range->init, pool->attr.stride, MADV_DONTFORK))
+ goto error_alloc;
assert(pool->attr.type == MEMPOOL_TYPE_PERCPU);
/*
* Map per-cpu memory as private COW mappings of init values.