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

[xen staging] tools/libxenguest: Fix max_extd_leaf calculation for legacy restore



commit 5fa174cbf54cc625a023b8e7170e359dd150c072
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Fri Jul 2 18:37:57 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Mon Jul 5 11:30:14 2021 +0100

    tools/libxenguest: Fix max_extd_leaf calculation for legacy restore
    
    0x1c is lower than any value which will actually be observed in
    p->extd.max_leaf, but higher than the logical 9 leaves worth of extended 
data
    on Intel systems, causing x86_cpuid_copy_to_buffer() to fail with -ENOBUFS.
    
    Correct the calculation.
    
    The problem was first noticed in c/s 34990446ca9 "libxl: don't ignore the
    return value from xc_cpuid_apply_policy" but introduced earlier.
    
    Fixes: 111c8c33a8a1 ("x86/cpuid: do not expand max leaves on restore")
    Reported-by: Olaf Hering <olaf@xxxxxxxxx>
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 tools/libs/guest/xg_cpuid_x86.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index e01d657e03..0c9c4fefc1 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -513,7 +513,7 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t 
domid, bool restore,
         /* Clamp maximum leaves to the ones supported on 4.12. */
         p->basic.max_leaf = min(p->basic.max_leaf, 0xdu);
         p->feat.max_subleaf = 0;
-        p->extd.max_leaf = min(p->extd.max_leaf, 0x1cu);
+        p->extd.max_leaf = min(p->extd.max_leaf, 0x8000001c);
     }
 
     if ( featureset )
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

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