Article View: linux.kernel.netdev
Article #9337Re: [PATCH bpf 04/15] bpf, sockmap: Subtract all dropped bytes from the return value
From: bot+bpf-ci
Date: Sun, 01 Nov 2026 19:39
Date: Sun, 01 Nov 2026 19:39
58 lines
10560 bytes
10560 bytes
--===============6320018426206090260==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
> bpf, sockmap: Subtract all dropped bytes from the return value
TL;DR: Commit message only: the Fixes: tag may point at the wrong commit; the
freed/subtracted byte mismatch seems to date from ca70b8baf2bd, not
4f738adba30a.
> bpf, sockmap: Subtract all dropped bytes from the return value
>
> When an sk_msg prog returns SK_DROP, tcp_bpf_send_verdict() frees the full
> message. It then subtracts tosend bytes from *copied, the return value of
> sendmsg(). But tosend is the number of bytes that the verdict applies to.
> After bpf_msg_apply_bytes() tosend can be less than the message size. Then
> sendmsg() reports dropped bytes as sent.
>
> Subtract the number of bytes that sk_msg_free() frees. After an error the
> SK_PASS branch already does this. The SK_REDIRECT branch does the same if
> the message is not the cork. Nothing changes when tosend is equal to the
> message size. Otherwise sendmsg() now returns -EACCES if it sends nothing.
>
> Fixes: 4f738adba30a ("bpf: create tcp_bpf_ulp allowing BPF to monitor socket TX/RX data")
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Is the Fixes: tag pointing at the right commit?
In 4f738adba30a (kernel/bpf/sockmap.c, bpf_exec_tx_verdict()), the
__SK_DROP case freed only 'send' bytes with free_bytes_sg(sk, send, m) and
subtracted 'send' from *copied, so the freed and subtracted byte counts
matched.
The same held after the move to net/ipv4/tcp_bpf.c in 604326b41a6f, where
the case did sk_msg_free_partial(sk, msg, tosend) and then
*copied -= tosend (later tosend + delta).
The mismatch appears with ca70b8baf2bd ("tcp_bpf: Fix the sk_mem_uncharge
logic in tcp_bpf_sendmsg"), which replaced sk_msg_free_partial(sk, msg,
tosend) with sk_msg_free(sk, msg) in the __SK_DROP case while leaving
'*copied -= (tosend + delta)' untouched. That is the point where the whole
message is freed but only tosend (possibly reduced by apply_bytes) is
subtracted from the sendmsg() return value.
ca70b8baf2bd is an upstream commit from October 2024 (v6.12) that predates
this series. Should the tag be:
Fixes: ca70b8baf2bd ("tcp_bpf: Fix the sk_mem_uncharge logic in tcp_bpf_sendmsg")
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/41341848185
--===============6320018426206090260==--
Technical Details
Message-ID:
<ece4075cdd214d2797932e4bfd1235d27561ecda973c6935262e18c4a697c278@mail.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-354316-linux-kernel-netdev=dewy.ruReferences:
<20261101192057.2296489-5-alexei.starovoitov@gmail.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-354316-linux-kernel-netdev=dewy.ru From: bot+bpf-ci@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH bpf 04/15] bpf, sockmap: Subtract all dropped bytes from the return value Date: Sun, 1 Nov 2026 19:39:07 +0000 (UTC) Organization: Usenet Network Message-ID: <ece4075cdd214d2797932e4bfd1235d27561ecda973c6935262e18c4a697c278@mail.kernel.org> References: <20261101192057.2296489-5-alexei.starovoitov@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6320018426206090260==" Injection-Info: usenet.network; logging-data="2753053"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:CK9qwYwAPKuCKkUV4Ruepx+Dl8w= sha256:d+dCx0QfIyI9Ad9mJiBDty5Hwo7W4+N5pa8SinbGiTY= sha1:oxL/ZYRpccJzZKCl+31oV5S7cIg= sha256:Rre5VTf4j6VkXNzI6fkJurKQrPPO91I3VPmxu05mo6M= 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 CA810C72C6; Sun, 1 Nov 2026 22:40:05 +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 ebM12COOft-0; Sun, 1 Nov 2026 22:40:02 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-354316-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 79CD7112378; Sun, 1 Nov 2026 22:39:54 +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 B812229F1B; Sun, 1 Nov 2026 19:39:21 +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=1793561961; b=LtZllcyFIHuAaDg4quueaWb1ZU82IJyFphQnIdLwVPBAsqp5U01iclPijuRx8TV0DLJy ueIFj83hkjd1MnW81eHKwlNDLir2rco5kDiMq6N3CMVsnzK7lHqFa9Uo0oRgxJu9yI+2G Ckwh/fS2bef4FztK96O/6weYRfMgxk4Ci1DxNxSEiEHWDAk4zYfhO+WDTZ/xgjKEcHRd5 217kSK3UEOeNM0OYRW6pd2yXC5wsGNMCN8IB81ShANGhONZ4sTem0JNYwLFPWzhap46wq ymCA1KDyiFgZax7c5psjY4Zf1u+yFyb6tqUxzTRWdRq9cwnKHKUR/ZEpLIXcAX7D0dQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793561961; h=X-Original-To:Received:Received:DKIM-Signature:Content-Type: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:Message-Id: In-Reply-To:References:Subject:From:To:Cc:Date; bh=i7u2q9xABEbuGevGg50ejgZjSkxMHnughNz6RLshO9k=; b=2mFdJ2W9Xhkn6+UTLcgwolxAuKu0tBvonZY6xBO01F0uK4PyMogd4N3Wy5LF+G/BN/cL X+BEaHN7CtXgWD30IJrakGWUdIfmuFjAdEuRnuTDqcTXDf5W3uIgi/sKd5nWzlzlnS9hl gQH+DxTc5C8Kc5nwDf347s7MbP9Guz40mu918+0Am+rRFY01dEyyxOc0JK7VVgkU0HJJg DqwAbc18PZJBxqUrTFQjMvuAFSXBiNtPngwVS6ZqQRx61MJE3SqD+tsAXIeLIFVS+6NIm EUg9pPz+KLFlS/ZQmEAoOQoOWOus8Xruz4T3H7MWKStK6c47m1I1DoACw8pR8U0bOcQ== 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=WNIMmFMh; 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 8F048606A32D; Sun, 1 Nov 2026 19:39:21 +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=WNIMmFMh 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=1793561949; b=GrcG2jXQmJX3BrHvcANzPKCbYFdQNL4oCsjN+iphGaoFWEWwborsqAAj6OHI5QWlJwpe gOKYBRcM8zsuU/D4lfHy43bZDMOKY4dm/SUi0CI8Hy1Dk+lF3ocXQohmmGEYx0krvP/YP +fo7tyON7hssLfZs9ukAPy0E3+MQKU6Q1Xm4cE8Het+VHp8z3K+86F0R5cwspzjFg2dLB ezBlQTvQP17nLJLZ/GdkD8Z+oRCvUxQEm1g9V/xBJQlg7yJxN/n9RiuhLdWs1GbIQq8Tj W6ZjLzMsJ1JphTYJt43H4uEBUraxTLJuFGlmIX72wYzH+kgD3xJi6Z1JThUFcKjQjXw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793561949; h=Received:DKIM-Signature:Content-Type:MIME-Version:Message-Id: In-Reply-To:References:Subject:From:To:Cc:Date; bh=i7u2q9xABEbuGevGg50ejgZjSkxMHnughNz6RLshO9k=; b=plUBQloei65ruK+2YE/I8hI+pzvWDKZRe3uioHqoQ+AIh9UQPV1cvI41ux/SzAv8M9Lb 5GiBrH+duqMz3N/nerTvczx5WPOY/iOKU32K1QAGyShYe+QYk68yoHArE6Ck1hRGsx0Fo ibDdF0UBBHTjnb0kvbsOtZAMoi50OJETjXOQDRvwrClkESou+7GOjLKoTkHatcwBu0Qau GUFWoKZVNDA2zA/O3dMtLLeHCnztX8ecgXFIveT4zKODAZZyFlgWc8lb2+ACLgTgK5IP0 JWDUnae8NGQPq4cD7AELsRl1MYCDI/Pis0vo8+yQsMKRp2pQ1kfrPNSU+MNrnE0Lvsg== 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=WNIMmFMh; 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 B212C606A324; Sun, 1 Nov 2026 19:39:08 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8B141F000C1; Sun, 1 Nov 2026 19:39:07 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793561948; bh=i7u2q9xABEbuGevGg50ejgZjSkxMHnughNz6RLshO9k=; h=In-Reply-To:References:Subject:From:To:Cc:Date; b=WNIMmFMhgDTcI3xilNudvcmzn1RjYkKPCuyVRxaEZ/mXuFYfUPjE+WAtv5B9bUi32 A1N89/VnWAYiSQc38gL6DUAQ3bzo/1IlWpyZuc2XxZe3eflKHyWhyDWh8fe2csqs7w HjtuSF9DYJMC30ypAkYmAvBNDCO5ffvFtUH01SufuiXrHqSZf+JU1Cd7S9Hr4pgENA wiwtA81VJdIx6EZEVPLuFbX8DXTQPi0l83FjQeNGkrU4g93Fwkd09NR56uZqv7lTNN St99v/2BDwjdQF9Wk74u8oy3tMhrmd2AQOzv7NXRhWky0t/kppeOy2f8qWYXpx1ViW xx9cCBunDolqA== 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: <20261101192057.2296489-5-alexei.starovoitov@gmail.com> X-Cc: daniel@iogearbox.net,andrii@kernel.org,eddyz87@gmail.com,memxor@gmail.com,john.fastabend@gmail.com,jakub@cloudflare.com,jiayuan.chen@linux.dev,davem@davemloft.net,edumazet@kernel.org,kuba@kernel.org,pabeni@redhat.com,horms@kernel.org,kuniyu@google.com,willemb@google.com,matttbe@kernel.org,mptcp@lists.linux.dev,mason@kernel.org,josef@toxicpanda.com,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,mason@kernel.org,ihor.solodrai@linux.dev