Commit a6dd2d93 authored by Samuel Holland's avatar Samuel Holland Committed by Zhao Mengmeng
Browse files

riscv: Fix TASK_SIZE on 64-bit NOMMU

stable inclusion
from stable-v5.10.216
commit 04bf2e5f95c1a52e28a7567a507f926efe31c3b6
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9QRO0
CVE: CVE-2024-35988

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=04bf2e5f95c1a52e28a7567a507f926efe31c3b6



--------------------------------

[ Upstream commit 6065e736f82c817c9a597a31ee67f0ce4628e948 ]

On NOMMU, userspace memory can come from anywhere in physical RAM. The
current definition of TASK_SIZE is wrong if any RAM exists above 4G,
causing spurious failures in the userspace access routines.

Fixes: 6bd33e1e ("riscv: add nommu support")
Fixes: c3f896dc ("mm: switch the test_vmalloc module to use __vmalloc_node")
Signed-off-by: default avatarSamuel Holland <samuel.holland@sifive.com>
Reviewed-by: default avatarJisheng Zhang <jszhang@kernel.org>
Reviewed-by: default avatarBo Gan <ganboing@gmail.com>
Link: https://lore.kernel.org/r/20240227003630.3634533-2-samuel.holland@sifive.com


Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarZhao Mengmeng <zhaomengmeng@kylinos.cn>
parent 8b8d1e83
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -456,7 +456,7 @@ static inline int ptep_clear_flush_young(struct vm_area_struct *vma,
#define PAGE_SHARED		__pgprot(0)
#define PAGE_KERNEL		__pgprot(0)
#define swapper_pg_dir		NULL
#define TASK_SIZE		0xffffffffUL
#define TASK_SIZE		_AC(-1, UL)
#define VMALLOC_START		_AC(0, UL)
#define VMALLOC_END		TASK_SIZE