From: Prabhakar Kushwaha <pkushwaha@marvell.com>
To: Kees Cook <keescook@chromium.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Ariel Elior <aelior@marvell.com>,
Sudarsana Reddy Kalluru <skalluru@marvell.com>,
GR-everest-linux-l2 <GR-everest-linux-l2@marvell.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
Shai Malin <smalin@marvell.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"linux-staging@lists.linux.dev" <linux-staging@lists.linux.dev>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
"linux-kbuild@vger.kernel.org" <linux-kbuild@vger.kernel.org>,
"clang-built-linux@googlegroups.com"
<clang-built-linux@googlegroups.com>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
"linux-hardening@vger.kernel.org"
<linux-hardening@vger.kernel.org>
Subject: RE: [PATCH v2 17/63] bnx2x: Use struct_group() for memcpy() region
Date: Tue, 24 Aug 2021 13:51:44 +0000 [thread overview]
Message-ID: <DM5PR18MB2229B0413C372CC6E49D59A3B2C59@DM5PR18MB2229.namprd18.prod.outlook.com> (raw)
> -----Original Message-----
> From: Kees Cook <keescook@chromium.org>
> Sent: Wednesday, August 18, 2021 11:35 AM
> To: linux-kernel@vger.kernel.org
> Cc: Kees Cook <keescook@chromium.org>; Ariel Elior <aelior@marvell.com>;
> Sudarsana Reddy Kalluru <skalluru@marvell.com>; GR-everest-linux-l2 <GR-
> everest-linux-l2@marvell.com>; David S. Miller <davem@davemloft.net>; Jakub
> Kicinski <kuba@kernel.org>; netdev@vger.kernel.org; Gustavo A. R. Silva
> <gustavoars@kernel.org>; Greg Kroah-Hartman <gregkh@linuxfoundation.org>;
> Andrew Morton <akpm@linux-foundation.org>; linux-wireless@vger.kernel.org;
> dri-devel@lists.freedesktop.org; linux-staging@lists.linux.dev; linux-
> block@vger.kernel.org; linux-kbuild@vger.kernel.org; clang-built-
> linux@googlegroups.com; Rasmus Villemoes <linux@rasmusvillemoes.dk>;
> linux-hardening@vger.kernel.org
> Subject: [PATCH v2 17/63] bnx2x: Use struct_group() for memcpy() region
>
> In preparation for FORTIFY_SOURCE performing compile-time and run-time
> field bounds checking for memcpy(), memmove(), and memset(), avoid
> intentionally writing across neighboring fields.
>
> Use struct_group() in struct nig_stats around members egress_mac_pkt0_lo,
> egress_mac_pkt0_hi, egress_mac_pkt1_lo, and egress_mac_pkt1_hi (and the
> respective members in struct bnx2x_eth_stats), so they can be referenced
> together. This will allow memcpy() and sizeof() to more easily reason
> about sizes, improve readability, and avoid future warnings about writing
> beyond the end of struct bnx2x_eth_stats's rx_stat_ifhcinbadoctets_hi.
>
> "pahole" shows no size nor member offset changes to either struct.
> "objdump -d" shows no meaningful object code changes (i.e. only source
> line number induced differences and optimizations).
>
> Additionally adds BUILD_BUG_ON() to compare the separate struct group
> sizes.
>
> Cc: Ariel Elior <aelior@marvell.com>
> Cc: Sudarsana Kalluru <skalluru@marvell.com>
> Cc: GR-everest-linux-l2@marvell.com
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Jakub Kicinski <kuba@kernel.org>
> Cc: netdev@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
Reviewed-by: Prabhakar Kushwaha <pkushwaha@marvell.com>
next reply other threads:[~2021-08-24 13:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-24 13:51 Prabhakar Kushwaha [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-08-18 6:04 [PATCH v2 00/63] Introduce strict memcpy() bounds checking Kees Cook
2021-08-18 6:04 ` [PATCH v2 17/63] bnx2x: Use struct_group() for memcpy() region Kees Cook
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=DM5PR18MB2229B0413C372CC6E49D59A3B2C59@DM5PR18MB2229.namprd18.prod.outlook.com \
--to=pkushwaha@marvell.com \
--cc=GR-everest-linux-l2@marvell.com \
--cc=aelior@marvell.com \
--cc=akpm@linux-foundation.org \
--cc=clang-built-linux@googlegroups.com \
--cc=davem@davemloft.net \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=gustavoars@kernel.org \
--cc=keescook@chromium.org \
--cc=kuba@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=linux-wireless@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=netdev@vger.kernel.org \
--cc=skalluru@marvell.com \
--cc=smalin@marvell.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).