arm64: kernel: Don't toggle PAN on systems with UAO
[cascardo/linux.git] / arch / arm64 / mm / fault.c
index 820d473..d0762a7 100644 (file)
@@ -234,6 +234,9 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
        }
 
        if (permission_fault(esr) && (addr < USER_DS)) {
+               if (get_thread_info(regs->sp)->addr_limit == KERNEL_DS)
+                       panic("Accessing user space memory with fs=KERNEL_DS");
+
                if (!search_exception_tables(regs->pc))
                        panic("Accessing user space memory outside uaccess.h routines");
        }