Article View: linux.kernel.netdev
Article #10802Re: [PATCH net-next v4 3/7] ipv6: mcast: convert ip6_mc_msfget() to sockopt_t
From: Jiayuan Chen
Date: Wed, 04 Nov 2026 06:07
Date: Wed, 04 Nov 2026 06:07
34 lines
9826 bytes
9826 bytes
On 11/3/26 7:01 PM, Breno Leitao wrote: > MCAST_MSFILTER reads its reply through ip6_mc_msfget(), reached from > do_ipv6_getsockopt() and from nowhere else. Convert it, and build the > sockopt_t at the call site for as long as the caller still carries a > sockptr_t pair. > > optlen only has to cover the fixed part, and the real reply size comes > from the gf_numsrc field inside it. Userspace relies on that, so > sockopt_expand_out() grows optval past optlen, for a user address only > and only far enough for the sources the socket has. > > ip6_mc_msfget() now advances over the fixed part and writes the source > list through iter_out. Its callers rewind by the reply length they > already compute, which is exactly what the callee consumed, and land > back where they used to write: offset 0 for the native reply, gf_fmode > for the compat one. > > ipv6_get_msfilter() and compat_ipv6_get_msfilter() only store *optlen > after their own copy succeeds, so a copy failure can't report a > changed length: -EINVAL, -EADDRNOTAVAIL and -EFAULT all leave the > caller's optlen word unchanged. > > The old code stored *optlen before writing the fixed part, so an > unwritable optlen word stopped the fixed part from being written. Now > the fixed part is written first. > > Acked-by: Stanislav Fomichev <sdf@fomichev.me> > Acked-by: Ido Schimmel <idosch@nvidia.com> > Signed-off-by: Breno Leitao <leitao@debian.org> Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Technical Details
Message-ID:
<3f0c43dd-532f-4bef-afec-76b2ca6df0a3@linux.dev>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-356214-linux-kernel-netdev=dewy.ruReferences:
<20261103-sockopt_expand_out_v2-v4-0-2d36da923578@debian.org> <20261103-sockopt_expand_out_v2-v4-3-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-356214-linux-kernel-netdev=dewy.ru From: jiayuan.chen@linux.dev (Jiayuan Chen) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v4 3/7] ipv6: mcast: convert ip6_mc_msfget() to sockopt_t Date: Wed, 4 Nov 2026 14:07:11 +0800 Organization: Usenet Network Message-ID: <3f0c43dd-532f-4bef-afec-76b2ca6df0a3@linux.dev> References: <20261103-sockopt_expand_out_v2-v4-0-2d36da923578@debian.org> <20261103-sockopt_expand_out_v2-v4-3-2d36da923578@debian.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="3337153"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:KeXAWwpanyGsFrxd78KVfMPYY4k= sha256:m65o82nnGc3HyO5+6DQGFcQS8nzCyGNknali5X9a2Lc= sha1:LHWYtwBU8El3ErCD29mqzoKkCLo= sha256:70ufcxltWFlh1v8Uy7rxafQjGDxr0b6slAdBftooeBI= 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 C4C37112AF4; Wed, 4 Nov 2026 09:11:28 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -2.05 X-Spam-Status: No, score=-2.05 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, HEADER_FROM_DIFFERENT_DOMAINS=0.249, HK_RANDOM_FROM=1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key) header.d=linux.dev 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 veLfMjtI-f_0; Wed, 4 Nov 2026 09:11:25 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-356214-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.dev X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 681101126D1; Wed, 4 Nov 2026 09:11:17 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id DB4F727892; Wed, 4 Nov 2026 06:07:38 +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=1793772458; b=2xsVokVcgR7yRsOZywTJ311hO5yVxuzPy+7OlBHmXwY+Uhtn881sSMUnqYOD7SoBIP4R OmSSJM8APgi779bu/8jyC3G2NfSJ8yZokFBuZwJ0zCiA2jVIvdz0u7MlvU0L7ogkDZpwh k5/2PrFs3d1uOfh+Un39XmmXo2lDjO2Z+/Kmt8bY1vYGk9Fqo9tbndtFD9udwYqyx0Ggh TJsKzmwzPEazfGGErC2r08jVEXgSUaDw7Wt12VfwEl2kDez2Wq9wN1vZTjJ8nCDHbFfBb nle2JCPp32U0EH2oLeSQScNWo5XZBQEi4a+EtykBZqjUeSpySjWjRvR/n0XmD78N/uw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793772458; h=X-Original-To:Received:DMARC-Filter:X-Envelope-To:DKIM-Signature: X-Envelope-To:Received:X-Mizu-Trace-ID:X-Migadu-Flow:Message-ID:Date: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:User-Agent: Subject:To:Cc:References:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=9kJziegiXF9ceVnU6QWNYLm7UZNmpZIr3z6LjOuG5MM=; b=qJMIx7R1mFcZavJq5Z3Rlnl9mqQqM2uJ1z49ghhtRDyQnnlWZEEOZJbaV8zl1MLkmzrB 3LjojkIobboiud355RlHyOEFTlJiWSJL15OK41IF1OmVkBIzGX4SrDlCjlhX9pZzBjjfx 5sa92e3Qaa7SAU0YhBL1KYAoY1Q8aEtlAsxuPa+WJFbzT2oR5C3bydqivTXB58M2NexDA FFNnAskOq8O9asFuESGqTHUlfJNHu3tYCFV2gEIQSFBFNXJFWDMcJBhWpHjV2B0tYvl81 sjxDWFYulqQi3oq6PSW5KhkY9Z1mhKE7ioPMSxvx2X7gpy1H/6NXD1YjJ9y7+Ns9OTQ== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=fxLDSgIc; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; 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 B12E1606A332; Wed, 4 Nov 2026 06:07:38 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=fxLDSgIc X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.88 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793772457; b=HC1TIus5jxil1iCbzxzaraZBxf6ePFsXtJSv9BS1awKQc2EjTFiFnlvZjToABWOUW39f 1wdJwYFoJLf4HHhEAeLz8/3GgOMa1SimDWZkVscEyH1jyDOXJTuy6XeZk+cB36qYyBuO8 s8t0LyrL/u9xF6/j6hsgSGFV7d38GGHGQ43zWhrYe1zW3pTB2zV2rK6D5tFDluUCBPsKu qYUiwfILE+znXej3XFpgw0cigkAwyOMaqvkiiNWTjsWkPVTDSnTzSjCH0PcOaShFTJa9e noqrZHiW7OCIUDLt0PTp7mPQmGf7M2ppQ8QMsIHCLisTfF+O9jEDLAPP1O42HrPImAg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793772457; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Message-ID:Date:MIME-Version:User-Agent: Subject:To:Cc:References:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=9kJziegiXF9ceVnU6QWNYLm7UZNmpZIr3z6LjOuG5MM=; b=RQM7Y9aElVMkP11N7uP8vvs4Dt3KHmhIeAxlNrFcDn7clsV19JxFPM/oisaJUaqQMe9o P/DQ239a9LhTYmA+qkz1jo6Tx9wj30YtuItKXywLe39EB2k7ksKTCLa/ePA95r6Ucn2Jw aTwGO7Rx0NLVJ8c6T7DV5iybuDjlRwH3vbR2gxkor+tlLYwQ0zRN7WMw0BJpCF+WoITKH Xat7k8aNJ+De7xmfNPUp7H7MItCXpOvCsOhnXKB+FsLonFwbZCEUw0COCO8rqHfDK3y85 HF8MaFoPeoCmV6oKHX0nBJWbNKsPjKlOmUYYdpfoueAjVez7mUpHmXuOsORZ7H8j02w== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=fxLDSgIc; arc=none smtp.remote-ip=91.218.175.88 X-Received: from mta0.migadu.com (out-88.mta0.migadu.com [91.218.175.88]) (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 8A754606A328 for <netdev@vger.kernel.org>; Wed, 4 Nov 2026 06:07:36 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8A754606A328 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Envelope-To: netdev@vger.kernel.org X-DKIM-Signature: a=rsa-sha256; bh=9kJziegiXF9ceVnU6QWNYLm7UZNmpZIr3z6LjOuG5MM=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1793772454; v=1; x=1794377254; b=fxLDSgIcA/NKQEZVdQe+c+tZv9EJm4A97xmG7kksyzEFVSz1LPqD6ZLfddWwZttwpHGHJqj4 WbQ7rw50MpXacTQu7jIuS4iaZzy+L9FleibBF8vwLdpgPYzOHwg0ZgIAi1EWmIEfe5+1EFdSjZu tIaweSpziELawiYNIfJrbgZU= X-Envelope-To: netdev@vger.kernel.org X-Received: by smtp.migadu.com with ESMTPS id a8b4b12a133bf9ce; Wed, 04 Nov 2026 06:07:34 +0000 X-Mizu-Trace-ID: a8b4b12a133bf9ce X-Migadu-Flow: FLOW_OUT 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-User-Agent: Mozilla Thunderbird X-Cc: 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-In-Reply-To: <20261103-sockopt_expand_out_v2-v4-3-2d36da923578@debian.org>