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

[Xen-changelog] [xen staging] x86/pv: Fix error handling in dom0_construct_pv()



commit 8207314d985f89ca6920066d1054be33c8419e78
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Mon May 20 10:14:01 2019 +0000
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Thu May 23 15:59:00 2019 +0100

    x86/pv: Fix error handling in dom0_construct_pv()
    
    One path in dom0_construct_pv() returns -1 unlike all other error paths.
    Switch it to returning -EINVAL.
    
    This was last modified by c/s c84481fb XSA-55, but the bug predates that
    series.  However, this patch did (for no obvious reason) introduce a
    bifurcated tail to the function with two subtly different elf_check_broken()
    clauses.
    
    As the elf_check_broken() is just a warning and doesn't influence the 
further
    boot, fold the exit paths together and use a single clause.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/arch/x86/pv/dom0_build.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index cef2d42254..064a10ed1f 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -735,7 +735,7 @@ int __init dom0_construct_pv(struct domain *d,
             mapcache_override_current(NULL);
             switch_cr3_cr4(current->arch.cr3, read_cr4());
             printk("Invalid HYPERCALL_PAGE field in ELF notes.\n");
-            rc = -1;
+            rc = -EINVAL;
             goto out;
         }
         hypercall_page_initialise(
@@ -903,21 +903,15 @@ int __init dom0_construct_pv(struct domain *d,
     rc = dom0_setup_permissions(d);
     BUG_ON(rc != 0);
 
-    if ( elf_check_broken(&elf) )
-        printk(" Xen warning: dom0 kernel broken ELF: %s\n",
-               elf_check_broken(&elf));
-
     if ( d->domain_id == hardware_domid )
         iommu_hwdom_init(d);
 
     v->is_initialised = 1;
     clear_bit(_VPF_down, &v->pause_flags);
 
-    return 0;
-
 out:
     if ( elf_check_broken(&elf) )
-        printk(" Xen dom0 kernel broken ELF: %s\n",
+        printk(XENLOG_WARNING "Dom0 kernel broken ELF: %s\n",
                elf_check_broken(&elf));
 
     return rc;
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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