🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #10029

Re: [PATCH bpf v2 14/15] bpf, sockmap: Keep the rest of the cork after a redirect

#10029
From: Jiayuan Chen
Date: Tue, 03 Nov 2026 02:25
25 lines
9720 bytes
On 11/2/26 3:21 PM, Alexei Starovoitov wrote:
> From: Alexei Starovoitov <ast@kernel.org>
>
> After bpf_msg_apply_bytes() a verdict can apply to a part of the message.
> Then tcp_bpf_send_verdict() sends this part and goes to more_data, and the
> sk_msg prog runs on the rest. The SK_REDIRECT branch does not go there if
> the message is the cork. It removes the cork from the psock before it
> releases the socket lock. After the redirect it frees the cork together
> with the rest. Thus the rest is lost, and sendmsg() reports it as sent.
>
> If bytes remain after the redirect, put the cork back into the psock. Then
> the prog runs on the rest, as after SK_PASS. If the new verdict is SK_DROP
> or the push fails, sendmsg() now returns a smaller value or the error.
>
> msg->cork_bytes keeps its value, thus the rest can stay in the cork. If the
> psock has a new cork after lock_sock(), the kernel still frees the rest. If
> the redirect of a cork fails, sendmsg() still returns success and frees it.
>
> Fixes: 4f738adba30a ("bpf: create tcp_bpf_ulp allowing BPF to monitor socket TX/RX data")
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>


Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Technical Details
Message-ID: <fc5a153e-f1d8-4b2f-a1ee-646ac5d8d8e4@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-355164-linux-kernel-netdev=dewy.ru
References: <20261102072112.4160195-1-alexei.starovoitov@gmail.com> <20261102072112.4160195-15-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-355164-linux-kernel-netdev=dewy.ru
From: jiayuan.chen@linux.dev (Jiayuan Chen)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH bpf v2 14/15] bpf, sockmap: Keep the rest of the cork
 after a redirect
