Netdev List
 help / color / mirror / Atom feed
From: Stanislav Fomichev <sdf.kernel@gmail.com>
To: Breno Leitao <leitao@debian.org>
Cc: David Ahern <dsahern@kernel.org>,
	Ido Schimmel <idosch@nvidia.com>,
	 "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	 Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	 Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	 Andrii Nakryiko <andrii@kernel.org>,
	Eduard Zingerman <eddyz87@gmail.com>,
	 Kumar Kartikeya Dwivedi <memxor@gmail.com>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	 Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	 Jiri Olsa <jolsa@kernel.org>,
	Emil Tsalapatis <emil@etsalapatis.com>,
	 Ihor Solodrai <ihor.solodrai@linux.dev>,
	John Fastabend <john.fastabend@gmail.com>,
	 Stanislav Fomichev <sdf@fomichev.me>,
	Shuah Khan <shuah@kernel.org>,
	 Eric Dumazet <edumazet@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	 bpf@vger.kernel.org, linux-kselftest@vger.kernel.org,
	david.laight.linux@gmail.com,  kernel-team@meta.com
Subject: Re: [PATCH net-next v2 0/7] ipv4,ipv6: convert the getsockopt switches to sockopt_t
Date: Wed, 14 Oct 2026 11:04:24 -0700	[thread overview]
Message-ID: <as_EIAJpsA1nWKU4@devvm7509.cco0.facebook.com> (raw)
In-Reply-To: <20261009-sockopt_expand_out_v2-v2-0-8ac08c469ecb@debian.org>

On 10/09, Breno Leitao wrote:
> This series continues the migration to sockopt_t, as described in [1].
> do_ip_getsockopt() and do_ipv6_getsockopt() are the last two switches
> still taking a sockptr_t pair, and everything they forward to now takes
> a sockopt_t, so convert them both.
> 
> Patch 1 settles what a negative optlen means on SOL_IPV6 before the
> conversion makes it matter. do_ip_getsockopt() rejects it, but
> do_ipv6_getsockopt() never has, and the int options answer it as 4.
> Treat it as 4, as David Laight suggested, instead of failing callers
> that rely on it.
> 
> Patch 2 fixes a latent bug in sockopt_expand_out() [2] itself: it caps
> the expansion at INT_MAX, but iov_iter_revert() refuses to unroll past
> the smaller MAX_RW_COUNT.
> 
> MCAST_MSFILTER has to move before the switches above it. It is the last
> option with the quirk sockopt_expand_out() was added for [2]: optlen only
> covers the fixed part, and the real reply size comes from the gf_numsrc
> field inside it. Patches 3 and 4 convert it on both families, and store
> the reply length only after the final copy succeeds, so a copy failure
> can't report a changed optlen.
> 
> Patches 5 and 6 convert the switches themselves. Each wrapper keeps its
> __user prototype and builds the sockopt_t, so the proto layer is
> untouched. ipv6_getsockopt() cannot use sockopt_init_user(), which
> rejects a negative optlen, so patch 6 moves the clamp of patch 1 up
> there and builds the sockopt_t after it.
> 
> Patch 7 grows the selftest with an ip and an ipv6 fixture, pinning the
> returned length, errno and reply bytes.
> 
> The temporary sockptr_t-to-sockopt_t glue can go away once the higher
> level callers take sockopt_t too. For now, the series keeps the proto
> callbacks unchanged and converts only the leaf helpers.
> 
> Link: https://lore.kernel.org/all/20260401-getsockopt-v2-0-611df6771aff@debian.org/ [1]
> Link: https://lore.kernel.org/all/20260914-getsockopt_phase6-v2-0-e48befc9602e@debian.org/ [2]
> 
> To: David Ahern <dsahern@kernel.org>
> To: Ido Schimmel <idosch@nvidia.com>
> To: David S. Miller <davem@davemloft.net>
> To: Eric Dumazet <edumazet@google.com>
> To: Jakub Kicinski <kuba@kernel.org>
> To: Paolo Abeni <pabeni@redhat.com>
> To: Simon Horman <horms@kernel.org>
> To: Alexei Starovoitov <ast@kernel.org>
> To: Daniel Borkmann <daniel@iogearbox.net>
> To: Andrii Nakryiko <andrii@kernel.org>
> To: Eduard Zingerman <eddyz87@gmail.com>
> To: Kumar Kartikeya Dwivedi <memxor@gmail.com>
> To: Martin KaFai Lau <martin.lau@linux.dev>
> To: Song Liu <song@kernel.org>
> To: Yonghong Song <yonghong.song@linux.dev>
> To: Jiri Olsa <jolsa@kernel.org>
> To: Emil Tsalapatis <emil@etsalapatis.com>
> To: Ihor Solodrai <ihor.solodrai@linux.dev>
> To: John Fastabend <john.fastabend@gmail.com>
> To: Stanislav Fomichev <sdf@fomichev.me>
> To: Shuah Khan <shuah@kernel.org>
> Cc: linux-kernel@vger.kernel.org
> Cc: netdev@vger.kernel.org
> Cc: bpf@vger.kernel.org
> Cc: linux-kselftest@vger.kernel.org
> To: Stanislav Fomichev <sdf@fomichev.me>
> Cc: david.laight.linux@gmail.com
> 
> Signed-off-by: Breno Leitao <leitao@debian.org>
> ---
> Changes in v2:
> - Treat a negative optlen as 4 instead of rejecting it with
>   -EINVAL as v1 did, per David Laight and Stanislav Fomichev. 
> - Fix sashiko findings
> - Link to v1: https://patch.msgid.link/20260925-sockopt_expand_out_v2-v1-0-c3ef2e3bb5c0@debian.org

