Mailing List Archive

[xen staging] x86/boot: Drop incorrect mapping at l2_xenmap[0]
commit a15b143a5f1c20dc6893bc3e50873e308ef61d87
Author: Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Nov 29 16:09:08 2021 +0000
Commit: Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 2 20:02:55 2021 +0000

x86/boot: Drop incorrect mapping at l2_xenmap[0]

It has been 4 years since the default load address changed from 1M to 2M, and
_stext ceased residing in l2_xenmap[0]. We should not be inserting an unused
mapping.

To ensure we don't create mappings accidentally, loop from 0 and obey
_PAGE_PRESENT on all entries.

Fixes: 7ed93f3a0dff ("x86: change default load address from 1 MiB to 2 MiB")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
xen/arch/x86/setup.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index da47cdea14..6f24104842 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1279,16 +1279,12 @@ void __init noreturn __start_xen(unsigned long mbi_p)

/* The only data mappings to be relocated are in the Xen area. */
pl2e = __va(__pa(l2_xenmap));
- /*
- * Undo the temporary-hooking of the l1_directmap. __2M_text_start
- * is contained in this PTE.
- */
+
BUG_ON(using_2M_mapping() &&
l2_table_offset((unsigned long)_erodata) ==
l2_table_offset((unsigned long)_stext));
- *pl2e++ = l2e_from_pfn(xen_phys_start >> PAGE_SHIFT,
- PAGE_HYPERVISOR_RX | _PAGE_PSE);
- for ( i = 1; i < L2_PAGETABLE_ENTRIES; i++, pl2e++ )
+
+ for ( i = 0; i < L2_PAGETABLE_ENTRIES; i++, pl2e++ )
{
unsigned int flags;

--
generated by git-patchbot for /home/xen/git/xen.git#staging