]> xenbits.xensource.com Git - xen.git/commitdiff
x86/dom0: fix restoring %cr3 and the mapcache override on PV build error
authorRoger Pau Monné <roger.pau@citrix.com>
Wed, 31 Jul 2024 10:41:02 +0000 (12:41 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 31 Jul 2024 10:41:02 +0000 (12:41 +0200)
One of the error paths in the PV dom0 builder section that runs on the guest
page-tables wasn't restoring the Xen value of %cr3, neither removing the
mapcache override.

Fixes: 079ff2d32c3d ('libelf-loader: introduce elf_load_image')
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/pv/dom0_build.c

index d8043fa58a274f890fd57797a5c9aa3c589c55c4..57e58a02e7074a71cebf103a3d1289af259e2d00 100644 (file)
@@ -825,6 +825,8 @@ int __init dom0_construct_pv(struct domain *d,
     rc = elf_load_binary(&elf);
     if ( rc < 0 )
     {
+        mapcache_override_current(NULL);
+        switch_cr3_cr4(current->arch.cr3, read_cr4());
         printk("Failed to load the kernel binary\n");
         goto out;
     }