Acked-by: Stanislav Fomichev <sdf@fomichev.me>

      parent reply	other threads:[~2026-10-14 18:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-09  8:53 [PATCH net-next v2 0/7] ipv4,ipv6: convert the getsockopt switches to sockopt_t Breno Leitao
2026-10-09  8:53 ` [PATCH net-next v2 1/7] ipv6: treat a negative optlen as 4 in do_ipv6_getsockopt() Breno Leitao
2026-10-10  9:12   ` netdev-bot+sashiko
2026-10-09  8:53 ` [PATCH net-next v2 2/7] net: cap sockopt_expand_out() at MAX_RW_COUNT Breno Leitao
2026-10-10  9:12   ` netdev-bot+sashiko
2026-10-09  8:53 ` [PATCH net-next v2 3/7] ipv6: mcast: convert ip6_mc_msfget() to sockopt_t Breno Leitao
2026-10-09  8:53 ` [PATCH net-next v2 4/7] ipv4: igmp: convert ip_mc_gsfget() " Breno Leitao
2026-10-09  8:53 ` [PATCH net-next v2 5/7] ipv4: convert do_ip_getsockopt() " Breno Leitao
2026-10-10  9:12   ` netdev-bot+sashiko
2026-10-09  8:53 ` [PATCH net-next v2 6/7] ipv6: convert do_ipv6_getsockopt() " Breno Leitao
2026-10-10  9:12   ` netdev-bot+sashiko
2026-10-09  8:53 ` [PATCH net-next v2 7/7] selftests: net: getsockopt_iter: cover ip and ipv6 Breno Leitao
2026-10-10  9:12   ` netdev-bot+sashiko
2026-10-14 18:04 ` Stanislav Fomichev [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=as_EIAJpsA1nWKU4@devvm7509.cco0.facebook.com \
    --to=sdf.kernel@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=david.laight.linux@gmail.com \
    --cc=dsahern@kernel.org \
    --cc=eddyz87@gmail.com \
    --cc=edumazet@kernel.org \
    --cc=emil@etsalapatis.com \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=kuba@kernel.org \
    --cc=leitao@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /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