Article View: linux.kernel.netdev
Article #10602Re: [PATCH net-next v4 6/7] ipv6: convert do_ipv6_getsockopt() to sockopt_t
From: Stanislav Fomichev
Date: Tue, 03 Nov 2026 19:32
Date: Tue, 03 Nov 2026 19:32
39 lines
13415 bytes
13415 bytes
On 11/03, Breno Leitao wrote: > Convert the SOL_IPV6 switch and its two remaining sockptr_t leaves, > ip6_mroute_getsockopt() and ipv6_getsockopt_sticky(). > > ipv6_getsockopt() writes optlen back unconditionally, and > sol_ipv6_sockopt() builds the sockopt_t with sockptr_to_sockopt() and > stores optlen back as well. > > ipv6_getsockopt() cannot use sockopt_init_user() as its IPv4 sibling > does, since that rejects a negative optlen and this level answers it as > 4. See "ipv6: treat a negative optlen as 4 in do_ipv6_getsockopt()". > > Instead ipv6_getsockopt() applies that rule itself and builds the > sockopt_t with the new sockopt_set_user(), which sockopt_init_user() now > shares. MRT6_* is the exception: it has always rejected a negative > optlen, and still does. > > The write-back also happens before the netfilter fallback, so an > unwritable optlen turns any error into -EFAULT and skips the fallback. > Likewise optlen is now read before the MRT6_* dispatch, so an unreadable > or negative one wins over -EOPNOTSUPP. > > For the other options, a failing call that passed a negative optlen now > leaves it as 4 instead of untouched, and the netfilter fallback sees that > 4 too. > > IPV6_2292PKTOPTIONS and the sticky options used to return the result of > copy_to_sockptr(), the number of bytes not copied, so an unwritable > optlen made getsockopt() return 4. They now return -EFAULT. > > The extra code in sol_ipv6_sockopt() will go away when > sol_ipv6_sockopt() receives sockopt_t, but, for now, it only moves the > leaves. > > Acked-by: Ido Schimmel <idosch@nvidia.com> > Signed-off-by: Breno Leitao <leitao@debian.org> Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Technical Details
Message-ID:
<auo21mFFkL2zH2MT@devvm16445.scu0.facebook.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-355933-linux-kernel-netdev=dewy.ruReferences:
<20261103-sockopt_expand_out_v2-v4-0-2d36da923578@debian.org> <20261103-sockopt_expand_out_v2-v4-6-2d36da923578@debian.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-355933-linux-kernel-netdev=dewy.ru
From: sdf.kernel@gmail.com (Stanislav Fomichev)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v4 6/7] ipv6: convert do_ipv6_getsockopt() to
sockopt_t
Date: Tue, 3 Nov 2026 11:32:44 -0800
Organization: Usenet Network
Message-ID: <auo21mFFkL2zH2MT@devvm16445.scu0.facebook.com>
References: <20261103-sockopt_expand_out_v2-v4-0-2d36da923578@debian.org>
<20261103-sockopt_expand_out_v2-v4-6-2d36da923578@debian.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Injection-Info: usenet.network;
logging-data="3243978"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Cwk+GHTRUOe5BoWkHKeHkwST1qc= sha256:quRmt5MmwIIGwy0yXBBpostTuvkZqjKG8c7N/+fcVCY=
sha1:Fqbj+hugNR6EEWqTXUF8c5/+OmA= sha256:tVzGetzNTkXTNwrFfSfrotn0WDd0VtdFZ9755BLF5mg=
Content-Disposition: inline
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id A979B1129DE; Tue, 3 Nov 2026 22:34:22 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id O5htQTdSGJ03;
Tue, 3 Nov 2026 22:34:20 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-355933-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mail.dewy.ru (Postfix) with ESMTPS id 4491F1129B3; Tue, 3 Nov 2026 22:34:12 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by tor.lore.kernel.org (Postfix) with ESMTP id A7CCD28FA8; Tue, 3 Nov 2026 19:33:32 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1793734406;
b=kt8l8IS18aLUvzb+W8NDBYv3Pwv5dmz1wqvADNTRwRj4cjTRPDD9oZb8gsMrEy04A5v/
b/zW2azZvC16o9tkxfVaPAjtCAruh1qQZkes1OfCaujbP2leM57OALGqXzydsvt3LF600
EdLsOp8GnG/HhvICBIZ9hkRryrWtBhfLvjr1Ax4DZpXL/Ij07FWXQqwTKNeYMC91GIE2y
62clbBZb7H8WkB2cdH1F4heEN246qb4Lly0sVZcUfX1/RLDlNn7LL38i/a/TjgPkO0o5t
feSJ3XdvPQY+ro2ZDYhnJFwLP0hBlm+QoZdRm2tqNLpUJXTmDT8zA/xlQ3Qq4y6pgrA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793734406;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
X-Gm-Gg:X-Received:Received:Date:From:To:Cc:Subject:Message-ID:
References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type:
Content-Disposition:In-Reply-To;
bh=15RJraNkt4G9imlgns/mzHRKCrlWGmqvpmr2tllrIBY=;
b=1yJ5U11veZf8GoxaezBIsYRIiczTZgvotR/bf3VgAQtdUvj0Qo1/vtoBZIROxVfcJqvR
AXpUOjgt4pfuwZL6jCxd+Cdo7CwNUmIaqEZnXJmmOD81bMYrsw0JY5lQhebJcgy6uGCHU
ZgkCNyPxXMkWjlGjs7rh0uEezGIrOsp9IJQ8e13PadvpjQ+Ho/p8EJTyJDQtWZumrG5GK
7hc/T3mOu5/6IN7LQV+0+HhLF8ElWFtoABS9klXhtmHjNpxWuBTEnaCBkat3e8tMc9t4P
b/zNJaTaxmnOhrw5PxQc3w8SNJ+f1rmFihGdnV/olXhmmXvXFyHmLYTJddw5+HKuLxA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=wV02aST+;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 1AA55606D820;
Tue, 3 Nov 2026 19:33:26 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=wV02aST+
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.229.8
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1793734405;
b=gLe6BE8Mx0jqWTXYNyr8b0GBtvnQicX1Ty0P2O6iUIefqZK1Z0jEXRrxfKxshGa3XaEx
qUtetIU7/p735+VmDx+LAExGpG0hpU2lQNFtY6vHAJEtqWCmWwUV6WWj/mIKiM8EeHnze
dqiMAUGWcpOaIK4epDECaNWEmK0Dic6mi83Dk+V2ZFpIwOkZQkGBRFO7fFi2WFQZtMcGD
jmBGtO65sKVNahNvg1UBS7++kET7u3kK5WeauWUGdg0fxmcBMnuDFk4fxB0xVaV0dsmLy
t9ZM7E3zsNyICMUC32ihRu5k9ft4RwiVw9mov73WzBoaZuCu1rOsfpTj/udVo6W7LBA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793734405;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To;
bh=15RJraNkt4G9imlgns/mzHRKCrlWGmqvpmr2tllrIBY=;
b=KasRXpAll46cRW2EKfbDjiclJIl+LOAhfbYhHJoHxEaeSPm+q5QIaa1uEyJSnKBihVaw
4Ati9gpoZ+ZGkgAvPo8mS0d+T+NXdZaLLdY6gCm9AX0lrH30pbnSQMtmUS+2mi/tw5PM6
sHnebTqWVfd0v6c7VbQQ/D7UIyLm52iJPFkLcEHhYWTnvtB1otp4iI84BLT6RbyMnojr6
EaH2SXLgbx3T5bVAc9+bQeigIb41NMPzMyrIvRvmb3Jn3nYb4oXFAYZLFUlqkmA01E7wE
gQUlOsDP6HfuMF1Z2OcUD0a7JFs6Yek5TV2jgrTQcpVINSua2BQFD/1ppqPpdwoVwdg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=wV02aST+;
arc=none smtp.remote-ip=74.125.229.8
X-Received: from mail-dy2-f8.google.com (mail-dy2-f8.google.com [74.125.229.8])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 98381606D80A
for <netdev@vger.kernel.org>; Tue, 3 Nov 2026 19:33:24 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 98381606D80A
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-dy2-f8.google.com with SMTP id 5a478bee46e88-36a6ce64b95so1346308eec.1
for <netdev@vger.kernel.org>; Tue, 03 Nov 2026 11:33:24 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1793734404; x=1794339204; 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=15RJraNkt4G9imlgns/mzHRKCrlWGmqvpmr2tllrIBY=;
b=wV02aST+LnFuxBvV4bpYViFOafiBAI18U+cmy1u7/O8lBLjisx42g0f7VqlS7j6qWi
fzZdeH2AtavuBEinDao1789fn1sBOJr3JreFzWRfnqHWIS3MgMOBh+kCvVGAjlYJmkjp
QgfY3aVLjOO27toy9Do9VDZOcgWKHeLvUXUJt9+QhVCfgJ8B4pweYXZ1VRn20ajx22In
N4rtQdS+6e7xZeweLYsATcu/Kuk3bCtZw5GIGxJKzMd7MVsi0m5Otgs1Yi62uqzl21Oz
tUF7KmL6ccLm27Tb19Y4GTxqG+Oyz0lqfrSYtZL/ELJWt//50dFblUY+uRpGpFRRPic4
ZEOg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1793734404; x=1794339204;
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=15RJraNkt4G9imlgns/mzHRKCrlWGmqvpmr2tllrIBY=;
b=f5lwTy+WOhf5OS2pk7Zinze10/idIYUB8j/qtcea1kiAx6yhwlofU+SxY9IMGOCKcN
v705oO6lDfVZDNMn0Mz9JxqXvm6B+QkKf6qMIqSyJD4YMmRhANLIRC2DFlA7X0kDVKhW
8q758WkHFU7lRWCkHwL+/EHjB8N1QNmlrcLP7S+hWIzsHcmrml8rmAiapJnVqJjZ7Gaw
8D5nodYPWHZwi3oLgTwCMhBg0TcpSWvN0LsXc4rW6za6L0Ogc55E3LDh1Y9SaNdW+pqx
OaJgeoblpcSxRmp93ARAl51jHpcLhnRB5rJAcHv40d4ypREln25KJOj1fFBDH9gg1nKT
UjUQ==
X-Forwarded-Encrypted: i=1; AKwUvBx84wTdUnQhkN2W+ZPYgwN1kfcksPVorxGE/1jqYEwv/8BJUNKMWAS0z3h0NvzyTXbVzhxm5CA=@vger.kernel.org
X-Gm-Message-State: APuU4Z89KH2p5wryen72vEDUIjWYpf42D5ZhIBdt3QK3qmXAAngfSjQJ
yB3wasWBCoY+ESfJPQFLO8kEzc+O5wqnromITt/fsHfWYUZHrF6Kj/j/
X-Gm-Gg: AYBFou0Y7hqUW/H1XbgD6okyZ2LL2EV2pnOW8QSUsdE0PtYdWhFAhxhfzkMk+Ev7Atb
aCCc/6sCzbQGYkP+MGgMul5I38gXot2XTY1oS1RL45GL7zCZblygJAeHl0d3U2ov54APYxw9P9E
u7+fFzPQC56iGSIQTFAoSr4SoVe1qORgTgH1PoomrdlnjB/YldR2PbyIIDf6wtyiPt/xH2MEEUj
BJ/D8g1EX65H6pqQJRinqFKMmhz8UJ3EGsW//cUzyNUR3TLYkT5hxWAs7vIMQn+CZzWic/W1Lh5
EIlcTnQWkFXaQJ1JvkuQIG7uSUlwKsKntQUQ3cpVRau2/U4bCz8CrK6vz9T5Trv/t2OHzEl8bpu
rEhgSoYAm7IX4NfAHaWgN/nlt5z+0wV47nB6Np76+wHsD53Q/nWS73C0WpJnULnu2YZPSLb4jcT
8GkqRsCx1XbznNgJVhbqOTqdbahvRIba6lXwPotbu5Kohol0t/Dv+N9KKjLQEGcjCSAVBkdFzip
fIbtx626LBeTjWgcZdShdvWhQEDW4cHOXDeMsJsYrWzPdpvJWaldOUe8F3lMNeEat6QFvWsV8kZ
sD66hbCwsdReY7OZO3QSFw==
X-Received: by 2002:a05:7301:103:b0:36c:9af3:22eb with SMTP id 5a478bee46e88-36c9af32cb0mr2691600eec.34.1793734403660;
Tue, 03 Nov 2026 11:33:23 -0800 (PST)
X-Received: from localhost ([2a03:2880:9ff:6b::])
by smtp.gmail.com with ESMTPSA id 5a478bee46e88-36ca3785430sm527244eec.3.2026.11.03.11.33.22
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Tue, 03 Nov 2026 11:33:23 -0800 (PST)
X-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>, linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, david.laight.linux@gmail.com,
kernel-team@meta.com
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261103-sockopt_expand_out_v2-v4-6-2d36da923578@debian.org>