Skip to content

Commit d3eb70e

Browse files
liupingfanwilldeacon
authored andcommitted
arm64: mm: Fix VM_BUG_ON(mm != &init_mm) for trans_pgd
trans_pgd_create_copy() can hit "VM_BUG_ON(mm != &init_mm)" in the function pmd_populate_kernel(). This is the combined consequence of commit 5de5988 ("arm64: trans_pgd: pass NULL instead of init_mm to *_populate functions"), which replaced &init_mm with NULL and commit 59511cf ("arm64: mm: use XN table mapping attributes for user/kernel mappings"), which introduced the VM_BUG_ON. Since the former sounds reasonable, it is better to work on the later. From the perspective of trans_pgd, two groups of functions are considered in the later one: pmd_populate_kernel() mm == NULL should be fixed, else it hits VM_BUG_ON() p?d_populate() mm == NULL means PXN, that is OK, since trans_pgd only copies a linear map, no execution will happen on the map. So it is good enough to just relax VM_BUG_ON() to disregard mm == NULL Fixes: 59511cf ("arm64: mm: use XN table mapping attributes for user/kernel mappings") Signed-off-by: Pingfan Liu <[email protected]> Cc: <[email protected]> # 5.13.x Cc: Ard Biesheuvel <[email protected]> Cc: James Morse <[email protected]> Cc: Matthias Brugger <[email protected]> Reviewed-by: Catalin Marinas <[email protected]> Reviewed-by: Pasha Tatashin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent c6d3cd3 commit d3eb70e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/arm64/include/asm/pgalloc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ static inline void __pmd_populate(pmd_t *pmdp, phys_addr_t ptep,
7676
static inline void
7777
pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmdp, pte_t *ptep)
7878
{
79-
VM_BUG_ON(mm != &init_mm);
79+
VM_BUG_ON(mm && mm != &init_mm);
8080
__pmd_populate(pmdp, __pa(ptep), PMD_TYPE_TABLE | PMD_TABLE_UXN);
8181
}
8282

0 commit comments

Comments
 (0)