🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #3803

Re: [RESEND PATCH net v5 1/2] tun: keep a kernel copy of the socket filter program

#3803
From: Jakub Kicinski
Date: Fri, 16 Oct 2026 02:08
22 lines
6509 bytes
On Mon, 12 Oct 2026 10:11:12 +0800 Rongguang Wei wrote:
> +/**
> + * sk_attach_filter_kern - attach a classic BPF filter held in kernel memory
> + * @fprog: program to attach, with @fprog->filter pointing at kernel memory
> + * @sk: socket to attach the filter to
> + *
> + * Attach a copy of a classic BPF program that the kernel already holds, the
> + * way sk_attach_filter() does for one that still lives in user space. The
> + * caller must hold the socket lock; SOCK_FILTER_LOCKED is checked here.
> + *
> + * The program is built by bpf_prog_create(), which does not keep an original
> + * copy of the instructions. sk_get_filter() therefore returns -EACCES and
> + * sock_diag leaves the filter out for a socket that uses this helper. A
> + * classic BPF program cannot be duplicated with bpf_prog_copy(), so keeping
> + * the original would cost another allocation and a copy per attach.
> + */
> +int sk_attach_filter_kern(struct sock_fprog_kern *fprog, struct sock *sk)

Warning: net/core/filter.c:1585 No description found for return value of 'sk_attach_filter_kern'
-- 
pw-bot: cr
Technical Details
Message-ID: <20261015190840.1f972d69@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-347057-linux-kernel-netdev=dewy.ru
References: <20261012021113.45939-1-clementwei90@163.com> <20261012021113.45939-2-clementwei90@163.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-347057-linux-kernel-netdev=dewy.ru
From: kuba@kernel.org (Jakub Kicinski)
Newsgroups: linux.kernel.netdev
Subject: Re: [RESEND PATCH net v5 1/2] tun: keep a kernel copy of the socket
 filter program
Date: Thu, 15 Oct 2026 19:08:40 -0700
Organization: Usenet Network
Message-ID: <20261015190840.1f972d69@kernel.org>
References: <20261012021113.45939-1-clementwei90@163.com>
	<20261012021113.45939-2-clementwei90@163.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="2665901"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Cp0ZXYxwVR8fZFgN5pkJTgHvMGQ= sha256:Qwi7POi2el90tbA5g2iQKqqIPNJrpS9fdbP+CZKdanM=
	sha1:9yBVfwDhmsAfB1fLpCsNz+SuQLo= sha256:X+/yyuwJ5cZ8Rrdv1vx/8quSXNO6ChVt1dSTxgKCF5I=
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 78E8D110434; Fri, 16 Oct 2026 05:08:56 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.34
X-Spam-Status: No, score=-1.34 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.24, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, 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 5ox5CbODJZai;
	Fri, 16 Oct 2026 05:08:54 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-347057-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 B5D59110403; Fri, 16 Oct 2026 05:08:44 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by sea.lore.kernel.org (Postfix) with ESMTP id 2A592318DB; Fri, 16 Oct 2026 02:08:43 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 0F94636215F;
	Fri, 16 Oct 2026 02:08:42 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Fapsf2fk"
X-Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B5F73BB57
	for <netdev@vger.kernel.org>; Fri, 16 Oct 2026 02:08:40 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1792116522; cv=none; b=atyrNbUe31o29vyzM+jRmG76xcjco3ZGforZ7uLJXkbpWrQxrwNvwM/4izLziQIO/BiCVmUh2LP8CqcSNw5yfjJx3D+UoZns+ekzNs7KVuS18DG0d1dNwyTKeqnEEGZbgeKkkAuVl/+sf9ygFIw1puh3i/UMJqR64XsQrD3cmxM=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1792116522; c=relaxed/simple;
	bh=j0sMEPq2AA5hcCJzEfDCayKWc0NTPUfbf9yWpGlcjWE=;
	h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References:
	 MIME-Version:Content-Type; b=dDMylpXmIOjZIZRRSZQqUwpm9S8esQzCQjaoTePWlUhkjzYhI+Fph3SHCX6R6ZlA+cgnwiVdSSrOUFoj1e+fnZ0j97TqtWt/HvbNsd6i9qTJyLcE1bUR3UpRcmOXuKsRB+G1dqfTrUnxFGd9Ah5PjBjgRU4+eSVcMrVoKnKgywc=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Fapsf2fk; arc=none smtp.client-ip=100.103.45.18
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 962911F000C4;
	Fri, 16 Oct 2026 02:08:40 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1792116520;
	bh=vDIIUftqRZ2TKJGmVipLpGowTGgcw0HOnSmojkd3fpA=;
	h=Date:From:To:Cc:Subject:In-Reply-To:References;
	b=Fapsf2fkOGU3EO1oxO5qxEjSV6WgAKHg4m5Q/uadmZO57e1p+lxSrjn5HmELFXzWI
	 dU9uwuvyu/ZL1Mo8P6sbGDs/t3AMzFHhZkpSYcx5SZT58duf45mkr1Nttp2yJlGsTM
	 qRTbF/x1cwIIH/4siQx9MPlFSTEGa0FPQjtadZGWzBi1Y1pjwcONZ1B/WWKYC/NJya
	 9cFM3vk5lb8F7asxUkuFc18oqnArfj7gn81zJMJ+VvIIwE7zBSAAwoDWNxATxO0G4W
	 vKaMFsAg1GBL2TuTpuM/o2x7tn0n2xrgmw9QTTOcy7OY6lB1IKuupmCVm/RHTijOff
	 4i4bZWu0SXs1w==
X-Cc: netdev@vger.kernel.org, willemdebruijn.kernel@gmail.com,
 jasowangio@gmail.com, andrew+netdev@lunn.ch, davem@davemloft.net, Rongguang
 Wei <weirongguang@kylinos.cn>, Willem de Bruijn <willemb@google.com>
X-In-Reply-To: <20261012021113.45939-2-clementwei90@163.com>
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>