summaryrefslogtreecommitdiff
path: root/Kernel/ProcessSpecificExposed.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-08-18 19:20:33 +0200
committerAndreas Kling <kling@serenityos.org>2022-08-18 19:20:33 +0200
commit4bc3745ce681e54c7f719fa5b98858c085b2f280 (patch)
treed8efab49e8ea3baa57726feb4f213aa686355487 /Kernel/ProcessSpecificExposed.cpp
parentc3ad4ffcece4c3693185f0de82573d93db3c3895 (diff)
downloadserenity-4bc3745ce681e54c7f719fa5b98858c085b2f280.zip
Kernel: Make Region's physical page accessors safer to use
Region::physical_page() now takes the VMObject lock while accessing the physical pages array, and returns a RefPtr<PhysicalPage>. This ensures that the array access is safe. Region::physical_page_slot() now VERIFY()'s that the VMObject lock is held by the caller. Since we're returning a reference to the physical page slot in the VMObject's physical page array, this is the best we can do here.
Diffstat (limited to 'Kernel/ProcessSpecificExposed.cpp')
-rw-r--r--Kernel/ProcessSpecificExposed.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Kernel/ProcessSpecificExposed.cpp b/Kernel/ProcessSpecificExposed.cpp
index 14eb1db680..86359a78a0 100644
--- a/Kernel/ProcessSpecificExposed.cpp
+++ b/Kernel/ProcessSpecificExposed.cpp
@@ -293,7 +293,7 @@ ErrorOr<void> Process::procfs_get_virtual_memory_stats(KBufferBuilder& builder)
StringBuilder pagemap_builder;
for (size_t i = 0; i < region.page_count(); ++i) {
- auto const* page = region.physical_page(i);
+ auto page = region.physical_page(i);
if (!page)
pagemap_builder.append('N');
else if (page->is_shared_zero_page() || page->is_lazy_committed_page())