From dc5edf2193c14b17939ba9afe9eef4a907da053f Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Sat, 14 Nov 2026 17:54:57 +0100 Subject: memory: harden MMIO mappings and update docs. --- kernel/kapi/memory.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'kernel') diff --git a/kernel/kapi/memory.cpp b/kernel/kapi/memory.cpp index 65f9f319..83b32f0d 100644 --- a/kernel/kapi/memory.cpp +++ b/kernel/kapi/memory.cpp @@ -183,6 +183,13 @@ namespace kapi::memory auto map_mmio_region(mmio_region region, physical_address hw_base, page_mapper::flags flags) -> kstd::result> { + // Ensure that the MMIO region is not mapped as executable. Asking for an executable mapping of an MMIO region is a + // logical error, not a runtime issue. + if ((flags & page_mapper::flags::executable) != page_mapper::flags::empty) + { + system::panic("[OS:MEM] Attempt to map MMIO region at {:#018x} as executable!", region.first); + } + auto [start, count] = region; auto start_page = page::containing(start); -- cgit v1.2.3