summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-08-03 10:21:49 +0200
committerAndreas Kling <kling@serenityos.org>2021-08-03 10:23:36 +0200
commit821a6e8b4ce7caaed5297ae2162fa6d94519e932 (patch)
tree3e8367c78c166a30eb502342220863bc0a9e98d1
parent7a8efa7771ff41ae41b6c250ab1d3fe719c1dd94 (diff)
downloadserenity-821a6e8b4ce7caaed5297ae2162fa6d94519e932.zip
Kernel: Remap regions after changing purgeable VM object volatile flag
Otherwise we could end up with stale page table mappings that give us erroneous Protection Violation faults when accessing valid addresses.
-rw-r--r--Kernel/VM/AnonymousVMObject.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/Kernel/VM/AnonymousVMObject.cpp b/Kernel/VM/AnonymousVMObject.cpp
index 522f27a521..2e3d6f80cf 100644
--- a/Kernel/VM/AnonymousVMObject.cpp
+++ b/Kernel/VM/AnonymousVMObject.cpp
@@ -230,6 +230,8 @@ KResult AnonymousVMObject::set_volatile(bool is_volatile, bool& was_purged)
m_volatile = true;
m_was_purged = false;
+
+ for_each_region([&](auto& region) { region.remap(); });
return KSuccess;
}
// When a VMObject is made non-volatile, we try to commit however many pages are not currently available.
@@ -258,6 +260,7 @@ KResult AnonymousVMObject::set_volatile(bool is_volatile, bool& was_purged)
m_volatile = false;
m_was_purged = false;
+ for_each_region([&](auto& region) { region.remap(); });
return KSuccess;
}