From 41dd38baf2c79b85215a84621170422e090c05ad Mon Sep 17 00:00:00 2001 From: Chaohong guo Date: Thu, 17 Jan 2019 13:56:22 +0800 Subject: [PATCH] HV: init_paging() wrongly calcuate the size of hypervisor when relocation is enabled, the calcuation of HV size in init_paging routine is not right. As a result, it doesn't enable NX bit for many pages which don't belong to hypervisor text section. Tracked-On: #2349 Signed-off-by: Chaohong guo Reviewed-by: Zide Chen --- hypervisor/arch/x86/mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hypervisor/arch/x86/mmu.c b/hypervisor/arch/x86/mmu.c index 646fdd2f6..6014a83b5 100644 --- a/hypervisor/arch/x86/mmu.c +++ b/hypervisor/arch/x86/mmu.c @@ -290,7 +290,7 @@ void init_paging(void) CONFIG_HV_RAM_SIZE + (((hv_hpa & (PDE_SIZE - 1UL)) != 0UL) ? PDE_SIZE : 0UL), PAGE_CACHE_WB, PAGE_CACHE_MASK | PAGE_USER, &ppt_mem_ops, MR_MODIFY); - size = ((uint64_t)&ld_text_end - CONFIG_HV_RAM_START); + size = ((uint64_t)&ld_text_end - hv_hpa); text_end = hv_hpa + size; /* * remove 'NX' bit for pages that contain hv code section, as by default XD bit is set for