[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen stable-4.18] x86/dom0: fix restoring %cr3 and the mapcache override on PV build error



commit a71fac3c48929e96881dbcb1f6eea7692369eb98
Author:     Roger Pau Monné <roger.pau@xxxxxxxxxx>
AuthorDate: Thu Aug 8 13:51:39 2024 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Aug 8 13:51:39 2024 +0200

    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é <roger.pau@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
    master commit: 1fc3f77113dd43b14fa7ef5936dcdba120c0b63f
    master date: 2024-07-31 12:41:02 +0200
---
 xen/arch/x86/pv/dom0_build.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index 5bbed3a36a..64a0b9f598 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -822,6 +822,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;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.