提交 56afc45b 编写于 作者: Z Zhen Lei 提交者: Zheng Zengkai

arm64: kdump: Properly handle the 4G boundary

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: e26eee76 ("arm64: kdump: Don't force page-level mappings for memory above 4G")
Signed-off-by: NZhen Lei <thunder.leizhen@huawei.com>
Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 4f0eedb8
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册