Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7286807rwi; Mon, 24 Oct 2022 12:23:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5tC/Gw48jFVI1q789ogBRPU9wupoD4XKCOyfOV+i1o6nHq0whgHa99luSR+SwSUT9JennL X-Received: by 2002:a17:907:728c:b0:78e:2856:7fed with SMTP id dt12-20020a170907728c00b0078e28567fedmr29054545ejc.2.1666639387684; Mon, 24 Oct 2022 12:23:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666639387; cv=none; d=google.com; s=arc-20160816; b=vF7EhFyCDXb4S9zvpU5zg0rHIdY0wAWxLhYXElVW0XLXCWK86ytUjLBYgUKUmvwjnN dZIzxChLMzfTI1SHBz0qb1ArEnJsCJ/H6cEs+vAHxjqseGNKG+1Ic+ZSuriAmkoLNegV CR7fAyoPbTJaPUb88NlsvcmUAE2CG5e6EIr0v7iv7RVSgHc/k/yiFcz048nTU/5Pf0NO KORKce1t6xDMtWfm+F9kYLXDMplhxZnWh8hJTxkHgFV+VtL+WKeKBszphVBLPLMHN1Tu Do9QoVl5pP+XnBSRnqrLjmXeNPmGehXlmTUdMn3FKPuq4g1rmg8CqtK/cxIyqOByAFRe L+CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=FBc3Tkr+2aOsRx61bVNKVAbPjPnN73P3pwHGOCmesHA=; b=lhXe2JXVzCU1nTIX3YZApInNyygOkYnkySbuEgaiK1mmmdNfRMox3sK1ESBjP5z3Yd FW3eCYFKOI0x5Ns/0HR7Z0RspOtjZqOguxYc2ceSfTMVvpJ+WMSOu21eMA+ZOeKrhv/P daI22w7k57I8lUdaiM56TKtWL7EtHEL82fRQQMdkn9lBTnQ+xZpK7bDJgttsJBvoGcup HnWXWvvJfKxFc9FBBiM1mZ+iLUnv+4pSg1EU0BMJUGt8GP6SJ0f7nl6K3SDM3/CSY8fw 2wjrbIhdc6gCgI3avXWtpFvXJeAcprPONnx2THiLrbesxNKdrEOWE7kMmxKCE6uJ+z8S kcxA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hw8-20020a170907a0c800b007a8beb3aa4csi583793ejc.872.2022.10.24.12.22.42; Mon, 24 Oct 2022 12:23:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233104AbiJXTLP (ORCPT + 99 others); Mon, 24 Oct 2022 15:11:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230481AbiJXTKu (ORCPT ); Mon, 24 Oct 2022 15:10:50 -0400 Received: from jabberwock.ucw.cz (jabberwock.ucw.cz [46.255.230.98]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3141C6744B; Mon, 24 Oct 2022 10:49:39 -0700 (PDT) Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 23CFA1C0040; Mon, 24 Oct 2022 19:41:28 +0200 (CEST) Date: Mon, 24 Oct 2022 19:41:27 +0200 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, 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: Re: [PATCH 4.19 174/229] x86/entry: Work around Clang __bdos() bug Message-ID: <20221024174127.GC25198@duo.ucw.cz> References: <20221024112959.085534368@linuxfoundation.org> <20221024113004.718917343@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="KN5l+BnMqAQyZLvT" Content-Disposition: inline In-Reply-To: <20221024113004.718917343@linuxfoundation.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NEUTRAL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --KN5l+BnMqAQyZLvT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > From: Kees Cook >=20 > [ Upstream commit 3e1730842f142add55dc658929221521a9ea62b6 ] >=20 > 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: >=20 > ../include/linux/fortify-string.h:309:4: warning: call to __write_overflo= w_field declared with 'warn > ing' attribute: detected write beyond size of field (1st parameter); mayb= e use struct_group()? [-Wat > tribute-warning] > __write_overflow_field(p_size_field, size); > ^ >=20 > which was isolated to the memset() call in xen_load_idt(). >=20 > Note that this looks very much like another bug that was worked around: > https://github.com/ClangBuiltLinux/linux/issues/1592 We don't have CONFIG_UBSAN_BOUNDS in 4.19, so maybe we don't need this one? Best regards, Pavel =09 > +++ b/arch/x86/xen/enlighten_pv.c > @@ -752,6 +752,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); > @@ -761,7 +762,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 >=20 >=20 --=20 DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany --KN5l+BnMqAQyZLvT Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCY1bORwAKCRAw5/Bqldv6 8ncbAJ9IUs8w/7hTCthPKhWGY8O+PVF6zACglL4ohEfyPjuKQnuAt70ZrDtKMoA= =ONRr -----END PGP SIGNATURE----- --KN5l+BnMqAQyZLvT--