From nobody Sun May 19 16:31:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass header.i=@amazon.de; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=amazon.de ARC-Seal: i=1; a=rsa-sha256; t=1644593214; cv=none; d=zohomail.com; s=zohoarc; b=GnyXXKqXozveXoejTLZnVM8nI1ZMVvHFNOVs3CQVNDRf4Zoq+iPnIX022+/umtlSwiK/IdscV/NsoZCfcKF+VNfcVs/8+5huSbZpYSAMLZo3ykONCYz+tWX5pwf6Klq6A0Ww6lnEA0cS1uCqkWDzONzbpwj395uFV1TeMAD6zGU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644593214; h=Content-Type:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=TT+qw2jJTN+YB51Wk3Q538yOVcAVuWNCzpcJJfEh1m0=; b=PnJgkPv8y2Qm4N7EjmWDumtbw7yLy//bBub7M+dsQYV4PBW+GTIbZyBQa+EEjI8yATIAZiFRrv0kg8LZ5Ujpkg9G1nmRNMlbdHSPOKlWQz+qxQCTk9BU2DqAUV057KBUk+ljwym63KcEsiOm7oqXDjPpsQtg0u2e3AxZQUB7Cbw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@amazon.de; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1644593214905610.1087858234523; Fri, 11 Feb 2022 07:26:54 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.270550.464872 (Exim 4.92) (envelope-from ) id 1nIXof-0001j5-I3; Fri, 11 Feb 2022 15:26:33 +0000 Received: by outflank-mailman (output) from mailman id 270550.464872; Fri, 11 Feb 2022 15:26:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nIXof-0001hm-Bo; Fri, 11 Feb 2022 15:26:33 +0000 Received: by outflank-mailman (input) for mailman id 270550; Fri, 11 Feb 2022 15:26:31 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nIXoc-0001fo-WA for xen-devel@lists.xenproject.org; Fri, 11 Feb 2022 15:26:31 +0000 Received: from smtp-fw-9103.amazon.com (smtp-fw-9103.amazon.com [207.171.188.200]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id faa00943-8b4e-11ec-8f75-fffcc8bd4f1a; Fri, 11 Feb 2022 16:26:29 +0100 (CET) Received: from pdx4-co-svc-p1-lb2-vlan2.amazon.com (HELO email-inbound-relay-pdx-2a-92ba9394.us-west-2.amazon.com) ([10.25.36.210]) by smtp-border-fw-9103.sea19.amazon.com with ESMTP; 11 Feb 2022 15:26:12 +0000 Received: from EX13D02EUB001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan3.pdx.amazon.com [10.236.137.198]) by email-inbound-relay-pdx-2a-92ba9394.us-west-2.amazon.com (Postfix) with ESMTPS id 1811141887; Fri, 11 Feb 2022 15:26:12 +0000 (UTC) Received: from EX13MTAUEE002.ant.amazon.com (10.43.62.24) by EX13D02EUB001.ant.amazon.com (10.43.166.150) with Microsoft SMTP Server (TLS) id 15.0.1497.28; Fri, 11 Feb 2022 15:26:09 +0000 Received: from u6fc700a6f3c650.ant.amazon.com (10.1.212.14) by mail-relay.amazon.com (10.43.62.224) with Microsoft SMTP Server id 15.0.1497.28 via Frontend Transport; Fri, 11 Feb 2022 15:26:08 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Inumbo-ID: faa00943-8b4e-11ec-8f75-fffcc8bd4f1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1644593189; x=1676129189; h=from:to:cc:subject:date:message-id:mime-version; bh=TT+qw2jJTN+YB51Wk3Q538yOVcAVuWNCzpcJJfEh1m0=; b=ft1j6k2N2FSCn8qZVPC5uxad4fk713vSA1IWAp5hhEhjQZCCgsAdNp9I GYcASWFiFgLu/1pjR5hHSma5JKtQtyxnCfnAFMfsEX/g3L1kXPUqbVNlg pij95dQt4HyGJy4orQ7fUHmtg1qIP4xDc29EMAcgiRGAkuTqrVPzWV/PZ g=; X-IronPort-AV: E=Sophos;i="5.88,361,1635206400"; d="scan'208";a="991414143" From: Norbert Manthey To: CC: Norbert Manthey , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu Subject: [PATCH CPU v2] cpuid: initialize cpuinfo with boot_cpu_data Date: Fri, 11 Feb 2022 16:25:59 +0100 Message-ID: <20220211152559.27862-1-nmanthey@amazon.de> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Precedence: Bulk X-ZohoMail-DKIM: pass (identity @amazon.de) X-ZM-MESSAGEID: 1644593216673100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When re-identifying CPU data, we might use uninitialized data when checking for the cache line property to adapt the cache alignment. The data that depends on this uninitialized read is currently not forwarded. To avoid problems in the future, initialize the data cpuinfo structure before re-identifying the CPU again. The trace to hit the uninitialized read reported by Coverity is: bool recheck_cpu_features(unsigned int cpu) ... struct cpuinfo_x86 c; ... identify_cpu(&c); void identify_cpu(struct cpuinfo_x86 *c) ... generic_identify(c) static void generic_identify(struct cpuinfo_x86 *c) ... if (this_cpu->c_early_init) this_cpu->c_early_init(c); // which is early_init_intel static void early_init_intel(struct cpuinfo_x86 *c) ... if (c->x86 =3D=3D 15 && c->x86_cache_alignment =3D=3D 64) c->x86_cache_alignment =3D 128; This bug was discovered and resolved using Coverity Static Analysis Security Testing (SAST) by Synopsys, Inc. Signed-off-by: Norbert Manthey Acked-by: Jan Beulich --- xen/arch/x86/cpuid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c --- a/xen/arch/x86/cpuid.c +++ b/xen/arch/x86/cpuid.c @@ -609,7 +609,7 @@ void __init init_guest_cpuid(void) bool recheck_cpu_features(unsigned int cpu) { bool okay =3D true; - struct cpuinfo_x86 c; + struct cpuinfo_x86 c =3D {0}; const struct cpuinfo_x86 *bsp =3D &boot_cpu_data; unsigned int i; =20 --=20 2.17.1 Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B Sitz: Berlin Ust-ID: DE 289 237 879