From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from hall.aurel32.net (hall.aurel32.net [IPv6:2001:bc8:30d7:100::1]) by sourceware.org (Postfix) with ESMTPS id C23333858407 for ; Fri, 17 Dec 2021 19:36:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C23333858407 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=aurel32.net Authentication-Results: sourceware.org; spf=none smtp.mailfrom=aurel32.net DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=aurel32.net ; s=202004.hall; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date: Subject:Cc:To:From:Content-Type:From:Reply-To:Subject:Content-ID: Content-Description:In-Reply-To:References:X-Debbugs-Cc; bh=Fo4w/OofB7LNe6aah8eUsWyJ/hsbDLfVMnhMJBMkn0Q=; b=daa6aPC+t80UCdFnL2XrUTgajO oStbGe5OilCWMg4ANw8cuYGyjKifwZLr+Rk961I9Ra2UP8CQzrAlqe+E54JjmerOZsvhiu0XqksuT sObh6gOv2JdllNI67yj/4LY2oRuT+5qqJzQoh6yex6WnSktBRYBVX1r6UvMama+HMGf5GW6kPtUlU LeF4Qigf/kqwOG0u7MsRl54hbyZMCJO8pIa+4QjsWmUi8KmVoCHFb0Lz49BmpsauOufV5lJV7BQaK nhtVZMTvNZ23Ze+YIQZGYCV178lPpK+45V03L0VxfW8Na88P3r6BOWxG9UwA9K6OL1JPSY5EhEgSY hIlU7+ng==; Received: from [2a01:e34:ec5d:a741:8a4c:7c4e:dc4c:1787] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1myJ1a-0008LI-2P; Fri, 17 Dec 2021 20:36:14 +0100 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.95) (envelope-from ) id 1myJ1Y-002SfX-TX; Fri, 17 Dec 2021 20:36:12 +0100 From: Aurelien Jarno To: libc-stable@sourceware.org Cc: Aurelien Jarno Subject: [PATCH] elf: Fix tst-cpu-features-cpuinfo for KVM guests on some AMD systems [BZ #28704] Date: Fri, 17 Dec 2021 20:36:09 +0100 Message-Id: <20211217193609.586850-1-aurelien@aurel32.net> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-stable@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-stable mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Dec 2021 19:36:18 -0000 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 | 1 + sysdeps/x86/tst-cpu-features-cpuinfo.c | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 6864af471c..1214ec4727 100644 --- 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 Version 2.34 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); -- 2.33.0