From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id EE0DDA0562; Tue, 31 Mar 2020 16:08:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 85ACB2C15; Tue, 31 Mar 2020 16:08:55 +0200 (CEST) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by dpdk.org (Postfix) with ESMTP id 2EF6B2BCE for ; Tue, 31 Mar 2020 16:08:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585663733; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=XotZ1EdMTzyfHyK1KvKAaFDKcDKpYX19LG4o+zEtD5A=; b=Hbp+5LBLQIK8M9T/ddQ26Dhl5cFHSjtBjmBtSFf47UGsyQXNB5yObl2MWV+P6mkdg5W36Y EIrYkFFV5a/AC5qAdYcaMZkJg+Z46TKX19mXIQQ+IC8EejGHq8zSWlVTRNaHKnCTDaRz/A AojmJGUpjQ1l1DP4p3U4m15Xa4WZGtY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-5-mmlh0_qKMdGKaLA-qqRyLQ-1; Tue, 31 Mar 2020 10:08:34 -0400 X-MC-Unique: mmlh0_qKMdGKaLA-qqRyLQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 83EDB100DFC0; Tue, 31 Mar 2020 14:08:31 +0000 (UTC) Received: from [10.33.36.65] (unknown [10.33.36.65]) by smtp.corp.redhat.com (Postfix) with ESMTP id 682E7D769F; Tue, 31 Mar 2020 14:08:27 +0000 (UTC) To: Thomas Monjalon Cc: dev@dpdk.org, bruce.richardson@intel.com, ravi1.kumar@amd.com, g.singh@nxp.com, hemant.agrawal@nxp.com, akhil.goyal@nxp.com, johndale@cisco.com, hyonkim@cisco.com, jingjing.wu@intel.com, wenzhuo.lu@intel.com, rmody@marvell.com, shshaikh@marvell.com, matan@mellanox.com, shahafs@mellanox.com, declan.doherty@intel.com, cristian.dumitrescu@intel.com References: <20200325141137.7088-1-ktraynor@redhat.com> <11831469.VsHLxoZxqI@xps> From: Kevin Traynor Autocrypt: addr=ktraynor@redhat.com; keydata= mQINBF2J2awBEADUEPNhgNI+nJNgiTAUcw4YIgVXEoHlsNPyyzG1BEXkWXALy0Y3fNTiw6+r ltWDkF9jzL9kfkecgQ67itGfk1OaBXgSGKuw1PUpxAwX2Bi76LAR6M5OsyGM9TSVVQwARalz hMwRBIZPzPc7or6Pw7jAOJ8SQGJ1Zlp1YJCjrvpe87V1tH/LY8Wnxn/EuoseFmWILAQZAtYS tGjcrAgYn3SPMLR1B0BP5bTBY06vWQjiufH8drenfDnMJAzuBdG1mqjnTqCjULZ3Hunv4xqZ aMnkvL/K5Tj1c12Oe4930EE53LrXIBUltRg5mBudSWHnC7twjH0082HH9f963Z/2UI63SFIT iUvRvAzJYytgy7XnWLQ0+goZBADKYfolOuC0H8VgCaux8u8KFF28Dy+N6TV2KI58jTlyg1Zu l7QwykZpnOkJFiy37Gfbu3YEOzO72cP/S7/A+zvuqkxi63jyEkd+FY99vLt/HN2MUZwRmKDw UPbLkmrs8WU01/POVsqDcfvz7vu2St8hqqTiSIdQGS2zyTKB2/DvPSM3jws3udkIYSuhn+X4 QBiV6lkVZ7DSE6a065gnAauAql+b32Eymy+xnG5jCt1tR+0Cp2VZYCR9OU2gmomUKBDoX/He pSgED01CqYPNjN+TddirwmQX7ep4Dt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+XRIA3Y57b6MO35a3HuzAv7+i5Z0mnDEJO XxXqTOmKYpMIGexzM/PtuA0712sT1abG9tAJ17ao/B7cqMW5IkKkalemFbWfI2unns4Papvo tk9igVqyp6EJDU98z5TJioCVojwK2laDaoIjTJk9YYv3iwCsqPd5feU= Message-ID: <4613d437-5a0c-b664-8435-699c43b63f94@redhat.com> Date: Tue, 31 Mar 2020 15:08:26 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <11831469.VsHLxoZxqI@xps> Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [RFC 0/2] gcc 10 disable stringop-overflow warning X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 25/03/2020 14:18, Thomas Monjalon wrote: > 25/03/2020 15:11, Kevin Traynor: >> This is a blunt way to remove this warning. >> >> Some alternatives are: >> - disable the warning for individual components >> - components rework to statically allocate memory for parts of structs i= mpacted >> >> Maybe there's some other solutions? >=20 > In general, I am against disabling warnings, neither globally nor specifi= cally. Me too. > Is there a way to hide false positives without disabling the warning? >=20 I haven't found one. If anyone has ideas it can be tested on Fedora 32 Beta which is available now, or I can try. >> Impacted components: >> ../drivers/crypto/caam_jr/caam_jr_pvt.h >> ../drivers/crypto/ccp/ccp_crypto.h >> ../drivers/crypto/dpaa_sec/dpaa_sec.h >> ../drivers/crypto/virtio/virtio_cryptodev.h >> ../drivers/net/enic/base/vnic_dev.c >> ../drivers/net/iavf/../../common/iavf/virtchnl.h >> ../drivers/net/ice/base/ice_adminq_cmd.h >> ../drivers/net/mlx4/mlx4_rxtx.c >> ../drivers/net/qede/base/ecore_mcp.c >> ../lib/librte_cryptodev/rte_cryptodev.h >> ../lib/librte_pipeline/rte_table_action.c >> >> Full details in the Bugzilla: >> https://bugs.dpdk.org/show_bug.cgi?id=3D421 >=20 > Would be easier to provide explanations here. > I think we need at least one false positive example. >=20 If we look at the iavf code for rss_key->key: struct virtchnl_rss_key { u16 vsi_id; u16 key_len; u8 key[1]; /* RSS hash key, packed bytes */ ^^^^^^^^^ }; Then in iavf_configure_rss_key() =09len =3D sizeof(*rss_key) + vf->vf_res->rss_key_size - 1; ^^^^^^^^^^^^ =09rss_key =3D rte_zmalloc("rss_key", len, 0); ^^^ extra space beyond key[1] allocated here =09rte_memcpy(rss_key->key, vf->rss_key, vf->vf_res->rss_key_size); =09 ^^^ ^^^^^^^^^^^^ At runtime we have allocated extra space at the end of the struct for key, and the same size used in the malloc is also considered when finding the right branches in the memcpy fns. But the compiler does not know value of size and it simply sees there can be casts of a 1 byte key to 16 or 32 bytes in some branches of the memcpy fns, so gives a warning. e.g. _mm256_storeu_si256((__m256i *)dst, ymm0); That is: Store 256-bits of integer data into memory, where key is dst so leads to: warning: writing 32 bytes into a region of size 1 [-Wstringop-overflow=3D] Full log for warnings on key below. >> Kevin Traynor (2): >> meson: gcc 10 disable stringop-overflow warnings >> mk: gcc 10 disable stringop-overflow warnings >=20 > You don't need to split in 2 patches. >=20 ok, will change if it moves to PATCH. >=20 >=20 In file included from /usr/lib/gcc/x86_64-redhat-linux/10/include/immintrin.h:51, from /usr/lib/gcc/x86_64-redhat-linux/10/include/x86intrin.h:32, from ../lib/librte_eal/common/include/arch/x86/rte_vect.h:30, from ../lib/librte_eal/common/include/arch/x86/rte_memcpy.h:17, from ../lib/librte_net/rte_ether.h:21, from ../drivers/net/iavf/iavf_vchnl.c:18: In function =E2=80=98_mm256_storeu_si256=E2=80=99, inlined from =E2=80=98rte_memcpy_aligned=E2=80=99 at ../lib/librte_eal/common/include/arch/x86/rte_memcpy.h:315:2, inlined from =E2=80=98iavf_configure_rss_key=E2=80=99 at ../lib/librte_eal/common/include/arch/x86/rte_memcpy.h:867:10: /usr/lib/gcc/x86_64-redhat-linux/10/include/avxintrin.h:928:8: warning: writing 32 bytes into a region of size 1 [-Wstringop-overflow=3D] 928 | *__P =3D __A; | ~~~~~^~~~~ In file included from ../drivers/net/iavf/../../common/iavf/iavf_prototype.h:10, from ../drivers/net/iavf/iavf.h:9, from ../drivers/net/iavf/iavf_vchnl.c:22: ../drivers/net/iavf/iavf_vchnl.c: In function =E2=80=98iavf_configure_rss_k= ey=E2=80=99: ../drivers/net/iavf/../../common/iavf/virtchnl.h:508:5: note: at offset 0 to object =E2=80=98key=E2=80=99 with size 1 declared here 508 | u8 key[1]; /* RSS hash key, packed bytes */ | ^~~ In file included from ../lib/librte_eal/common/include/arch/x86/rte_atomic.h:15, from ../drivers/net/iavf/iavf_vchnl.c:16: In function =E2=80=98_mm_storeu_si128=E2=80=99, inlined from =E2=80=98rte_memcpy_aligned=E2=80=99 at ../lib/librte_eal/common/include/arch/x86/rte_memcpy.h:302:2, inlined from =E2=80=98iavf_configure_rss_key=E2=80=99 at ../lib/librte_eal/common/include/arch/x86/rte_memcpy.h:867:10: /usr/lib/gcc/x86_64-redhat-linux/10/include/emmintrin.h:727:8: warning: writing 16 bytes into a region of size 1 [-Wstringop-overflow=3D] 727 | *__P =3D __B; | ~~~~~^~~~~ In file included from ../drivers/net/iavf/../../common/iavf/iavf_prototype.h:10, from ../drivers/net/iavf/iavf.h:9, from ../drivers/net/iavf/iavf_vchnl.c:22: ../drivers/net/iavf/iavf_vchnl.c: In function =E2=80=98iavf_configure_rss_k= ey=E2=80=99: ../drivers/net/iavf/../../common/iavf/virtchnl.h:508:5: note: at offset 0 to object =E2=80=98key=E2=80=99 with size 1 declared here 508 | u8 key[1]; /* RSS hash key, packed bytes */ | ^~~