summaryrefslogtreecommitdiff
path: root/arch/arm/mm/fault.h
diff options
context:
space:
mode:
authorWang Kefeng <wangkefeng.wang@huawei.com>2021-09-22 16:56:32 +0300
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2021-10-19 12:35:43 +0300
commitabc25bbcb55c08183d30ee79a308aeef16b62dcb (patch)
tree61d448d752712f24bfde938cc0caa377efacc970 /arch/arm/mm/fault.h
parent2e707106fac7f81f780d7c76770a726c46757a84 (diff)
downloadlinux-abc25bbcb55c08183d30ee79a308aeef16b62dcb.tar.xz
ARM: 9131/1: mm: Fix PXN process with LPAE feature
When user code execution with privilege mode, it will lead to infinite loop in the page fault handler if ARM_LPAE enabled, The issue could be reproduced with "echo EXEC_USERSPACE > /sys/kernel/debug/provoke-crash/DIRECT" As Permission fault shows in ARM spec, IFSR format when using the Short-descriptor translation table format Permission fault: 01101 First level 01111 Second level IFSR format when using the Long-descriptor translation table format Permission fault: 0011LL LL bits indicate levelb. Add is_permission_fault() function to check permission fault and die if permission fault occurred under instruction fault in do_page_fault(). Fixes: 1d4d37159d01 ("ARM: 8235/1: Support for the PXN CPU feature on ARMv7") Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Diffstat (limited to 'arch/arm/mm/fault.h')
-rw-r--r--arch/arm/mm/fault.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/arm/mm/fault.h b/arch/arm/mm/fault.h
index 9ecc2097a87a..83b5ab32d7a4 100644
--- a/arch/arm/mm/fault.h
+++ b/arch/arm/mm/fault.h
@@ -14,6 +14,8 @@
#ifdef CONFIG_ARM_LPAE
#define FSR_FS_AEA 17
+#define FS_PERM_NOLL 0xC
+#define FS_PERM_NOLL_MASK 0x3C
static inline int fsr_fs(unsigned int fsr)
{
@@ -21,6 +23,8 @@ static inline int fsr_fs(unsigned int fsr)
}
#else
#define FSR_FS_AEA 22
+#define FS_L1_PERM 0xD
+#define FS_L2_PERM 0xF
static inline int fsr_fs(unsigned int fsr)
{