From: Kevin Traynor <ktraynor@redhat.com>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: dev@dpdk.org, thomas@monjalon.net, Gavin.Hu@arm.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
Subject: Re: [dpdk-dev] [PATCH v2] x86/eal: gcc 10 ignore stringop-overflow warnings
Date: Fri, 17 Apr 2020 13:40:02 +0100 [thread overview]
Message-ID: <5b5cd849-f9d7-78a6-3b61-9a7533b3bdbd@redhat.com> (raw)
In-Reply-To: <20200417093358.GB1701@bricha3-MOBL.ger.corp.intel.com>
On 17/04/2020 10:33, Bruce Richardson wrote:
> On Thu, Apr 16, 2020 at 07:45:49PM +0100, Kevin Traynor wrote:
>> stringop-overflow warns when it sees a possible overflow
>> in a string operation.
>>
>> In the rte_memcpy functions different branches are taken
>> depending on the size. stringop-overflow is raised for the
>> branches in the function where it sees the static size of the
>> src could be overflowed.
>>
>> However, in reality a correct size argument and in some cases
>> dynamic allocation would ensure that this does not happen.
>>
>> For example, in the case below for key, the correct path will be
>> chosen in rte_memcpy_generic at runtime based on the size argument
>> but as some paths in the function could lead to a cast to 32 bytes
>> a warning is raised.
>>
>> In function ‘_mm256_storeu_si256’,
>> inlined from ‘rte_memcpy_generic’
>> at ../lib/librte_eal/common/include/arch/x86/rte_memcpy.h:315:2,
>> inlined from ‘iavf_configure_rss_key’
>> at ../lib/librte_eal/common/include/arch/x86/rte_memcpy.h:869: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=]
>> 928 | *__P = __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 ‘iavf_configure_rss_key’:
>>
>> ../drivers/net/iavf/../../common/iavf/virtchnl.h:508:5:
>> note: at offset 0 to object ‘key’ with size 1 declared here
>> 508 | u8 key[1]; /* RSS hash key, packed bytes */
>> | ^~~
>>
>> Ignore the stringop-overflow warnings for rte_memcpy.h functions.
>>
>> Bugzilla ID: 394
>> Bugzilla ID: 421
>>
>> Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
>>
>> ---
>>
>> v2: Change from a global disable to just disabling for x86/rte_memcpy.h
>> ---
>> lib/librte_eal/x86/include/rte_memcpy.h | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/lib/librte_eal/x86/include/rte_memcpy.h b/lib/librte_eal/x86/include/rte_memcpy.h
>> index ba44c4a32..283fb79ba 100644
>> --- a/lib/librte_eal/x86/include/rte_memcpy.h
>> +++ b/lib/librte_eal/x86/include/rte_memcpy.h
>> @@ -23,4 +23,8 @@ extern "C" {
>> #endif
>>
>> +#if defined(RTE_TOOLCHAIN_GCC) && (GCC_VERSION >= 100000)
>> +#pragma GCC diagnostic ignored "-Wstringop-overflow"
>> +#endif
>> +
>> /**
>> * Copy bytes from one location to another. The locations must not overlap.
>
> Does this permanently need to be disabled for all compilation units
> including rte_memcpy.h, or can it be used with a push/pop set of pragmas to
> only disable for the required functions?
>
Good point about compilation units. I'm not sure it makes sense to do
per function as the only ones that won't need it are the mov64/128/256
that are just wrappers for mov16/32 etc. Every function in rte_memcpy.h
that uses intrinsics and the aligned/generic will likely need it, which
is almost all of them.
With the GCC version conditional wrappers along with multiple
implementations depending on CPUFLAGS per function becomes messy and
harder to test. Considering that adding push/pop for the file only
increases the scope to those wrapper functions, I think it is better to
push/pop for the file.
next prev parent reply other threads:[~2020-04-17 12:40 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-25 14:11 [dpdk-dev] [RFC 0/2] gcc 10 disable stringop-overflow warning Kevin Traynor
2020-03-25 14:11 ` [dpdk-dev] [RFC 1/2] meson: gcc 10 disable stringop-overflow warnings Kevin Traynor
2020-03-25 14:11 ` [dpdk-dev] [RFC 2/2] mk: " Kevin Traynor
2020-03-25 14:18 ` [dpdk-dev] [RFC 0/2] gcc 10 disable stringop-overflow warning Thomas Monjalon
2020-03-31 14:08 ` Kevin Traynor
2020-03-31 14:53 ` Stephen Hemminger
2020-04-01 11:33 ` Kevin Traynor
2020-04-07 16:27 ` [dpdk-dev] [PATCH] build: gcc 10 disable stringop-overflow warnings Kevin Traynor
2020-04-10 10:51 ` Kevin Traynor
2020-04-10 13:23 ` Bruce Richardson
2020-04-16 18:43 ` Kevin Traynor
2020-04-16 18:45 ` [dpdk-dev] [PATCH v2] x86/eal: gcc 10 ignore " Kevin Traynor
2020-04-17 9:33 ` Bruce Richardson
2020-04-17 10:13 ` Thomas Monjalon
2020-04-17 14:50 ` Kevin Traynor
2020-04-17 12:40 ` Kevin Traynor [this message]
2020-04-17 15:43 ` [dpdk-dev] [PATCH v3] " Kevin Traynor
2020-05-06 9:20 ` David Marchand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5b5cd849-f9d7-78a6-3b61-9a7533b3bdbd@redhat.com \
--to=ktraynor@redhat.com \
--cc=Gavin.Hu@arm.com \
--cc=akhil.goyal@nxp.com \
--cc=bruce.richardson@intel.com \
--cc=cristian.dumitrescu@intel.com \
--cc=declan.doherty@intel.com \
--cc=dev@dpdk.org \
--cc=g.singh@nxp.com \
--cc=hemant.agrawal@nxp.com \
--cc=hyonkim@cisco.com \
--cc=jingjing.wu@intel.com \
--cc=johndale@cisco.com \
--cc=matan@mellanox.com \
--cc=ravi1.kumar@amd.com \
--cc=rmody@marvell.com \
--cc=shahafs@mellanox.com \
--cc=shshaikh@marvell.com \
--cc=thomas@monjalon.net \
--cc=wenzhuo.lu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).