x86/boot: Map the trampoline as read-only
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 6 Jan 2020 13:36:30 +0000 (13:36 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 8 Jan 2020 18:47:54 +0000 (18:47 +0000)
c/s ec92fcd1d08, which caused the trampoline GDT Access bits to be set,
removed the final writes which occurred between enabling paging and switching
to the high mappings.  There don't plausibly need to be any memory writes in
few instructions is takes to perform this transition.

As a consequence, we can remove the RWX mapping of the trampoline.  It is RX
via its identity mapping below 1M, and RW via the directmap.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/x86_64/mm.c

index 8ea09ecc30ebb134f98608d9cf411bb3fb125a71..b7ce833ffcba9d10c22ccbe4feea4bfe235823d0 100644 (file)
@@ -699,7 +699,7 @@ void __init zap_low_mappings(void)
     /* Replace with mapping of the boot trampoline only. */
     map_pages_to_xen(trampoline_phys, maddr_to_mfn(trampoline_phys),
                      PFN_UP(trampoline_end - trampoline_start),
-                     __PAGE_HYPERVISOR);
+                     __PAGE_HYPERVISOR_RX);
 }
 
 int setup_compat_arg_xlat(struct vcpu *v)