From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pz2-f7.google.com (mail-pz2-f7.google.com [74.125.228.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 23D5D3E5EF8 for ; Wed, 14 Oct 2026 18:04:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792001078; cv=none; b=qI4gJksMPqEYmkKlJrE57bOc9II2oSvCu3EAvjXI88duy9j7nFQsHmtu2Dzkv19D3DXMMOFoI6GfNI+7yGhNOWRgUzehofC3En7vrcGiE3yJfBPV7b2gclumMbns+SANGYJwS+Fur2NrKDR3dIiZQetrtnLXV1t8O97tm5Wuy3c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792001078; c=relaxed/simple; bh=byT7Oi0cLhQwYSkFtKGiGpgd82T4uT9+1PBWVi3fXck=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=c+LtLGyJrSJ49rQeHc8E5C5MQDLqGffxpA40898ws0zkF6mueMx0r0c5VvQ6xV+M5ZVfZGrFLoJiWEVtYtx4y5vDh/i9G/6QSX/h+LHSmLCWKES2Yy+5E4jp4Rzu8DAKv1oshidY2YNcWDC/hT1PknueiEXFItSUzilP1muP664= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nnd/SA38; arc=none smtp.client-ip=74.125.228.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nnd/SA38" Received: by mail-pz2-f7.google.com with SMTP id 41be03b00d2f7-cc53988d9f3so1752598a12.0 for ; Wed, 14 Oct 2026 11:04:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1792001076; x=1792605876; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=Wq8CsgNnCjhuDOhxvAaqmUytJ+XS+cCMriLGrdCHHLo=; b=nnd/SA38bm89Ivzv0ASOgGzzkdq+hLveZgclJ3DEmPRvXo1Wg/D1YxOmPVL3wXVBVJ egdZCD6DBy6RA95gnqJQP/JbeAwGIsEhqJJVUW/FaG4RAoOHBgIZmw8CgZ6Ga3dvPDB/ T/1FNGlC6N1EIXCIY9h9oCc94t9BADftyB0PJZTNkbpjIJCwjCFtSZWqW159VIUo3IkP c2Yxr+UZohi7TaUpsFE9OgCktLRbk2m6i33/mFyyatpfc6MAVGLUn1xusutvGE6zBL3r wtZhfo6B9eK0gx9AH8kJF1D7IQXvzxM+iEvnKgTAAQAShLXzSeyY7sH3VJ2hyGOUub61 PKRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792001076; x=1792605876; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Wq8CsgNnCjhuDOhxvAaqmUytJ+XS+cCMriLGrdCHHLo=; b=DAag86piTZa4BfZPw0kMIw+9cr6boXDMo6EBbJoCqO1JSbKWopdCkG/aPX7nD+VR33 JxbSvsaiVKXHVlij7r+eSphtv6w8K8YwjaNyIRGygR70cgQBAXdRAT0Msf0b7vPKg1nF oTxwBWIOtDPThOYc58n19QyW7GLzqglIqW2LemwqJnSZr2gjIWMUm1AA6f9P0Ps/8K40 gVOEbBj7f7IpW2j+YK/suogpMFDBxeQT3u0sdT7tMR4gp2w8v008ic8MiCoxaGz2l2W4 /Plwfu8naOdQHyobqMZ7xLRFPsWe+9scZvRfpwAHTZ9N4kPxpsU3dPnDfcfZ9twSS/X1 FL4g== X-Forwarded-Encrypted: i=1; AKwUvBxx3c9oHKP7R2/mIUjseANtgd944+UIKR9bxarMuQcINC63D9Wlj4AxQ6DIUhL05FCieLgNFFA=@vger.kernel.org X-Gm-Message-State: AFq9FYLykhMy5wtM3Y2wSl6nlTPlKs4831SCJ8Fdy9Bijdt5Hyp0uL2j frQxI6FN2Ly43SSwJ0IJGQwg9SwiT6Uv+5xzDDXKm/PxSWr32Rg2inN7 X-Gm-Gg: AYBFou3JBgQtPBef9a/tj1LosDTt9HWfLljk/M6RMRKatr4VqKdReUQ5PK+QpI7ht7R HVQKxbcgQIh2Rp6Eji91LevWsF39ba6TI1LbWUVE9dZn6l4PRLplKBQkjVVJuqGZ5gztvxDNQun hWBfW/L4a3qcaf+JcaR6qUobzTpKprA1hHgNHD+KtDg6kDT2XMDHpXp8GvKMoG10oJANa/1MPLu RXEm7Jo5Rn6/mGVsnz1BQXCdpqr2b06KDHtU0/sN7WXHK6qUfV9XcBBE9HoCS8g40QOGsyaldtf skjqok8AED9AsgcNBY2CAg6Ij/bRwuFIa755pbqu4uPFLUZC4zCcAC6R7RbCGEzFSBFnZG43j9S B/8F60XxSynGF0klD6vGoahdewQonMgDECtks0scoQyam9KcIP2utaHBEana/zlU5jNz1v537+C USyhn3IQDQ1wLYUUpPsebPLBGwnMT7+RV9DED6kiRieAzIBPBK/dItsh0k34FT0xa5 X-Received: by 2002:a05:6a00:3385:b0:886:c8d1:632f with SMTP id d2e1a72fcca58-897c82b072amr13779945b3a.42.1792001076265; Wed, 14 Oct 2026 11:04:36 -0700 (PDT) Received: from localhost ([2a03:2880:2ff:56::]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-89d804e391dsm1439578b3a.39.2026.10.14.11.04.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Oct 2026 11:04:35 -0700 (PDT) Date: Wed, 14 Oct 2026 11:04:24 -0700 From: Stanislav Fomichev To: Breno Leitao Cc: David Ahern , Ido Schimmel , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Simon Horman , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Eduard Zingerman , Kumar Kartikeya Dwivedi , Martin KaFai Lau , Song Liu , Yonghong Song , Jiri Olsa , Emil Tsalapatis , Ihor Solodrai , John Fastabend , Stanislav Fomichev , Shuah Khan , Eric Dumazet , 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 Message-ID: References: <20261009-sockopt_expand_out_v2-v2-0-8ac08c469ecb@debian.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline 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 > To: Ido Schimmel > To: David S. Miller > To: Eric Dumazet > To: Jakub Kicinski > To: Paolo Abeni > To: Simon Horman > To: Alexei Starovoitov > To: Daniel Borkmann > To: Andrii Nakryiko > To: Eduard Zingerman > To: Kumar Kartikeya Dwivedi > To: Martin KaFai Lau > To: Song Liu > To: Yonghong Song > To: Jiri Olsa > To: Emil Tsalapatis > To: Ihor Solodrai > To: John Fastabend > To: Stanislav Fomichev > To: Shuah Khan > 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 > Cc: david.laight.linux@gmail.com > > Signed-off-by: Breno Leitao > --- > 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