message: meshable_arena: avoid writes to the heap during fork's copy
diff: @@ -558,6 +558,9 @@ void MeshableArena::prepareForFork() {
  runtime().heap().lock();
  runtime().lock();
  + int r = mprotect(_arenaBegin, kArenaSize, PROT_READ);
  + hard_assert(r == 0);
  +
  int err = pipe(_forkPipe);
  if (err == -1) {
  abort();
  @@ -569,6 +572,9 @@ void MeshableArena::afterForkParent() {
  return;
  }
  + int r = mprotect(_arenaBegin, kArenaSize, PROT_READ | PROT_WRITE);
  + hard_assert(r == 0);
  +
  // debug("%d: after fork parent", getpid());
  runtime().unlock();
  runtime().heap().unlock();
  @@ -623,6 +629,9 @@ void MeshableArena::afterForkChild() {
  d_assert(result == CPUInfo::PageSize);
  }
  + int r = mprotect(_arenaBegin, kArenaSize, PROT_READ | PROT_WRITE);
  + hard_assert(r == 0);
  +
  // remap the new region over the old
  void *ptr = mmap(_arenaBegin, kArenaSize, HL_MMAP_PROTECTION_MASK, kMapShared | MAP_FIXED, newFd, 0);
  hard_assert_msg(ptr != MAP_FAILED, "map failed: %d", errno);
  