From mboxrd@z Thu Jan 1 00:00:00 1970 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 4AE9C1F8AC5; Mon, 6 Jul 2026 23:51:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783381909; cv=none; b=aoASu/MUkkCAGbOyLRN1+T6Mh2fBs9a6PB7FLdu3daYOK9QIOHI5d07Eg6Qyo/VHu+kErEN4y4BWqTwoBMEVWCgaCEyGgTVqJET3jKBBV5X9aRlr2zYWa/u3TgNrPDVcP7SESs6GOVjHq6BQxh2GPnpDUCOAxzwFlr4Yc2GcqCw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783381909; c=relaxed/simple; bh=EHxPTP95mANj4rpuEmYs618cJ2uP3IvPee3gU9yrtZA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EUegT94O6y/oLFnY/xFllgtadu3tCxCTmvnjXwkdTp39H6GVf7Mbl0NpGGQY5w7GKaN2tKl6Z98CglJjlIyoWCOsx+cOJ8vdw04G+RGZkEM2QhbGsCfEfMPfBowDfijBe0nO80vbdpcGff6HJ9rSRh2VUrOHsnAzwCJ/KBstliM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Eaa+doSV; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Eaa+doSV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DD351F000E9; Mon, 6 Jul 2026 23:51:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1783381908; bh=5hhl8bdTpP0RsT+ma5bYN0eXdk0MqbMfiX3ZJdwj/90=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Eaa+doSVM6sgdpj5wKKwA1LLUsFBEkJBZghgEXrj5Xg7EvjrWd+p6Rv4wj96bq0kH s/0wQ9cjEbzUme38wyh3tm2JpKOOe9bHOih9ndLQlWTLijc4ToWd7qjtnTn/QlDVNV uG8pMOQquwzfxpXlKGWoHDf+X7oTd68P4pP64MFMKUsiSCA2d2bEhwgnD0bGawLw0r mhMWNIM2AY+ThwcouTqVMiATjujdBpONH9D2KLszlS7AWO+Kp3NB2o93Lp3CqQWsRV zpagWybXNNbUZbT8rQbNH8tu+xJE0/h5/PJ1nRvhPEuzysWqyfsOOGjmnQsdhd9oNQ Mf4XkciPT+UIA== From: Song Liu To: linux-security-module@vger.kernel.org, linux-fsdevel@vger.kernel.org, selinux@vger.kernel.org, apparmor@lists.ubuntu.com Cc: paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com, viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, john.johansen@canonical.com, stephen.smalley.work@gmail.com, omosnace@redhat.com, mic@digikod.net, gnoack@google.com, takedakn@nttdata.co.jp, penguin-kernel@I-love.SAKURA.ne.jp, herton@canonical.com, kernel-team@meta.com, Song Liu Subject: [PATCH v6 8/8] lsm: Remove security_sb_mount and security_move_mount Date: Mon, 6 Jul 2026 16:50:53 -0700 Message-ID: <20260706235053.4104951-9-song@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260706235053.4104951-1-song@kernel.org> References: <20260706235053.4104951-1-song@kernel.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Now that all LSMs have been converted to granular mount hooks and fs/namespace.c calls the new hooks, remove the old hooks: - security_sb_mount(): removed from lsm_hook_defs.h, security.h, security.c. - security_move_mount(): removed from lsm_hook_defs.h, security.h, security.c, and bpf_lsm.c. Code generated with the assistance of Claude, reviewed by human. Reviewed-by: Stephen Smalley Tested-by: Stephen Smalley # for selinux only Signed-off-by: Song Liu --- include/linux/lsm_hook_defs.h | 4 ---- include/linux/security.h | 16 --------------- kernel/bpf/bpf_lsm.c | 2 -- security/security.c | 38 ----------------------------------- 4 files changed, 60 deletions(-) diff --git a/include/linux/lsm_hook_defs.h b/include/linux/lsm_hook_defs.h index 06c904cb478e..4015f6b579c3 100644 --- a/include/linux/lsm_hook_defs.h +++ b/include/linux/lsm_hook_defs.h @@ -69,8 +69,6 @@ LSM_HOOK(int, 0, sb_remount, struct super_block *sb, void *mnt_opts) LSM_HOOK(int, 0, sb_kern_mount, const struct super_block *sb) LSM_HOOK(int, 0, sb_show_options, struct seq_file *m, struct super_block *sb) LSM_HOOK(int, 0, sb_statfs, struct dentry *dentry) -LSM_HOOK(int, 0, sb_mount, const char *dev_name, const struct path *path, - const char *type, unsigned long flags, void *data) LSM_HOOK(int, 0, sb_umount, struct vfsmount *mnt, int flags) LSM_HOOK(int, 0, sb_pivotroot, const struct path *old_path, const struct path *new_path) @@ -79,8 +77,6 @@ LSM_HOOK(int, 0, sb_set_mnt_opts, struct super_block *sb, void *mnt_opts, LSM_HOOK(int, 0, sb_clone_mnt_opts, const struct super_block *oldsb, struct super_block *newsb, unsigned long kern_flags, unsigned long *set_kern_flags) -LSM_HOOK(int, 0, move_mount, const struct path *from_path, - const struct path *to_path) LSM_HOOK(int, 0, mount_bind, const struct path *from, const struct path *to, bool recurse) LSM_HOOK(int, 0, mount_new, struct fs_context *fc, const struct path *mp, diff --git a/include/linux/security.h b/include/linux/security.h index 5e207e38c004..ff16831e8064 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -373,8 +373,6 @@ int security_sb_remount(struct super_block *sb, void *mnt_opts); int security_sb_kern_mount(const struct super_block *sb); int security_sb_show_options(struct seq_file *m, struct super_block *sb); int security_sb_statfs(struct dentry *dentry); -int security_sb_mount(const char *dev_name, const struct path *path, - const char *type, unsigned long flags, void *data); int security_sb_umount(struct vfsmount *mnt, int flags); int security_sb_pivotroot(const struct path *old_path, const struct path *new_path); int security_sb_set_mnt_opts(struct super_block *sb, @@ -385,7 +383,6 @@ int security_sb_clone_mnt_opts(const struct super_block *oldsb, struct super_block *newsb, unsigned long kern_flags, unsigned long *set_kern_flags); -int security_move_mount(const struct path *from_path, const struct path *to_path); int security_mount_bind(const struct path *from, const struct path *to, bool recurse); int security_mount_new(struct fs_context *fc, const struct path *mp, @@ -826,13 +823,6 @@ static inline int security_sb_statfs(struct dentry *dentry) return 0; } -static inline int security_sb_mount(const char *dev_name, const struct path *path, - const char *type, unsigned long flags, - void *data) -{ - return 0; -} - static inline int security_sb_umount(struct vfsmount *mnt, int flags) { return 0; @@ -860,12 +850,6 @@ static inline int security_sb_clone_mnt_opts(const struct super_block *oldsb, return 0; } -static inline int security_move_mount(const struct path *from_path, - const struct path *to_path) -{ - return 0; -} - static inline int security_mount_bind(const struct path *from, const struct path *to, bool recurse) { diff --git a/kernel/bpf/bpf_lsm.c b/kernel/bpf/bpf_lsm.c index 4b1ee9c67d6f..9cece66a0c49 100644 --- a/kernel/bpf/bpf_lsm.c +++ b/kernel/bpf/bpf_lsm.c @@ -353,7 +353,6 @@ BTF_ID(func, bpf_lsm_release_secctx) BTF_ID(func, bpf_lsm_sb_alloc_security) BTF_ID(func, bpf_lsm_sb_eat_lsm_opts) BTF_ID(func, bpf_lsm_sb_kern_mount) -BTF_ID(func, bpf_lsm_sb_mount) BTF_ID(func, bpf_lsm_sb_remount) BTF_ID(func, bpf_lsm_sb_set_mnt_opts) BTF_ID(func, bpf_lsm_sb_show_options) @@ -385,7 +384,6 @@ BTF_ID(func, bpf_lsm_task_setscheduler) BTF_ID(func, bpf_lsm_userns_create) BTF_ID(func, bpf_lsm_bdev_alloc_security) BTF_ID(func, bpf_lsm_bdev_setintegrity) -BTF_ID(func, bpf_lsm_move_mount) BTF_ID(func, bpf_lsm_mount_bind) BTF_ID(func, bpf_lsm_mount_new) BTF_ID(func, bpf_lsm_mount_remount) diff --git a/security/security.c b/security/security.c index 1ede060db3ca..0456680738f2 100644 --- a/security/security.c +++ b/security/security.c @@ -1065,29 +1065,6 @@ int security_sb_statfs(struct dentry *dentry) return call_int_hook(sb_statfs, dentry); } -/** - * security_sb_mount() - Check permission for mounting a filesystem - * @dev_name: filesystem backing device - * @path: mount point - * @type: filesystem type - * @flags: mount flags - * @data: filesystem specific data - * - * Check permission before an object specified by @dev_name is mounted on the - * mount point named by @nd. For an ordinary mount, @dev_name identifies a - * device if the file system type requires a device. For a remount - * (@flags & MS_REMOUNT), @dev_name is irrelevant. For a loopback/bind mount - * (@flags & MS_BIND), @dev_name identifies the pathname of the object being - * mounted. - * - * Return: Returns 0 if permission is granted. - */ -int security_sb_mount(const char *dev_name, const struct path *path, - const char *type, unsigned long flags, void *data) -{ - return call_int_hook(sb_mount, dev_name, path, type, flags, data); -} - /** * security_sb_umount() - Check permission for unmounting a filesystem * @mnt: mounted filesystem @@ -1167,21 +1144,6 @@ int security_sb_clone_mnt_opts(const struct super_block *oldsb, } EXPORT_SYMBOL(security_sb_clone_mnt_opts); -/** - * security_move_mount() - Check permissions for moving a mount - * @from_path: source mount point - * @to_path: destination mount point - * - * Check permission before a mount is moved. - * - * Return: Returns 0 if permission is granted. - */ -int security_move_mount(const struct path *from_path, - const struct path *to_path) -{ - return call_int_hook(move_mount, from_path, to_path); -} - /** * security_mount_bind() - Check permissions for a bind mount * @from: source path -- 2.53.0-Meta