summaryrefslogtreecommitdiff
path: root/Kernel/Memory/AddressSpace.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel/Memory/AddressSpace.cpp')
-rw-r--r--Kernel/Memory/AddressSpace.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/Kernel/Memory/AddressSpace.cpp b/Kernel/Memory/AddressSpace.cpp
index e37d3f22c3..1fa839afdb 100644
--- a/Kernel/Memory/AddressSpace.cpp
+++ b/Kernel/Memory/AddressSpace.cpp
@@ -59,6 +59,8 @@ ErrorOr<void> AddressSpace::unmap_mmap_range(VirtualAddress addr, size_t size)
if (auto* whole_region = find_region_from_range(range_to_unmap)) {
if (!whole_region->is_mmap())
return EPERM;
+ if (whole_region->is_immutable())
+ return EPERM;
PerformanceManager::add_unmap_perf_event(Process::current(), whole_region->range());
@@ -69,6 +71,8 @@ ErrorOr<void> AddressSpace::unmap_mmap_range(VirtualAddress addr, size_t size)
if (auto* old_region = find_region_containing(range_to_unmap)) {
if (!old_region->is_mmap())
return EPERM;
+ if (old_region->is_immutable())
+ return EPERM;
// Remove the old region from our regions tree, since were going to add another region
// with the exact same start address.
@@ -99,6 +103,8 @@ ErrorOr<void> AddressSpace::unmap_mmap_range(VirtualAddress addr, size_t size)
for (auto* region : regions) {
if (!region->is_mmap())
return EPERM;
+ if (region->is_immutable())
+ return EPERM;
}
Vector<Region*, 2> new_regions;