🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #9537

Re: [PATCH bpf v2 01/15] bpf, sockmap: Write sg.start when recvmsg() faults

#9537
From: Jiayuan Chen
Date: Mon, 02 Nov 2026 08:32
26 lines
9654 bytes
On 11/2/26 3:20 PM, Alexei Starovoitov wrote:
> From: Josef Bacik <josef@toxicpanda.com>
>
> __sk_msg_recvmsg() copies an sk_msg to the user buffer and starts at
> sg.start. After a full copy of an element it calls put_page(), unless an
> skb owns the page. It handles 0 copied bytes as a fault. It writes the new
> sg.start after the loop, but not when copy_page_to_iter() faults.
>
>   element    0: length 0, put_page()   1: fault here   2: not copied
>   sg.start   ^ today                   ^ this patch
>
> Each subsequent call copies 0 bytes from element 0 and returns -EFAULT. The
> user cannot read the rest of the data. sk_msg_free() starts at sg.start
> too. It calls put_page() for element 0 again and can free a page in use.
>
> Write sg.start in the fault path too. The commit in the Fixes tag removed
> this write. Do not write it for MSG_PEEK, which changes no element.
>
> Fixes: c9c89dcd872e ("bpf, sockmap: Fix partial copy_page_to_iter so progress can still be made")
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>


Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Technical Details
Message-ID: <1d0cce30-28d8-43ee-b6b9-12e2660d4992@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-354539-linux-kernel-netdev=dewy.ru
References: <20261102072112.4160195-1-alexei.starovoitov@gmail.com> <20261102072112.4160195-2-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-354539-linux-kernel-netdev=dewy.ru
From: jiayuan.chen@linux.dev (Jiayuan Chen)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH bpf v2 01/15] bpf, sockmap: Write sg.start when recvmsg()
 faults
