From: Roger Pau Monné Date: Thu, 8 Aug 2024 11:55:53 +0000 (+0200) Subject: x86/dom0: fix restoring %cr3 and the mapcache override on PV build error X-Git-Tag: RELEASE-4.17.5~8 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=82e70687b8f53310775b65ce63259288b6b3e45b;p=xen.git x86/dom0: fix restoring %cr3 and the mapcache override on PV build error 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é Reviewed-by: Jan Beulich master commit: 1fc3f77113dd43b14fa7ef5936dcdba120c0b63f master date: 2024-07-31 12:41:02 +0200 --- diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c index a62f0fa2ef..3e74cf4ea2 100644 --- a/xen/arch/x86/pv/dom0_build.c +++ b/xen/arch/x86/pv/dom0_build.c @@ -821,6 +821,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; }