diff --git a/centipede/shared_memory_blob_sequence.cc b/centipede/shared_memory_blob_sequence.cc index a60ad856..56108e6c 100644 --- a/centipede/shared_memory_blob_sequence.cc +++ b/centipede/shared_memory_blob_sequence.cc @@ -147,6 +147,11 @@ void SharedMemoryBlobSequence::MmapData() { data_ = static_cast( mmap(nullptr, size_, PROT_READ | PROT_WRITE, MAP_SHARED, fd_, 0)); ErrorOnFailure(data_ == MAP_FAILED, "mmap() failed"); +#ifndef __APPLE__ + // TODO: b/385774476 - this is a temporary and Linux-only solution to protect + // the mmap-ed region from forked processes. + ErrorOnFailure(madvise(data_, size_, MADV_DONTFORK), "madvise() failed"); +#endif } SharedMemoryBlobSequence::~SharedMemoryBlobSequence() {