* [PATCH -fixes] riscv: Do not allow vmap pud mappings for 3-level page table
@ 2023-08-08 13:07 Alexandre Ghiti
2023-08-10 19:50 ` patchwork-bot+linux-riscv
0 siblings, 1 reply; 2+ messages in thread
From: Alexandre Ghiti @ 2023-08-08 13:07 UTC (permalink / raw)
To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
Björn Töpel, linux-riscv, linux-kernel
The vmalloc_fault() path was removed and to avoid syncing the vmalloc PGD
mappings, they are now preallocated. But if the kernel can use a PUD
mapping (which in sv39 is actually a PGD mapping) for large vmalloc
allocation, it will free the current unused preallocated PGD mapping and
install a new leaf one. Since there is no sync anymore, some page tables
lack this new mapping and that triggers a panic.
So only allow PUD mappings for sv48 and sv57.
Fixes: 7d3332be011e ("riscv: mm: Pre-allocate PGD entries for vmalloc/modules area")
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
---
arch/riscv/include/asm/vmalloc.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/riscv/include/asm/vmalloc.h b/arch/riscv/include/asm/vmalloc.h
index 58d3e447f191..924d01b56c9a 100644
--- a/arch/riscv/include/asm/vmalloc.h
+++ b/arch/riscv/include/asm/vmalloc.h
@@ -3,12 +3,14 @@
#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP
+extern bool pgtable_l4_enabled, pgtable_l5_enabled;
+
#define IOREMAP_MAX_ORDER (PUD_SHIFT)
#define arch_vmap_pud_supported arch_vmap_pud_supported
static inline bool arch_vmap_pud_supported(pgprot_t prot)
{
- return true;
+ return pgtable_l4_enabled || pgtable_l5_enabled;
}
#define arch_vmap_pmd_supported arch_vmap_pmd_supported
--
2.39.2
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -fixes] riscv: Do not allow vmap pud mappings for 3-level page table
2023-08-08 13:07 [PATCH -fixes] riscv: Do not allow vmap pud mappings for 3-level page table Alexandre Ghiti
@ 2023-08-10 19:50 ` patchwork-bot+linux-riscv
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+linux-riscv @ 2023-08-10 19:50 UTC (permalink / raw)
To: Alexandre Ghiti
Cc: linux-riscv, paul.walmsley, palmer, aou, bjorn, linux-kernel
Hello:
This patch was applied to riscv/linux.git (fixes)
by Palmer Dabbelt <palmer@rivosinc.com>:
On Tue, 8 Aug 2023 15:07:09 +0200 you wrote:
> The vmalloc_fault() path was removed and to avoid syncing the vmalloc PGD
> mappings, they are now preallocated. But if the kernel can use a PUD
> mapping (which in sv39 is actually a PGD mapping) for large vmalloc
> allocation, it will free the current unused preallocated PGD mapping and
> install a new leaf one. Since there is no sync anymore, some page tables
> lack this new mapping and that triggers a panic.
>
> [...]
Here is the summary with links:
- [-fixes] riscv: Do not allow vmap pud mappings for 3-level page table
https://git.kernel.org/riscv/c/d566bea4a638
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-10 19:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-08 13:07 [PATCH -fixes] riscv: Do not allow vmap pud mappings for 3-level page table Alexandre Ghiti
2023-08-10 19:50 ` patchwork-bot+linux-riscv
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox