public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] elf: Fix tst-cpu-features-cpuinfo for KVM guests on some AMD systems [BZ #28704]
@ 2021-12-17 19:20 Aurelien Jarno
  0 siblings, 0 replies; only message in thread
From: Aurelien Jarno @ 2021-12-17 19:20 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=94058f6cde8b887178885954740ac6c866d25eab

commit 94058f6cde8b887178885954740ac6c866d25eab
Author: Aurelien Jarno <aurelien@aurel32.net>
Date:   Wed Dec 15 23:46:19 2021 +0100

    elf: Fix tst-cpu-features-cpuinfo for KVM guests on some AMD systems [BZ #28704]
    
    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.

Diff:
---
 sysdeps/x86/tst-cpu-features-cpuinfo.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/sysdeps/x86/tst-cpu-features-cpuinfo.c b/sysdeps/x86/tst-cpu-features-cpuinfo.c
index 2d4927f5e5..830aaca2ec 100644
--- a/sysdeps/x86/tst-cpu-features-cpuinfo.c
+++ b/sysdeps/x86/tst-cpu-features-cpuinfo.c
@@ -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);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-17 19:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-17 19:20 [glibc] elf: Fix tst-cpu-features-cpuinfo for KVM guests on some AMD systems [BZ #28704] Aurelien Jarno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).