From nobody Fri Dec 19 18:43:07 2025 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; 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=none dis=none) header.from=linuxfoundation.org ARC-Seal: i=1; a=rsa-sha256; t=1666425652; cv=none; d=zohomail.com; s=zohoarc; b=EWFTm36CV+l2ZSmBz5An06C1V/S7zwPLFYXMJ3Ofzaed59pBra+udFY3lvTT/UaTvdX6KYRWSiiJGXBzR3rV/dvrKd/TAYkdOYURFWl+/xBT0cuNoCiVULKH/NrQIfHBt9JRwzlxstb+q6XlQMMv0s/jgidPreuMMJ+F70xOZUI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666425652; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vuA9a6t3fOnapTOTnGUH/1TrbgIT7put1zz010HiY+U=; b=QrMfEBhTmbOSvFi6X3dBbLSsbyvh8MYj53UuFX8mAWw+CyjrPEALNFa0aHlJ+cWPmr/dl64TrpnA4qc5z3V1/J9aXMJ4Uhcarvb3mm/1AAAncoMFkJgMo6S8H9+za/dwpCBUtYjRAOdJrAhOxJiK+zsMt0wkP5iIkJBv549u36s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1666425652966300.88592895831584; Sat, 22 Oct 2022 01:00:52 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.428139.677987 (Exim 4.92) (envelope-from ) id 1om9QN-000427-Ey; Sat, 22 Oct 2022 08:00:07 +0000 Received: by outflank-mailman (output) from mailman id 428139.677987; Sat, 22 Oct 2022 08:00:07 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1om9QN-00041X-8f; Sat, 22 Oct 2022 08:00:07 +0000 Received: by outflank-mailman (input) for mailman id 428139; Sat, 22 Oct 2022 08:00:05 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1om9QL-0003f1-Fg for xen-devel@lists.xenproject.org; Sat, 22 Oct 2022 08:00:05 +0000 Received: from ams.source.kernel.org (ams.source.kernel.org [2604:1380:4601:e00::1]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 88fa207d-51df-11ed-91b5-6bf2151ebd3b; Sat, 22 Oct 2022 10:00:04 +0200 (CEST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 35238B82E2C; Sat, 22 Oct 2022 08:00:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC2C4C4347C; Sat, 22 Oct 2022 08:00:00 +0000 (UTC) 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 Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 88fa207d-51df-11ed-91b5-6bf2151ebd3b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425601; bh=WOtLqPtfTzhG6xYKuXLzf9SXFlrNx350kTurMW1iEWw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0LCuBtS9J8zCXCeiOIcEq/bt0xKzDvb9q5k5RZDel+NFT7DxWETPCOGBFEeWGNQbB BcSD/RJmPEGyLRmCHk2tKei1unDmZGIXa1q1N777LKlHX1rLy8eb9Yp4LyrYaR5d8K R6ZC++I1FW9vPHa1RNkkc1LBMCSVprNghSbFulcY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juergen Gross , Boris Ostrovsky , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , xen-devel@lists.xenproject.org, Kees Cook , Sasha Levin Subject: [PATCH 5.19 553/717] x86/entry: Work around Clang __bdos() bug Date: Sat, 22 Oct 2022 09:27:12 +0200 Message-Id: <20221022072522.841821313@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @linuxfoundation.org) X-ZM-MESSAGEID: 1666425654884100001 Content-Type: text/plain; charset="utf-8" From: Kees Cook [ Upstream commit 3e1730842f142add55dc658929221521a9ea62b6 ] Clang produces a false positive when building with CONFIG_FORTIFY_SOURCE=3Dy and CONFIG_UBSAN_BOUNDS=3Dy when operating on an array with a dynamic offset. Work around this by using a direct assignment of an empty instance. Avoids this warning: ../include/linux/fortify-string.h:309:4: warning: call to __write_overflow_= field declared with 'warn ing' attribute: detected write beyond size of field (1st parameter); maybe = use struct_group()? [-Wat tribute-warning] __write_overflow_field(p_size_field, size); ^ which was isolated to the memset() call in xen_load_idt(). Note that this looks very much like another bug that was worked around: https://github.com/ClangBuiltLinux/linux/issues/1592 Cc: Juergen Gross Cc: Boris Ostrovsky Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: x86@kernel.org Cc: "H. Peter Anvin" Cc: xen-devel@lists.xenproject.org Reviewed-by: Boris Ostrovsky Link: https://lore.kernel.org/lkml/41527d69-e8ab-3f86-ff37-6b298c01d5bc@ora= cle.com Signed-off-by: Kees Cook Signed-off-by: Sasha Levin --- arch/x86/xen/enlighten_pv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c index 0ed2e487a693..9b1a58dda935 100644 --- a/arch/x86/xen/enlighten_pv.c +++ b/arch/x86/xen/enlighten_pv.c @@ -765,6 +765,7 @@ static void xen_load_idt(const struct desc_ptr *desc) { static DEFINE_SPINLOCK(lock); static struct trap_info traps[257]; + static const struct trap_info zero =3D { }; unsigned out; =20 trace_xen_cpu_load_idt(desc); @@ -774,7 +775,7 @@ static void xen_load_idt(const struct desc_ptr *desc) memcpy(this_cpu_ptr(&idt_desc), desc, sizeof(idt_desc)); =20 out =3D xen_convert_trap_info(desc, traps, false); - memset(&traps[out], 0, sizeof(traps[0])); + traps[out] =3D zero; =20 xen_mc_flush(); if (HYPERVISOR_set_trap_table(traps)) --=20 2.35.1