lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Sat, 27 Mar 2021 21:48:01 +0200
From:   Vitaly Wool <vitaly.wool@...sulko.com>
To:     linux-riscv@...ts.infradead.org
Cc:     linux-kernel@...r.kernel.org, linux-mm@...ck.org,
        Palmer Dabbelt <palmerdabbelt@...gle.com>,
        Vitaly Wool <vitaly.wool@...sulko.com>,
        kernel test robot <lkp@...el.com>
Subject: [PATCH] riscv: XIP: fix build for rv32

32-bit RISC-V uses folded page tables by default, so we should
follow that in the XIP-specific part of init too.

Signed-off-by: Vitaly Wool <vitaly.wool@...sulko.com>
Reported-by: kernel test robot <lkp@...el.com>
---
 arch/riscv/mm/init.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index fe583c2aa5a2..8c0eeaae67a3 100644
--- a/arch/riscv/mm/init.c
+++ b/arch/riscv/mm/init.c
@@ -481,6 +481,7 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa)
 #endif
 
 #ifdef CONFIG_XIP_KERNEL
+#ifndef __PAGETABLE_PMD_FOLDED
 	create_pgd_mapping(trampoline_pg_dir, XIP_VIRT_ADDR_START,
 			   (uintptr_t)xip_pmd, PGDIR_SIZE, PAGE_TABLE);
 	for (va = XIP_VIRT_ADDR_START;
@@ -493,7 +494,16 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa)
 
 	create_pgd_mapping(early_pg_dir, XIP_VIRT_ADDR_START,
 			   (uintptr_t)xip_pmd, PGDIR_SIZE, PAGE_TABLE);
-#endif
+#else
+	for (va = XIP_VIRT_ADDR_START;
+	     va < XIP_VIRT_ADDR_START + xiprom_sz;
+	     va += map_size) {
+		create_pgd_mapping(early_pg_dir, va,
+				   xiprom + (va - XIP_VIRT_ADDR_START),
+				   map_size, PAGE_KERNEL_EXEC);
+	}
+#endif /* __PAGETABLE_PMD_FOLDED */
+#endif /* CONFIG_XIP_KERNEL */
 
 	/*
 	 * Setup early PGD covering entire kernel which will allows
-- 
2.29.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