netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kees Cook <kees@kernel.org>
To: Gal Pressman <gal@nvidia.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>, David Ahern <dsahern@kernel.org>,
	Simon Horman <horms@kernel.org>,
	linux-hardening@vger.kernel.org, Cosmin Ratiu <cratiu@nvidia.com>
Subject: Re: [PATCH net-next] net: Silence false field-spanning write warning in ip_tunnel_info_opts_set() memcpy
Date: Thu, 9 Jan 2025 08:52:50 -0800	[thread overview]
Message-ID: <202501090852.AA32AF8BD@keescook> (raw)
In-Reply-To: <35791134-6c58-4cc4-a6ab-2965dce9cd4b@nvidia.com>

On Thu, Jan 09, 2025 at 11:00:24AM +0200, Gal Pressman wrote:
> On 08/01/2025 1:28, Kees Cook wrote:
> >> This resolves the following warning:
> >>  memcpy: detected field-spanning write (size 8) of single field "_Generic(info, const struct ip_tunnel_info * : ((const void *)((info) + 1)), struct ip_tunnel_info * : ((void *)((info) + 1)) )" at include/net/ip_tunnels.h:662 (size 0)
> > 
> > Then you can drop this macro and just use: info->options
> > 
> > Looks like you'd need to do it for all the types in struct metadata_dst, but at least you could stop hiding it from the compiler. :)
> 
> Can you please explain the "do it for all the types in struct
> metadata_dst" part?
> AFAICT, struct ip_tunnel_info is the only one that's extendable, I don't
> think others need to be modified.

Ah, sorry. If that's the case, then just ip_tunnel_info is fine. (Is all
of the metadata_dst trailing byte allocation logic just for
ip_tunnel_info?)

-Kees

-- 
Kees Cook

  reply	other threads:[~2025-01-09 16:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-07 16:55 [PATCH net-next] net: Silence false field-spanning write warning in ip_tunnel_info_opts_set() memcpy Gal Pressman
2025-01-07 23:28 ` Kees Cook
2025-01-08  6:56   ` Gal Pressman
2025-01-09  9:00   ` Gal Pressman
2025-01-09 16:52     ` Kees Cook [this message]
2025-01-12  6:37       ` Gal Pressman

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=202501090852.AA32AF8BD@keescook \
    --to=kees@kernel.org \
    --cc=cratiu@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=gal@nvidia.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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).