From: Andrew Lunn <andrew@lunn.ch>
To: Kees Cook <kees@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
netdev@vger.kernel.org, Andrew Lunn <andrew+netdev@lunn.ch>,
linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH net-next] net: Document sockaddr safety in ARP and routing UAPI structures
Date: Tue, 22 Jul 2025 19:41:01 +0200 [thread overview]
Message-ID: <7577b0f5-2b43-4e5d-89fe-7129c32acb47@lunn.ch> (raw)
In-Reply-To: <20250722165836.work.418-kees@kernel.org>
On Tue, Jul 22, 2025 at 09:58:37AM -0700, Kees Cook wrote:
> Add documentation clarifying that ARP and routing UAPI structures are
> constrained to IPv4-only usage, making them safe for the coming fixed-size
> sockaddr conversion (with the 14-byte struct sockaddr::sa_data). These
> are fine as-is, but their use was non-obvious to me, so I figured they
> could use a little more documentation:
>
> - struct arpreq: ARP protocol is IPv4-only by design
> - struct rtentry: Legacy IPv4 routing API, IPv6 uses different structures
I'm not sure this second statement is strictly true:
https://elixir.bootlin.com/linux/v6.15.7/source/net/appletalk/ddp.c#L918
atrtr_ioctl() ->
atrtr_create()->
struct sockaddr_at *ta = (struct sockaddr_at *)&r->rt_dst;
where:
struct sockaddr_at {
__kernel_sa_family_t sat_family;
__u8 sat_port;
struct atalk_addr sat_addr;
char sat_zero[8];
};
This is not an IPv4 address.
Maybe this does fit with a 14 byte sockaddr::sa_data, so it is not an
issue, but the comment and commit message should be expanded to
explain this. And i only looked at the first SIOCADDRT i came across,
there are many other protocols using this ioctl.
Andrew
prev parent reply other threads:[~2025-07-22 17:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-22 16:58 Kees Cook
2025-07-22 17:41 ` Andrew Lunn [this message]
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=7577b0f5-2b43-4e5d-89fe-7129c32acb47@lunn.ch \
--to=andrew@lunn.ch \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kees@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®