Date: Tue, 3 Nov 2026 10:25:24 +0800
Organization: Usenet Network
Message-ID: <fc5a153e-f1d8-4b2f-a1ee-646ac5d8d8e4@linux.dev>
References: <20261102072112.4160195-1-alexei.starovoitov@gmail.com>
 <20261102072112.4160195-15-alexei.starovoitov@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="3080213"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:HLXhEGpaQKqG7JJA4HGZ3TT0qD8= sha256:91if5/OvV4+OMrO7yA72Fj+qVYffbos8l3FJefcCu5g=
	sha1:+56F1zbj4I2Fj9DcH3tqPoD1zh8= sha256:p0s4ujWIlNkV3xQjW+ssZTI6lHq6FAH0/rDHErCj+RA=
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 C11EA11270D; Tue,  3 Nov 2026 05:28:37 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.051
X-Spam-Status: No, score=-2.051 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] 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 YkRHtn00MF3T;
	Tue,  3 Nov 2026 05:28:35 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-355164-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 CF34C1126D6; Tue,  3 Nov 2026 05:28:25 +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 AC9F125C80; Tue,  3 Nov 2026 02:25:46 +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=1793672746;
	b=CiMVllwZf8zWR/lAHfA/5NtwRWpMe4aTprsPRpjhcFNc5bB/FeuhCnRP6rkdKzsN8KEU
	 qI+tzHHTJgEKGIdUAXkod5C9rBIkm//f9GqCPJVt0ipxvI/N04mH7XU8303FgP1eaNomG
	 epJFZtIU6CTg1zeou4ydg9iHvvDfcM/UlY5c27MSwrSxVzmojxTq3ave29emqN66RpZo/
	 jfh3yIkO9ccviJpDmXqIXZaLcUoP3rhrA3g2bmeuQDcp4uc6W4DyZqJv+b1N0UHAmRDqg
	 gePEm+G4yACEwcjmSG60F7adBF286X3X/iouuvgn+gxCIgkM5/uFY5AAViVNsieyoIw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793672746;
	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=IvOE97nqCYOuKLVpMLw0btVRPz7o5pR9mipwEI05Wt4=;
	b=zVHzb3DcB+vECdW3oVo+S86W9nyek98D/vN2To3zwOwfrrlcywWx/nwEF6As6vPAfK9k
	 gUZtna0n7ROVkuEOYna+PhIgBXg3hsd2YD1Rxv2/Ke0+eNj+1Z3jCFFbXpLLZuD3Wf1N2
	 LkuVWMAetCGo8dotkANRRPgjjU6Qash+Wpl/6I5bAGlgYTyrb9EyOnzBLLNGB/c8xeA4N
	 LJh/cTXJDqf6QIeGRfGL43v4FHqlUf4qtF9yqJmGdeJcEhcKXtQ1A7ER4Dz/fk3cj6TjZ
	 xU8FTGlhrraLnsxt+cP4MmvuaolyMa7+vDFj64Mp4qkISoBBO3AbJ+S64P+iz0P3o5w==
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="I5SSa/hB";
	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 83148606A32F;
	Tue,  3 Nov 2026 02:25:46 +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=I5SSa/hB
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.140
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793672740;
	b=Cp3pBxPqXzu+Ibg7zaKVauDO/0criSyr78AtWKOsa9YGObTg+9UCS+RLgf9HVz3H83va
	 MOxPmc7NpsvuQShnrL5xOkN2szR0aLzItoqhrKUnsY319UviTxu3fj46Urt8lKajeXOC/
	 Fo8RIZGhFUFZQ+MCmnv6mMylOkad/b77V/4HXHpA8XdArqwBoLhx5PHl8eRi7uzub2+1+
	 48OszoeMzZjqQS2SMTKGIImFgwXh7cKeQyJaBJtVSLvu2/j+/RG3/GPhxMWy0SRLQjvkn
	 iU4WxWyLFrxIaOffALe+8HNkJ6HItmOcSUWP2vbXYpiP8ebSaeOk8mKNR9J7WGnjjbg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793672740;
	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=IvOE97nqCYOuKLVpMLw0btVRPz7o5pR9mipwEI05Wt4=;
	b=ncmwf/Vtj7EJ4M0YGWogFUmcqXqx/rJvEmEbeeRMQdZX9RxG7lNjUomX+LFDFXPROvpp
	 Jy67HExYOg+O7+VBGuOR0v3qwHI3wT9eWEFvuowU8mPtuV2zxJJ+E/7T3hssrg7g7p2WC
	 SyWHvcJuxXECNU/jgeTiU/fIiRDuhW2TS8VAsMkro8rLEUGdU/vwnpvxj8Kfu/df5Z4Oo
	 wYmJbsty8NgakZL2YUwxscbZHtJHZph4jhf8LJcz9weiiyQbRbeGznvMg3E9WJIUWQrpd
	 rNRWWD1jygpQMbz7UKLa1KAjruk+niniBf0mhby3aY0yAeN2D6Kyuz8eqHveVgrjNkQ==
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="I5SSa/hB";
	arc=none smtp.remote-ip=91.218.175.140
X-Received: from mta0.migadu.com (out-140.mta0.migadu.com [91.218.175.140])
	(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 02B41606A324
	for <netdev@vger.kernel.org>; Tue,  3 Nov 2026 02:25:37 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 02B41606A324
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=IvOE97nqCYOuKLVpMLw0btVRPz7o5pR9mipwEI05Wt4=;
 c=simple/simple; d=linux.dev;
 h=from:to:subject:date:message-id:mime-version:content-type; s=key1;
 t=1793672736; v=1; x=1794277536;
 b=I5SSa/hBkeH/5TPTeuN4X07ju8nimjMubtSxy3YDqbsZhEDXwfvyXC6MLzr5m+4WTeH6YWl1
 5rQ6R5/95ZCsT+JnqTUDRVVFWUMFrFnuCiHacr9bTC82WWKt8l09zoQx9sGf3T36x3UNzzUPRwl
 x1p1nzzCBuYxH7Fp8cytOjlc=
X-Envelope-To: netdev@vger.kernel.org
X-Received: by smtp.migadu.com with ESMTPS id 736ecbeae81c178a;
	Tue, 03 Nov 2026 02:25:36 +0000
X-Mizu-Trace-ID: 736ecbeae81c178a
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: daniel@iogearbox.net, andrii@kernel.org, eddyz87@gmail.com,
 memxor@gmail.com, john.fastabend@gmail.com, jakub@cloudflare.com,
 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
X-In-Reply-To: <20261102072112.4160195-15-alexei.starovoitov@gmail.com>