From nobody Mon Oct 6 13:35:40 2025 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 231981D63E8; Mon, 21 Jul 2025 09:05:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753088708; cv=none; b=byOCNzoHlkjTtV6/Sbdv4HcBwn4aHsKXbgWktu+3lDryvLzdtBjkO8CjCEDKLUmT4WbPPIfWCyPV16qHiuylSDe+EYb56s6YGH+LkuHpMMVr7hs9EEfDJovmw/h3tvDFhifGO/NTdWUKQjgr914+Wwj45XcBdqGTUBu1X6nsK9Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753088708; c=relaxed/simple; bh=iKNC0pMt5usZxRe6KBIzfvsmbzB6g1SVSgc5lPdZWJI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=co0DClv2+QLbKphc5UBeyHufa9cvbMpGwx90Fqriz6VuQ5L80u/HY2eQXAHFztgZKMQpNJNn4xjtMFpBRAttAG2R/EJnXbnu0y1ycqfqEc16Jc+iMM7TfGVVjj8/lKNKwvvx6xfebyaZH30O4ZsMWiR9SYWxfRPX75fGoOudO8M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Uou7x8jZ; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=IG7I1MF0; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Uou7x8jZ"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="IG7I1MF0" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1753088705; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OvYWtNTJ1OIPBDLhxhB6E6BqwU6ZzvJB6F2cYA5R1+A=; b=Uou7x8jZtGkuAav+e0SdWwcRQlU8uhery1SvojD+tcgYLJEBMnTUDOKD6haVF+Q+d4SsLo 7zWIJGjEmZIwkykQD7lslDMhBN09hMKpmT2OhBc+nspKG0XvyDGUiv6QujJ1UKvtdFKln7 AhgRl8vj3ugbtBSW8B2k045p+OSdWb1RJFuhqMjsxNkfMJ4FY2dTKJYd493Nsqe8KGGNLo f5iPilO30paoKZ7SzvO39aVYOoXjZn4qXTX2FWFnfRpmTl0LGYV2p5Uq42CUhyzgk9b9XQ uS8GEIL3Qxp4q60VOSv7UTDCS76E7cmJcKEDe3GsL3zbrSQjBnaEHtidw6fSZg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1753088705; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OvYWtNTJ1OIPBDLhxhB6E6BqwU6ZzvJB6F2cYA5R1+A=; b=IG7I1MF0cuSXfcjR/awJQ6uicAJdLFd0G8HGF9dxVfITk5/A6ZcyxrrExGX1c7Ns9W5X4k TvmQCH5QXvX3AHDw== Date: Mon, 21 Jul 2025 11:04:41 +0200 Subject: [PATCH bpf-next 1/2] bpf/preload: Don't select USERMODE_DRIVER Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250721-remove-usermode-driver-v1-1-0d0083334382@linutronix.de> References: <20250721-remove-usermode-driver-v1-0-0d0083334382@linutronix.de> In-Reply-To: <20250721-remove-usermode-driver-v1-0-0d0083334382@linutronix.de> To: Alexander Viro , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa Cc: "Eric W. Biederman" , Christoph Hellwig , linux-fsdevel@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1753088703; l=914; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=iKNC0pMt5usZxRe6KBIzfvsmbzB6g1SVSgc5lPdZWJI=; b=ucBfsz9QWoa3+fEyYxrGe3jaFJ5u3zac2sOjgAX9glb+dOeg7x655T6OlsNUGcns/JLLH6Q/C EUvVwqBMRdOCEAOPZLrsI7/LSuxU9uEc5ZAK4DSefp0NNNQb7tBEqYT X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= The usermode driver framework is not used anymore by the BPF preload code. Fixes: cb80ddc67152 ("bpf: Convert bpf_preload.ko to use light skeleton.") Signed-off-by: Thomas Wei=C3=9Fschuh Reviewed-by: Christoph Hellwig --- kernel/bpf/preload/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/bpf/preload/Kconfig b/kernel/bpf/preload/Kconfig index c9d45c9d6918d1402dab634e280b56c5c929a858..f9b11d01c3b50d4e98a33c686b5= 5015766d17902 100644 --- a/kernel/bpf/preload/Kconfig +++ b/kernel/bpf/preload/Kconfig @@ -10,7 +10,6 @@ menuconfig BPF_PRELOAD # The dependency on !COMPILE_TEST prevents it from being enabled # in allmodconfig or allyesconfig configurations depends on !COMPILE_TEST - select USERMODE_DRIVER help This builds kernel module with several embedded BPF programs that are pinned into BPF FS mount point as human readable files that are --=20 2.50.1 From nobody Mon Oct 6 13:35:40 2025 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 88183211A27; Mon, 21 Jul 2025 09:05:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753088709; cv=none; b=Ocvz7SeMkEIEle5+Kr9inckAqWckPJ6osXw4JJ7jEDVeOGw4jT74GtHGXbAp/MaYXbdZUprn3VFDM1dSGXhYNALiv+po99R85CGSepLZSzzHmJpOGz67iU0McdPtvTqS0EysHULnWX+Hi4xkclVmGQWHa/GsqedpbRxvZr8QP18= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753088709; c=relaxed/simple; bh=iOBH17w0ZfmjIqdV03ANhka+3PqNUYKXkRmFiiERdEs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=scxMNCCqhL+T789x9eoOEVQfMT7i7vIWbLGkzcrUfPmCJeyH3F7Y9uO/qF7ScDDu9dqgwlv1n3iRq/nLgFEQ27ndx4WlC1ejo+49WUiAh6M3D9n5bd++1RvZK7AA++gz7IofTPXM921+9j712LiKc/0bi63T3ZoVKEXjSG8+J1A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=L0uJSn30; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=JLHNvto+; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="L0uJSn30"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="JLHNvto+" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1753088705; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YZ2msJqJ/vaREGPCHC7y6gOD7AxqqhvZjn/budPvPHo=; b=L0uJSn30BhIO40l4NTJh80EUJil78Lh97hO2pknoonTYMt9/y7kv8QlhCWL3akqs0BHVOu HGGs6EcxzU048qV+FvFMZOg3Jldu3yt/C/Y/HuEAOgjPG5fYMgMoYa5MdcWfHUtTgbWpWP 9dbFXwPLk/1oGQ3uKDwjBGz8Qbbzb1x8UFVgvRVfwOldMt2H+fb3TgvlZFmWVereSNqQyG uDp/4X0wtuo9N203+ljw839HlCfe/PV3KBHvqjw+uJJJqAH2BL9QO24tCB6qXSn44XG4Xf WiLsmJu+ffZiq/aTv3bG6xgxLBIdppD5CFclk5InB4aiK5TTKL5ztEEpkPc9vA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1753088705; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YZ2msJqJ/vaREGPCHC7y6gOD7AxqqhvZjn/budPvPHo=; b=JLHNvto+l8F0DOFa/FZf9JZES+0jXDO47TDhXGojkKOqAOHIIoEdKwbHWLkQdpA+IkuaLp G1p2Gq7lW5O4P4Aw== Date: Mon, 21 Jul 2025 11:04:42 +0200 Subject: [PATCH bpf-next 2/2] umd: Remove usermode driver framework Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250721-remove-usermode-driver-v1-2-0d0083334382@linutronix.de> References: <20250721-remove-usermode-driver-v1-0-0d0083334382@linutronix.de> In-Reply-To: <20250721-remove-usermode-driver-v1-0-0d0083334382@linutronix.de> To: Alexander Viro , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa Cc: "Eric W. Biederman" , Christoph Hellwig , linux-fsdevel@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1753088703; l=7303; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=iOBH17w0ZfmjIqdV03ANhka+3PqNUYKXkRmFiiERdEs=; b=/Z9vyjGZmSZ1IX0p1tH/PO+H7hGhvwD6dOmq0QCXkue1wr2du3zwMnFJ7YHuildN7+Kg5fGNX ViMkvYDM78mDXE3smAvM+L9x5XXz5y40vNPhpz58hHLfVDBEp9YyTaw X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= The code is unused since commit 98e20e5e13d2 ("bpfilter: remove bpfilter"), remove it. Signed-off-by: Thomas Wei=C3=9Fschuh Acked-by: "Eric W. Biederman" Reviewed-by: Christian Brauner Reviewed-by: Christoph Hellwig --- include/linux/usermode_driver.h | 19 ---- kernel/Makefile | 1 - kernel/bpf/preload/Kconfig | 4 - kernel/usermode_driver.c | 191 ------------------------------------= ---- 4 files changed, 215 deletions(-) diff --git a/include/linux/usermode_driver.h b/include/linux/usermode_drive= r.h deleted file mode 100644 index ad970416260dd208b43098e17df9ad49b4da7693..000000000000000000000000000= 0000000000000 --- a/include/linux/usermode_driver.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef __LINUX_USERMODE_DRIVER_H__ -#define __LINUX_USERMODE_DRIVER_H__ - -#include -#include - -struct umd_info { - const char *driver_name; - struct file *pipe_to_umh; - struct file *pipe_from_umh; - struct path wd; - struct pid *tgid; -}; -int umd_load_blob(struct umd_info *info, const void *data, size_t len); -int umd_unload_blob(struct umd_info *info); -int fork_usermode_driver(struct umd_info *info); -void umd_cleanup_helper(struct umd_info *info); - -#endif /* __LINUX_USERMODE_DRIVER_H__ */ diff --git a/kernel/Makefile b/kernel/Makefile index 32e80dd626af07d0c43290e3f5c64af5bff07b51..4332de7ffdee40f6a1cf77ff4b4= 22b51142838e9 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -12,7 +12,6 @@ obj-y =3D fork.o exec_domain.o panic.o \ notifier.o ksysfs.o cred.o reboot.o \ async.o range.o smpboot.o ucount.o regset.o ksyms_common.o =20 -obj-$(CONFIG_USERMODE_DRIVER) +=3D usermode_driver.o obj-$(CONFIG_MULTIUSER) +=3D groups.o obj-$(CONFIG_VHOST_TASK) +=3D vhost_task.o =20 diff --git a/kernel/bpf/preload/Kconfig b/kernel/bpf/preload/Kconfig index f9b11d01c3b50d4e98a33c686b55015766d17902..aef7b0bc96d6113dbca7ab4b951= 0c3dcf39a97f4 100644 --- a/kernel/bpf/preload/Kconfig +++ b/kernel/bpf/preload/Kconfig @@ -1,8 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only -config USERMODE_DRIVER - bool - default n - menuconfig BPF_PRELOAD bool "Preload BPF file system with kernel specific program and map iterat= ors" depends on BPF diff --git a/kernel/usermode_driver.c b/kernel/usermode_driver.c deleted file mode 100644 index 8303f4c7ca714a0aa96aeec4be8c8423ce8a200d..000000000000000000000000000= 0000000000000 --- a/kernel/usermode_driver.c +++ /dev/null @@ -1,191 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * umd - User mode driver support - */ -#include -#include -#include -#include -#include -#include - -static struct vfsmount *blob_to_mnt(const void *data, size_t len, const ch= ar *name) -{ - struct file_system_type *type; - struct vfsmount *mnt; - struct file *file; - ssize_t written; - loff_t pos =3D 0; - - type =3D get_fs_type("tmpfs"); - if (!type) - return ERR_PTR(-ENODEV); - - mnt =3D kern_mount(type); - put_filesystem(type); - if (IS_ERR(mnt)) - return mnt; - - file =3D file_open_root_mnt(mnt, name, O_CREAT | O_WRONLY, 0700); - if (IS_ERR(file)) { - kern_unmount(mnt); - return ERR_CAST(file); - } - - written =3D kernel_write(file, data, len, &pos); - if (written !=3D len) { - int err =3D written; - if (err >=3D 0) - err =3D -ENOMEM; - filp_close(file, NULL); - kern_unmount(mnt); - return ERR_PTR(err); - } - - fput(file); - - /* Flush delayed fput so exec can open the file read-only */ - flush_delayed_fput(); - task_work_run(); - return mnt; -} - -/** - * umd_load_blob - Remember a blob of bytes for fork_usermode_driver - * @info: information about usermode driver - * @data: a blob of bytes that can be executed as a file - * @len: The lentgh of the blob - * - */ -int umd_load_blob(struct umd_info *info, const void *data, size_t len) -{ - struct vfsmount *mnt; - - if (WARN_ON_ONCE(info->wd.dentry || info->wd.mnt)) - return -EBUSY; - - mnt =3D blob_to_mnt(data, len, info->driver_name); - if (IS_ERR(mnt)) - return PTR_ERR(mnt); - - info->wd.mnt =3D mnt; - info->wd.dentry =3D mnt->mnt_root; - return 0; -} -EXPORT_SYMBOL_GPL(umd_load_blob); - -/** - * umd_unload_blob - Disassociate @info from a previously loaded blob - * @info: information about usermode driver - * - */ -int umd_unload_blob(struct umd_info *info) -{ - if (WARN_ON_ONCE(!info->wd.mnt || - !info->wd.dentry || - info->wd.mnt->mnt_root !=3D info->wd.dentry)) - return -EINVAL; - - kern_unmount(info->wd.mnt); - info->wd.mnt =3D NULL; - info->wd.dentry =3D NULL; - return 0; -} -EXPORT_SYMBOL_GPL(umd_unload_blob); - -static int umd_setup(struct subprocess_info *info, struct cred *new) -{ - struct umd_info *umd_info =3D info->data; - struct file *from_umh[2]; - struct file *to_umh[2]; - int err; - - /* create pipe to send data to umh */ - err =3D create_pipe_files(to_umh, 0); - if (err) - return err; - err =3D replace_fd(0, to_umh[0], 0); - fput(to_umh[0]); - if (err < 0) { - fput(to_umh[1]); - return err; - } - - /* create pipe to receive data from umh */ - err =3D create_pipe_files(from_umh, 0); - if (err) { - fput(to_umh[1]); - replace_fd(0, NULL, 0); - return err; - } - err =3D replace_fd(1, from_umh[1], 0); - fput(from_umh[1]); - if (err < 0) { - fput(to_umh[1]); - replace_fd(0, NULL, 0); - fput(from_umh[0]); - return err; - } - - set_fs_pwd(current->fs, &umd_info->wd); - umd_info->pipe_to_umh =3D to_umh[1]; - umd_info->pipe_from_umh =3D from_umh[0]; - umd_info->tgid =3D get_pid(task_tgid(current)); - return 0; -} - -static void umd_cleanup(struct subprocess_info *info) -{ - struct umd_info *umd_info =3D info->data; - - /* cleanup if umh_setup() was successful but exec failed */ - if (info->retval) - umd_cleanup_helper(umd_info); -} - -/** - * umd_cleanup_helper - release the resources which were allocated in umd_= setup - * @info: information about usermode driver - */ -void umd_cleanup_helper(struct umd_info *info) -{ - fput(info->pipe_to_umh); - fput(info->pipe_from_umh); - put_pid(info->tgid); - info->tgid =3D NULL; -} -EXPORT_SYMBOL_GPL(umd_cleanup_helper); - -/** - * fork_usermode_driver - fork a usermode driver - * @info: information about usermode driver (shouldn't be NULL) - * - * Returns either negative error or zero which indicates success in - * executing a usermode driver. In such case 'struct umd_info *info' - * is populated with two pipes and a tgid of the process. The caller is - * responsible for health check of the user process, killing it via - * tgid, and closing the pipes when user process is no longer needed. - */ -int fork_usermode_driver(struct umd_info *info) -{ - struct subprocess_info *sub_info; - const char *argv[] =3D { info->driver_name, NULL }; - int err; - - if (WARN_ON_ONCE(info->tgid)) - return -EBUSY; - - err =3D -ENOMEM; - sub_info =3D call_usermodehelper_setup(info->driver_name, - (char **)argv, NULL, GFP_KERNEL, - umd_setup, umd_cleanup, info); - if (!sub_info) - goto out; - - err =3D call_usermodehelper_exec(sub_info, UMH_WAIT_EXEC); -out: - return err; -} -EXPORT_SYMBOL_GPL(fork_usermode_driver); - - --=20 2.50.1