Date: Mon, 2 Nov 2026 16:32:07 +0800
Organization: Usenet Network
Message-ID: <1d0cce30-28d8-43ee-b6b9-12e2660d4992@linux.dev>
References: <20261102072112.4160195-1-alexei.starovoitov@gmail.com>
 <20261102072112.4160195-2-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="2883675"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:FkO06FpWcne2tWJyOzvrqxDLnj4= sha256:oBB7r7VAPp77PkAeMYhptgjzPlRcHm1zyAZcNvtdz7I=
	sha1:NzpP+aajI2B9suHLo7t9YiMOG5c= sha256:jSVg7YLgYldH/TmDTMpKJiVed1OL4ixrlSeoHF9l+M0=
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 E22E811246C; Mon,  2 Nov 2026 11:37:07 +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.25,
	HK_RANDOM_FROM=0.999, 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 gTeSJsWrgaAr;
	Mon,  2 Nov 2026 11:37:03 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-354539-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 1B85310FB99; Mon,  2 Nov 2026 11:36:54 +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 F2E0531CD3; Mon,  2 Nov 2026 08:32:24 +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=1793608338;
	b=hshaKVQs2gkrEHZVXgoj20FjVXVreQ75kGKttHfYTlsQyFSfwBX/pgFlvPJ1vFWoMwGa
	 Mp1dGbcHr2tEWPKjAUr2UPaeKDAukyGToVjGp+3wqnw9hb0jXs1H7M/8dUzhHReR7PLI9
	 j0qTTUeZl1LyicFwKgAr8P8v/QTqZPEGVLypwfGBXzySKUdbnu8PvHe0jlwICO6E+DDOP
	 ya1m78zPNywkDtvoT2/moSlwy713wu02zv5lTVTxqFbs/aRsnhd23a7XuS7llis+6ZSjD
	 oVgWbnzRIT9UvzCk1fTv/TYQVNx7d/gkoeqFKzxwwXs1w/4W+6efnNkiDHNY8mErR/w==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793608338;
	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=IYreqHUz2HQR2AUBnBbZcSxaTUlKTzbRYKcUs5sJV1I=;
	b=qh1UJ7LF1JZXbf9/6CGA3OWpOkhpu3gQb2nw2otj51KrbRuRLUjbRRfbesFI6fayKCFI
	 SpblVGREnnioCbZrPeZtCuPruzKB0vigzCDe1FtzZbHfxzSj/iGMudAzT07jH7m2bYHr+
	 ITARM0GHynbCnIV3aH6ySSNWNq+HDYUz6H/75IQCG68+9vEy7SOrchLf2v98R/iO0bsz3
	 YMSXPaHxH2lYqQY5yqxQoHjXqP/GkXH1E2Hlh+wV+9sIQ8nz2rNwfbgFzwFL88XbZmcq+
	 Zdaor0iLHMriuhVMsLVbwKsCrsx4KIZcB8d0JTId2ukoym64xIgQiuJCYB3qoM/ywFQ==
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=ds6Fln3l;
	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 BFD21606A33B;
	Mon,  2 Nov 2026 08:32:18 +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=ds6Fln3l
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.234
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793608337;
	b=ntb0FNRR4YjwfV/+GJSIbdTF1+0/P6L0peWAIJ+YXwdMOREhsuvKLXAJDr83S9B5a/FA
	 gOngNc6oGXke2MDXytE+aKwEd2F1u6+27S5jkuZp5oCCG37rH8ShI/DIvIkrQQODqmvIH
	 SyGM5VU2AEBZqpHFkqNHolrQxyWU60RHbihyAL7s7CtcwDnSOV5zcY1NvcFy8nrlgQoIr
	 Frj/TTDH/gletnwT1KkA+KTXb9P23g7EgHW2G1op2XY1ZxHv+sT+OFNvtNI1scXD1yFr+
	 dbnmHFcgIrHtLY8FfW9h2Yw/98K60sl4fVio8XXDmNm/7LvCA5MAcyBhyLevMHxRVmw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793608337;
	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=IYreqHUz2HQR2AUBnBbZcSxaTUlKTzbRYKcUs5sJV1I=;
	b=xV4nkee6ZRfq9jCSlgZO4llG9mhmRvvSwxJ87ooZxtD7DpDqmcXyh4C3em/h+S9jwE20
	 mbKIA12JD4NmZpShs+aSsI+epZJxRhG71pRh1YkBRBlXa6Z3b83mCWoANQZYzu4b825km
	 wPcIL4SdV+XgAH8n6vzFe1EGumkjUZr9Pn+DFo+r3rW9jvyjg9TE0hw5gKnvF9W4P1/TL
	 k9XY3ZE5uZ5nPwYplezmCmgwu8BewerR81X5wFscdOjiekoVykfwGL02usHwAJ92w39Ro
	 by8o5SEp5MQBlQ0JPT6RG3a5bTQVaY+rxIQ3J+ClAaVFXQ6ssXWe91FNRxafDjswy0w==
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=ds6Fln3l;
	arc=none smtp.remote-ip=91.218.175.234
X-Received: from mta0.migadu.com (out-234.mta0.migadu.com [91.218.175.234])
	(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 2A60C606A326
	for <netdev@vger.kernel.org>; Mon,  2 Nov 2026 08:32:16 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2A60C606A326
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=2P3ROvsM82yhJ2gGF+tSdLtq7UlfUDARI+FzX4vCWJI=;
 c=simple/simple; d=linux.dev;
 h=from:to:subject:date:message-id:mime-version:content-type; s=key1;
 t=1793608335; v=1; x=1794213135;
 b=ds6Fln3lPjT2pVFkMVnpUW34VbSJu7/oKSYKMxWcrvJaNQo76xr+hiufxkXcSqUoTUEkMj8O
 ro0gdx7xJwPcmy9yAEmjqY2USKm8t0zf0IsIg4uTgtFu1jBg7/ScKiPTaD6og7gW1ZUZ70KwqwA
 IgpXOTJSHz7jNKictxCdyGtg=
X-Envelope-To: netdev@vger.kernel.org
X-Received: by smtp.migadu.com with ESMTPS id 884a5ea4713e1463;
	Mon, 02 Nov 2026 08:32:15 +0000
X-Mizu-Trace-ID: 884a5ea4713e1463
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-2-alexei.starovoitov@gmail.com>