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>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230801111014.1432679-1-suagrfillet@gmail.com>
Date:   Tue,  1 Aug 2023 19:10:14 +0800
From:   Song Shuai <suagrfillet@...il.com>
To:     paul.walmsley@...ive.com, palmer@...belt.com,
        aou@...s.berkeley.edu, akpm@...ux-foundation.org,
        guoren@...nel.org, alexghiti@...osinc.com,
        sergey.matyukevich@...tacore.com, david@...hat.com,
        wangkefeng.wang@...wei.com, panqinglin2020@...as.ac.cn,
        woodrow.shen@...ive.com
Cc:     linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org,
        Song Shuai <suagrfillet@...il.com>
Subject: [PATCH] riscv: Correct the MODULES_VADDR

As Documentation/riscv/vm-layout.rst describes, the 2G-sized "modules, BPF"
area should lie right before the "kernel" area. But the current definition
of MODULES_VADDR isn't consistent with that, so correct it.

Before this patch, the size of "modules" from print_vm_layout() is not 2G.

[    0.000000]      modules : 0xffffffff2ff2f000 - 0xffffffffae600000 (2022 MB)
[    0.000000]       lowmem : 0xff60000000000000 - 0xff60000040000000 (1024 MB)
[    0.000000]       kernel : 0xffffffffae600000 - 0xffffffffffffffff (1305 MB)

After this patch, the size is 2G.

[    0.000000]      modules : 0xffffffff3a000000 - 0xffffffffba000000 (2048 MB)
[    0.000000]       lowmem : 0xff60000000000000 - 0xff60000040000000 (1024 MB)
[    0.000000]       kernel : 0xffffffffba000000 - 0xffffffffffffffff (1119 MB)

Signed-off-by: Song Shuai <suagrfillet@...il.com>
---
 arch/riscv/include/asm/pgtable.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h
index 75970ee2bda2..7c57e17fc758 100644
--- a/arch/riscv/include/asm/pgtable.h
+++ b/arch/riscv/include/asm/pgtable.h
@@ -53,8 +53,8 @@
 #ifdef CONFIG_64BIT
 /* This is used to define the end of the KASAN shadow region */
 #define MODULES_LOWEST_VADDR	(KERNEL_LINK_ADDR - SZ_2G)
-#define MODULES_VADDR		(PFN_ALIGN((unsigned long)&_end) - SZ_2G)
 #define MODULES_END		(PFN_ALIGN((unsigned long)&_start))
+#define MODULES_VADDR		(MODULES_END - SZ_2G)
 #endif
 
 /*
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