]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
elf: Fix tst-cpu-features-cpuinfo for KVM guests on some AMD systems [BZ #28704]
authorAurelien Jarno <aurelien@aurel32.net>
Wed, 15 Dec 2021 22:46:19 +0000 (23:46 +0100)
committerAurelien Jarno <aurelien@aurel32.net>
Fri, 17 Dec 2021 19:35:45 +0000 (20:35 +0100)
On KVM guests running on some AMD systems, the IBRS feature is reported
as a synthetic feature using the Intel feature, while the cpuinfo entry
keeps the same. Handle that by first checking the presence of the Intel
feature on AMD systems.

Fixes bug 28704.

(cherry picked from commit 94058f6cde8b887178885954740ac6c866d25eab)

NEWS
sysdeps/x86/tst-cpu-features-cpuinfo.c

diff --git a/NEWS b/NEWS
index 6864af471ce6ff812551d3680bab27f66c818d1b..1214ec472768eab0d5f60e493ce55f8ad6d7f808 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -24,6 +24,7 @@ The following bugs are resolved with this release:
   [28532] powerpc64[le]: CFI for assembly templated syscalls is incorrect
   [28678] nptl/tst-create1 hangs sporadically
   [28700] "dns [!UNAVAIL=return] files" NSS default for hosts is not useful
+  [28704] elf/tst-cpu-features-cpuinfo fails for KVM guests on some AMD systems
 
 \f
 Version 2.34
index 2d4927f5e52dc260d18efe3988d4ef6a70db21cf..830aaca2ecae971b0e480022f650b531625415f0 100644 (file)
@@ -169,7 +169,14 @@ do_test (int argc, char **argv)
   else if (cpu_features->basic.kind == arch_kind_amd)
     {
       fails += CHECK_PROC (ibpb, AMD_IBPB);
-      fails += CHECK_PROC (ibrs, AMD_IBRS);
+
+      /* The IBRS feature on AMD processors is reported using the Intel feature
+       * on KVM guests (synthetic bit).  In both cases the cpuinfo entry is the
+       * same.  */
+      if (HAS_CPU_FEATURE (IBRS_IBPB))
+        fails += CHECK_PROC (ibrs, IBRS_IBPB);
+      else
+        fails += CHECK_PROC (ibrs, AMD_IBRS);
       fails += CHECK_PROC (stibp, AMD_STIBP);
     }
   fails += CHECK_PROC (ibt, IBT);