jitzygote: madvise DONTFORK on writable shared region.
So only the zygote can write to the shared mapping.
Test: boots
Bug: 119800099
Change-Id: I9efde2c9c89dbc7445da890ee975effe13ba3790
diff --git a/libartbase/base/mem_map.h b/libartbase/base/mem_map.h
index 525e622..cdcfc3e 100644
--- a/libartbase/base/mem_map.h
+++ b/libartbase/base/mem_map.h
@@ -232,6 +232,7 @@
bool Protect(int prot);
void MadviseDontNeedAndZero();
+ int MadviseDontFork();
int GetProtect() const {
return prot_;
@@ -317,6 +318,10 @@
return nullptr;
}
+ // Reset in a forked process the MemMap whose memory has been madvised MADV_DONTFORK
+ // in the parent process.
+ void ResetInForkedProcess();
+
private:
MemMap(const std::string& name,
uint8_t* begin,