From 087c7dd6542494a993165e6d66585b12e704a4e3 Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Sat, 24 Aug 2024 02:25:34 +0000 Subject: [PATCH] arm64: Small fixes extracted from larger MMU fixup. * User-Execute without User-Read mapping is disallowed. * Add comments to arch_vm_set_memory_type Change-Id: I450206ab973552dc36a7d778f573154541fd709f Reviewed-on: https://review.haiku-os.org/c/haiku/+/8098 Reviewed-by: waddlesplash --- src/system/kernel/arch/arm64/arch_vm.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/system/kernel/arch/arm64/arch_vm.cpp b/src/system/kernel/arch/arm64/arch_vm.cpp index 51218db3dd..df802e0e74 100644 --- a/src/system/kernel/arch/arm64/arch_vm.cpp +++ b/src/system/kernel/arch/arm64/arch_vm.cpp @@ -109,6 +109,12 @@ arch_vm_supports_protection(uint32 protection) return false; } + // User-Execute implies User-Read, because it would break PAN otherwise + if ((protection & B_EXECUTE_AREA) != 0 + && (protection & B_READ_AREA) == 0) { + return false; + } + return true; } @@ -122,5 +128,7 @@ arch_vm_unset_memory_type(VMArea* area) status_t arch_vm_set_memory_type(VMArea* area, phys_addr_t physicalBase, uint32 type) { + // Memory type is set in page tables during mapping, + // no need to do anything more here. return B_OK; }