From: Zhen Lei thunder.leizhen@huawei.com
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I5P8OD CVE: NA
-------------------------------------------------------------------------
The value of 'end' for both for_each_mem_range() and __map_memblock() is 'start + size', not 'start + size - 1'. So if the end value of a memory block is 4G, then: if (eflags && (end >= SZ_4G)) { //end=SZ_4G if (start < SZ_4G) { ... ... start = SZ_4G; } }
//Now, start=end=SZ_4G, all [start,...) will be mapped __map_memblock(pgdp, start, end, ..xxx..);
Fixes: e26eee769978 ("arm64: kdump: Don't force page-level mappings for memory above 4G") Signed-off-by: Zhen Lei thunder.leizhen@huawei.com Reviewed-by: Kefeng Wang wangkefeng.wang@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- arch/arm64/mm/mmu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index e76765354040..a31f2124705e 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -523,13 +523,13 @@ static void __init map_mem(pgd_t *pgdp) break;
#ifdef CONFIG_KEXEC_CORE - if (eflags && (end >= SZ_4G)) { + if (eflags && (end > SZ_4G)) { /* * The memory block cross the 4G boundary. * Forcibly use page-level mappings for memory under 4G. */ if (start < SZ_4G) { - __map_memblock(pgdp, start, SZ_4G - 1, + __map_memblock(pgdp, start, SZ_4G, pgprot_tagged(PAGE_KERNEL), flags | eflags); start = SZ_4G; }