[PATCH] arm64/mm: add pud_user_exec() check in pud_user_accessible_page()

Liu Shixin posted 1 patch 3 years, 4 months ago
arch/arm64/include/asm/pgtable.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] arm64/mm: add pud_user_exec() check in pud_user_accessible_page()
Posted by Liu Shixin 3 years, 4 months ago
Add check for the executable case in pud_user_accessible_page() too
like what we did for pte and pmd.

Fixes: 42b2547137f5 ("arm64/mm: enable ARCH_SUPPORTS_PAGE_TABLE_CHECK")
Suggested-by: Will Deacon <will@kernel.org>
Signed-off-by: Liu Shixin <liushixin2@huawei.com>
---
 arch/arm64/include/asm/pgtable.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 17afb09f386f..f1cfc44ef52f 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -682,7 +682,7 @@ static inline unsigned long pmd_page_vaddr(pmd_t pmd)
 #define pud_leaf(pud)		(pud_present(pud) && !pud_table(pud))
 #define pud_valid(pud)		pte_valid(pud_pte(pud))
 #define pud_user(pud)		pte_user(pud_pte(pud))
-
+#define pud_user_exec(pud)	pte_user_exec(pud_pte(pud))
 
 static inline void set_pud(pud_t *pudp, pud_t pud)
 {
@@ -868,7 +868,7 @@ static inline bool pmd_user_accessible_page(pmd_t pmd)
 
 static inline bool pud_user_accessible_page(pud_t pud)
 {
-	return pud_leaf(pud) && pud_user(pud);
+	return pud_leaf(pud) && (pud_user(pud) || pud_user_exec(pud));
 }
 #endif
 
-- 
2.25.1
Re: [PATCH] arm64/mm: add pud_user_exec() check in pud_user_accessible_page()
Posted by Will Deacon 3 years, 3 months ago
On Tue, 22 Nov 2022 20:31:37 +0800, Liu Shixin wrote:
> Add check for the executable case in pud_user_accessible_page() too
> like what we did for pte and pmd.
> 
> 

Applied to arm64 (for-next/fixes), thanks!

[1/1] arm64/mm: add pud_user_exec() check in pud_user_accessible_page()
      https://git.kernel.org/arm64/c/730a11f982e6

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev