Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#Centipede Protect the shared mmap-ed buffers from forked processes. #1580

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions centipede/centipede_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,7 @@ TEST_F(CentipedeWithTemporaryLocalDir, UsesProvidedCustomMutator) {
}

TEST_F(CentipedeWithTemporaryLocalDir, FailsOnMisbehavingCustomMutator) {
GTEST_FLAG_SET(death_test_style, "threadsafe");
Environment env;
env.binary =
absl::StrCat(GetDataDependencyFilepath(
Expand Down
5 changes: 5 additions & 0 deletions centipede/shared_memory_blob_sequence.cc
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ void SharedMemoryBlobSequence::MmapData() {
data_ = static_cast<uint8_t *>(
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() {
Expand Down