[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211129181720.719044173@linuxfoundation.org>
Date: Mon, 29 Nov 2021 19:17:27 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Pingfan Liu <kernelfans@...il.com>,
Ard Biesheuvel <ardb@...nel.org>,
James Morse <james.morse@....com>,
Matthias Brugger <mbrugger@...e.com>,
Catalin Marinas <catalin.marinas@....com>,
Pasha Tatashin <pasha.tatashin@...een.com>,
Will Deacon <will@...nel.org>
Subject: [PATCH 5.15 053/179] arm64: mm: Fix VM_BUG_ON(mm != &init_mm) for trans_pgd
From: Pingfan Liu <kernelfans@...il.com>
commit d3eb70ead6474ec16f976fcacf10a7a890a95bd3 upstream.
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 5de59884ac0e ("arm64:
trans_pgd: pass NULL instead of init_mm to *_populate functions"), which
replaced &init_mm with NULL and commit 59511cfd08f3 ("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: 59511cfd08f3 ("arm64: mm: use XN table mapping attributes for user/kernel mappings")
Signed-off-by: Pingfan Liu <kernelfans@...il.com>
Cc: <stable@...r.kernel.org> # 5.13.x
Cc: Ard Biesheuvel <ardb@...nel.org>
Cc: James Morse <james.morse@....com>
Cc: Matthias Brugger <mbrugger@...e.com>
Reviewed-by: Catalin Marinas <catalin.marinas@....com>
Reviewed-by: Pasha Tatashin <pasha.tatashin@...een.com>
Link: https://lore.kernel.org/r/20211112052214.9086-1-kernelfans@gmail.com
Signed-off-by: Will Deacon <will@...nel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
arch/arm64/include/asm/pgalloc.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/arch/arm64/include/asm/pgalloc.h
+++ b/arch/arm64/include/asm/pgalloc.h
@@ -76,7 +76,7 @@ static inline void __pmd_populate(pmd_t
static inline void
pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmdp, pte_t *ptep)
{
- VM_BUG_ON(mm != &init_mm);
+ VM_BUG_ON(mm && mm != &init_mm);
__pmd_populate(pmdp, __pa(ptep), PMD_TYPE_TABLE | PMD_TABLE_UXN);
}
Powered by blists - more mailing lists