🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #22916

Re: [PATCH net v3] xsk: keep the charged page count when pinning a umem fails

#22916
From: Björn Töpel
Date: Thu, 26 Nov 2026 06:33
23 lines
9006 bytes
Kyuwon Cho <kyuwoncho18@gmail.com> writes:

> xdp_umem_reg() charges umem->npgs pages to the user's locked_vm before
> it pins the umem. When pin_user_pages() pins fewer pages than asked,
> xdp_umem_pin_pages() overwrites umem->npgs with the pinned count so that
> xdp_umem_unpin_pages() releases only those, and xdp_umem_unaccount_pages()
> then gives back only that many. The rest of the charge is never returned.
>
> A short pin happens when the tail of the umem area is not mapped. With
> RLIMIT_MEMLOCK at 16 pages, three registrations of an 8-page area whose
> last 4 pages are unmapped leave the user able to register only 4 pages,
> for as long as the user has a process running.
>
> Unpin the pinned pages directly and leave umem->npgs as charged.
>
> Fixes: c0c77d8fb787 ("xsk: add user memory registration support sockopt")
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Closes: https://lore.kernel.org/all/20260421172951.A7052C2BCB5@smtp.kernel.org/
> Signed-off-by: Kyuwon Cho <kyuwoncho18@gmail.com>

Reviewed-by: Björn Töpel <bjorn@kernel.org>
Technical Details
Message-ID: <87fqwokso8.fsf@all.your.base.are.belong.to.us>
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371897-linux-kernel-netdev=dewy.ru
References: <179562059260.3381969.13546710565371160648@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371897-linux-kernel-netdev=dewy.ru
From: bjorn@kernel.org (Björn Töpel)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v3] xsk: keep the charged page count when pinning a
 umem fails
