]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ARM: allow __do_kernel_fault() to report execution of memory faults
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Fri, 5 Dec 2025 17:09:44 +0000 (17:09 +0000)
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Wed, 10 Dec 2025 12:21:46 +0000 (12:21 +0000)
Allow __do_kernel_fault() to detect the execution of memory, so we can
provide the same fault message as do_page_fault() would do. This is
required when we split the kernel address fault handling from the
main do_page_fault() code path.

Reviewed-by: Xie Yuanbin <xieyuanbin1@huawei.com>
Tested-by: Xie Yuanbin <xieyuanbin1@huawei.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
arch/arm/mm/fault.c

index f87f353e5a8b0a763118c61f0b98a7244595e106..192c8ab196dbaba3c4b4d8b473c545f6d2b1065c 100644 (file)
@@ -175,6 +175,8 @@ __do_kernel_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
         */
        if (addr < PAGE_SIZE) {
                msg = "NULL pointer dereference";
+       } else if (is_permission_fault(fsr) && fsr & FSR_LNX_PF) {
+               msg = "execution of memory";
        } else {
                if (is_translation_fault(fsr) &&
                    kfence_handle_page_fault(addr, is_write_fault(fsr), regs))