Article View: linux.kernel.netdev
Article #11556Re: [PATCH net v2 2/2] selftests: net: exercise SO_MARK on connected sockets
From: netdev-bot+sashiko
Date: Thu, 05 Nov 2026 09:39
Date: Thu, 05 Nov 2026 09:39
98 lines
11444 bytes
11444 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The new "IPv$i $p connected mark 0" cases in
tools/testing/selftests/net/cmsg_so_mark.sh can never fail, so theyβ¦
--
selftests: net: exercise SO_MARK on connected sockets
This adds a -k option to cmsg_sender that calls connect() before sending
and leaves msg_name unset. It also adds 18 connected-socket cases to
cmsg_so_mark.sh for IPv4 and IPv6 UDP, ping and raw sends. The
per-message mark in these cases is the socket mark, the prohibited mark,
or zero.
[ ... ]
> diff --git a/tools/testing/selftests/net/cmsg_so_mark.sh b/tools/testing/selftests/net/cmsg_so_mark.sh
> index 772ad0cc26304..7a5e317bc4c94 100755
> --- a/tools/testing/selftests/net/cmsg_so_mark.sh
> +++ b/tools/testing/selftests/net/cmsg_so_mark.sh
> @@ -68,6 +68,22 @@ for ovr in setsock cmsg both; do
> done
> done
>
> +# Check per-message marks after connect() has populated the route cache.
> +for i in 4 6; do
> + [ "$i" = 4 ] && TGT=$TGT4 || TGT=$TGT6
> +
> + for p in u i r; do
> + for mark in "$((MARK + 1))" "$MARK" 0; do
> + expected=0
> + [ "$mark" -eq "$MARK" ] && expected=1
[Severity: Low]
Can the "connected mark 0" cases ever fail?
Here cmsg_sender runs with -k -M 1001 -m 0. connect() caches a dst that
was looked up with sk_mark 1001.
opt.mark.ena is set, so ca_write_cmsg_u32() still sends an SO_MARK cmsg
with value 0.
The only policy rule in the script matches MARK:
ip -netns $NS rule add fwmark $MARK lookup 300
ip -6 -netns $NS rule add fwmark $MARK lookup 300
ip -netns $NS route add prohibit any table 300
ip -6 -netns $NS route add prohibit any table 300
That means mark 0 and mark 1001 both go through the main table to the
dummy0 route.
On IPv6, ip6_datagram_send_ctl() sets ipc6->mark_set for any SO_MARK
cmsg. With mark_set, udpv6_sendmsg() does a fresh lookup:
if (ipc6.mark_set)
dst = ip6_dst_lookup_flow(sock_net(sk), sk, fl6, final_p);
else
dst = ip6_sk_dst_lookup_flow(sk, fl6, final_p, connected);
If the zero-mark handling were missing or broken, say mark_set was only
set for non-zero marks, the send would reuse the cached main-table dst.
It would succeed either way. ping_v6_sendmsg() behaves the same.
The IPv4 and raw mark 0 cases don't use a socket dst cache on this path,
so they can't tell the two cases apart either.
The paired kernel fix ("ipv6: fix cached route reuse for SO_MARK control
messages") mentions "including an explicit zero". These cases expect 0
in both situations, so they only check connectivity.
Could a rule be added that prohibits mark 0 with a full mask, for example
fwmark 0/0xffffffff lookup 300? A plain fwmark 0 gives a mark_mask of 0
and matches everything.
With that rule, connect() with sk_mark 1001 would still succeed. The
IPv6 UDP and ping mark 0 sends would then return 1 when the cached dst
is bypassed and 0 when it is reused, so expected=1 would catch a
regression.
> +
> + ip netns exec "$NS" ./cmsg_sender -"$i" -p "$p" -k \
> + -M "$((MARK + 1))" -m "$mark" -s "$TGT" 1234
> + check_result "$?" "$expected" "IPv$i $p connected mark $mark"
> + done
> + done
> +done
[ ... ]
--
Sashiko AI review Β· https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261104092240.15649-1-yanxia%40cmss.chinamobile.com
Technical Details
Message-ID:
<179387154116.488856.7164246185525969593@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-357179-linux-kernel-netdev=dewy.ruReferences:
<20261104092252.15712-1-yanxia@cmss.chinamobile.com>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-357179-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v2 2/2] selftests: net: exercise SO_MARK on connected sockets Date: Thu, 05 Nov 2026 09:39:01 +0000 Organization: Usenet Network Message-ID: <179387154116.488856.7164246185525969593@kernel.org> References: <20261104092252.15712-1-yanxia@cmss.chinamobile.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3603856"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:PcgHL671t2MindWKS30gTIhgz+8= sha256:0OkRUrxxBkHX76qJbSlVDs+i1qfAGvVBw8eRkP90yUU= sha1:3FKx+B5c0+WFldCaG5rLW8LT5hA= sha256:WHUyWMf9bKThrIl+ubj4RUpi85khU+0onMwcLwNHqgI= 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 80AFF112EE3; Thu, 5 Nov 2026 12:42:02 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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=kernel.org 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 UR14UF2bit_O; Thu, 5 Nov 2026 12:41:58 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-357179-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id F1033112EEB; Thu, 5 Nov 2026 12:41:49 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id 6643B2AF07; Thu, 5 Nov 2026 09:39:17 +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=1793871549; b=lghWFX/Sd2SF7kMZo7weiL0h0uolIABL1a+lkUDmSkN6McedFNF4mywEQlEVOhbjBJZD F4ooCSMMpVzPDYRebvGq26B17AyefXRuUCSjRwKPeimmrpMUta+0iyiD+1EO5DfX1+TxC SE0pliqTG51eJzXHG2PKHvHqxdsJI7XrdEqjq+p3FOUfsDLH4/WIKTp526uDSKSxc/0W9 Zf6nS0frgLvUlFzPgVhWdPRVIXBrexfl78c7LnBmsAzRHRInx2qDVfY68vRuDGmlFq/+M V8arLYnapY/MrmGrpczm1ljvRJyVATt9CDUKunOjCTffeNCJnwdi7ZdHSlFWHjcROHw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793871549; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=nOWIFWh+1CEqipH8Zskds4nwG3GpkW/ipctC03Z2qdY=; b=UI16xq/d/P69nbL5jfjyLayxwEoUDYZB64vt4OHOZiuZMrPQ1NnraE6H0ayQORaR9kUH X1dRU6XVnsgZGCI19NeKZxNxjREF3fuZi3CSRsh+hbwlSPYS/aK1Txwddie2w8XI6jkMY Rraqmm4yKhKUgauMqOny72D4YjK+CoaXMe811mv6+Mqddp4WCWoXJSdVxyc39Fush709p t/I5D/ntzDhCAom2zoRs6wstP/wSGGP3JytHKuHA7rfxCuumSTgwvZZX7ZVAiYq1XC/+6 uJqAal8NTWRSow4X4+Tyzs8ubtQwhr6snGyf7yCtUfWqyqKtG1SoARsQEqfrgNdTKbg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fEV2hKzx; 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 15AC7606D807; Thu, 5 Nov 2026 09:39:09 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fEV2hKzx X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793871543; b=omY5aNGqj5b6y05jHKhrcIhWHGTFsuIpmJi9YOY4cwkyk34wLzwf7UaSBbwcNDdTzXH+ uOTmb75xHzKRxCUJHuLyUTCaVf33tWXLoFpYnXBs/SOwddo4qQ0EwdvUCl00cex7kwOBt MCcZ1ZBm4lJJgIRcNHoB8Rdi0Mbdy5ybHA6BgaEmHCOQBm+KiwWyWF7ZPmYdl5iG2RXo4 ifgblNXSWHh802TUHwwJeg3FSAccbjLZd9+bqrNdx4JFpi1zxwlC9igy4j13BGmqeityX r5l8ncm9orGpNFy67e/HdnvsmRjOGEK4WyznUhT+Y5I46yzPW3b1Ff0WpD8OBs6EFXQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793871543; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=nOWIFWh+1CEqipH8Zskds4nwG3GpkW/ipctC03Z2qdY=; b=TzNkodtso0iqPm+KRPas2hi5uoAYYo4qR8zsZqAXpIbNtCw8+gmjEq7CpKK8+uJkKP8F D+S1xsQukvSPMSvJDaQj2OtPG13X8thcSYTfW21/sOJm0fT/seA5I31BpFnQ1phlPE84h 38o9DyxJTiVKSmC4/EPl7lAFPNF+IToBftBxEexz/Ve6DV9TtIdbgAL0GrormloKC2hGC z5m1Vl/sg2owHqmQsYhDPsrXjutdFExLj7t2Nzj87R5EGiRDTSvoGE8LmMf2BZxozLfOL FPYlbfExgzA2T80nzFhJbN/qDTHcd3HOkuFT+kGLyBnczSsQqiIKYnX43xSx1JdTGeA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fEV2hKzx; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E72D7606A339; Thu, 5 Nov 2026 09:39:02 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97BF61F00A02; Thu, 5 Nov 2026 09:39:01 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793871542; bh=nOWIFWh+1CEqipH8Zskds4nwG3GpkW/ipctC03Z2qdY=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=fEV2hKzxVlnyyzz/+Ijpzj8+tZwVIb3yoZP98/MQGep/idZoFnVjQyF866h1KWeVf fO0Sk7iLN3phAX28vLVafI/flF78fI/EcQ2Pb087tNuMdmsvLVt5H5m4Fz/gIzvZF9 xpjpMzW6GGKnYc0gLAPw6jhTd3XmT43C1RopWEscevHp4XG7fDv3zspYIQLzCZ8i74 a5UOxDRXcthsaEm2rAZ+3QOhGs7q0vx00eKqIhJkXL9CMcy1nJVyFBBtTbxcCmBL/a 8lkOQNPEhnGsGFDx6w5umjDuFwhxeaNbDWw0Zi8PoBmnuST3BLYnYNukdesOhqWg1+ o4irIM89ncIpA== X-Cc: netdev@vger.kernel.org, dsahern@kernel.org, idosch@nvidia.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, willemdebruijn.kernel@gmail.com, linux-kernel@vger.kernel.org, stable@vger.kernel.org, yana06070@163.com, shuah@kernel.org, linux-kselftest@vger.kernel.org, willemb@google.com X-In-Reply-To: <20261104092252.15712-1-yanxia@cmss.chinamobile.com> X-sashiko-severity: Low 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