Date: Thu, 26 Nov 2026 07:33:59 +0100
Organization: Usenet Network
Message-ID: <87fqwokso8.fsf@all.your.base.are.belong.to.us>
References: <179562059260.3381969.13546710565371160648@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="399197"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:r9Vjyzw8CAKoiPMapuEYmRkz7PI= sha256:IPnpNYUCWOGPBPMq4D+45tH3SY1zrbQ4MQ39boXP8ko=
	sha1:6R+/clVOEIsJ8hPLgqtwYclWTEQ= sha256:RqnVVm2O+cJhNRjzoVrHNqKNh6P/y/c+vxxmMwGGt2Y=
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 E5EE0125EB3; Thu, 26 Nov 2026 09:34:22 +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 E9uw_tsy4WWq;
	Thu, 26 Nov 2026 09:34:15 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-371897-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 279AA125EB0; Thu, 26 Nov 2026 09:34:07 +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 272622AE7E; Thu, 26 Nov 2026 06:34:05 +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=1795674844;
	b=mgYUwE/zwHOl/rw/GYuWnGazhH/sQhD2NB/7gOJv1ZQXDi7ZM7qswwUluyS5v/siqP3V
	 QHNOriODGyzC2qd5uqUDxK7ocAgtAexb2NKxCaNWy7RG/r1wNs4Z/aY9hsGkRlUzN5dbE
	 UiDE9PVWFhcYQzDEdywawspeH7BM0t18CrQW1vzT2zjm/RhQutNbDR9LJNz8zP6VXU6KV
	 YglCRgKNpN/a+TnwaodStpp3V9BXjDPHzSni24Ngc//SL3+EuFXKaqmWhJz18WH8ryEhz
	 4MEJexF+kyjlI2IiF4pgpMPsIJyGPWqLjsdJraFosGGiOBCvq3IvaxUp4zCQYcIiK+Q==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795674844;
	h=X-Original-To:Received:Received:DKIM-Signature:From:To:Cc:Subject:
	 In-Reply-To:References:Date:Message-ID:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:Content-Type:Content-Transfer-Encoding;
	bh=SpzMlBQ6E0qeoovmK+Ns/SvzV6ItCpXh4pQasNnZw/0=;
	b=4p5M/yhqYhPS8TyMRY7USt2NGFoOstI9RVs+f4OHfJKM6dXI1Bl0TUi7eVVLzmhQTSTW
	 IZvAxNkXHyZz0wiwOI0tSwePzWcJRMWtrIaDz14bgquZ7YqmoLzNwf18GN/wBHDMQ15DX
	 GBqYXQORTM8ENbSd/X9Npr4C6dDuQ1AtR7Ta1fO7d8YnYKQbo0tKK7FER2JDYVZRODtcp
	 Z99EbFVdDIK9NvyG1T4ilNOgnT4ihEsg3BsYwO+uuy3vmDyw3DR+n8DakDS6Y1Ymov8Dc
	 2ACEXqKr44x77eluzGFHWwIe6OvQ41zU5Eecd0lJFwQIwnboxxzhhEl9N/f8KtxdrIw==
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=FdIC0Dsl;
	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 D8D92606A32C;
	Thu, 26 Nov 2026 06:34:04 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=FdIC0Dsl
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=1795674844;
	b=di63E9wW962GUNKk4Bx0mebzi38OU2lrrhXf5zM+hYktsj3HI9612+3I20f7sPr0EARd
	 k/KCqhLPxQoxrTPdmbB8jVt1OCXxPl+H/ACp7eYhjjMF1kh4I4agoQADM2lCH/KaomSuP
	 I3wfqDIBfd9IgcPvaZOzVmQdpKz4x4F6dCjw28ViJmbxfrZrHJp67v5K96lWic//vEjfb
	 gs4iKmUi44YxpHVFDiFgEnDQUAPRlkZuuKbAfG6Uzz7mZi2H3cGt4FivQ/v65lxLB0tPJ
	 tU+2MF4iaR2f2Zq7LlbVYNRIIfCxJadraQhj/gQNmm6VwdW64gCz3YqGiR52WeSoKvw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795674844;
	h=Received:DKIM-Signature:From:To:Cc:Subject:In-Reply-To:References:
	 Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding;
	bh=SpzMlBQ6E0qeoovmK+Ns/SvzV6ItCpXh4pQasNnZw/0=;
	b=TYr8ZTsrRXQ/umLB81iKkQDiMCgqkk+lfk3JsFKC9f4AxxuUeqTTzifgthcVQjGazsCD
	 ZmO4zIMCaJKq6xXAk/6Cv/sGuLAci4kEhOajaU2MkMu3GKR682n9cmk2rVQek+i2QAkip
	 nBA2TSVMcpIzjlbfliT3LwXJLZcZP1ZRE34aKr3Y8gIrrfXvGkSUbbGOi3cQZrET+nGJz
	 t/NCzW2PWky8Fu9WPB+DOw0DlaM/xUgCNRKrHxMBBrrX7vdpagkA3EqagjTXRtoNud+E7
	 5PzvFXY9UQ/01yzcoGioa+fREYMDrHHM/lybeZRACZQOtnUFCDU4Q3E8GGYFl2vI3ag==
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=FdIC0Dsl;
	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 0346E606A31E;
	Thu, 26 Nov 2026 06:34:03 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id E75011F000C0;
	Thu, 26 Nov 2026 06:34:02 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795674843;
	bh=SpzMlBQ6E0qeoovmK+Ns/SvzV6ItCpXh4pQasNnZw/0=;
	h=From:To:Cc:Subject:In-Reply-To:References:Date;
	b=FdIC0DslktW3eOK8vnFSfkj7/wW/GOESlp0KIGjikm9I2Cn0fsuWrb5cydRGPIl5h
	 o+eP5RV4JvVzYTM2wmgoYBsGvECa6Dw9wJr+PDRDVZlMsg4VkY/2WBeB6Tb7G9kumZ
	 u7MsRoimnwzzZdS1oo1bFTxRmccsyF3fhT/pbwMSgWtYw23h9BrumDf/bfYQ1cJl3z
	 rT98msGu7IK4IU8P+DLhPUOWTHnReUNUVg83aX06Lq5uR2D3VfACB5P+LiZCTuyTXa
	 E/+kY6YABM58EYuqK0Y6MteG1yZEvZwKTaCzyhBPrlgFiRHkqX1rJo9+Q5EMt/v/rK
	 WYtoybQEkByYw==
X-Cc: Stanislav Fomichev <sdf@fomichev.me>, "David S. Miller"
 <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski
 <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Willem de Bruijn
 <willemb@google.com>, Simon Horman <horms@kernel.org>, Alexei Starovoitov
 <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, Jesper Dangaard
 Brouer <hawk@kernel.org>, John Fastabend <john.fastabend@gmail.com>,
 netdev@vger.kernel.org, bpf@vger.kernel.org
X-In-Reply-To: <179562059260.3381969.13546710565371160648@gmail.com>
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