linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND] fs_context: drop the unused lsm_flags member
@ 2023-03-16 13:07 Ondrej Mosnacek
  2023-03-16 13:46 ` Christian Brauner
  0 siblings, 1 reply; 2+ messages in thread
From: Ondrej Mosnacek @ 2023-03-16 13:07 UTC (permalink / raw)
  To: linux-fsdevel, Al Viro, Christian Brauner
  Cc: linux-security-module, linux-nfs

This isn't ever used by VFS now, and it couldn't even work. Any FS that
uses the SECURITY_LSM_NATIVE_LABELS flag needs to also process the
value returned back from the LSM, so it needs to do its
security_sb_set_mnt_opts() call on its own anyway.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
---

Resending because of no response for almost 2 years...

Previous submission:
https://lore.kernel.org/linux-fsdevel/20210409111234.271707-1-omosnace@redhat.com/

 Documentation/filesystems/mount_api.rst | 1 -
 fs/nfs/super.c                          | 3 ---
 include/linux/fs_context.h              | 1 -
 include/linux/security.h                | 2 +-
 4 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/Documentation/filesystems/mount_api.rst b/Documentation/filesystems/mount_api.rst
index 63204d2094fdf..9aaf6ef75eb53 100644
--- a/Documentation/filesystems/mount_api.rst
+++ b/Documentation/filesystems/mount_api.rst
@@ -79,7 +79,6 @@ context.  This is represented by the fs_context structure::
 		unsigned int		sb_flags;
 		unsigned int		sb_flags_mask;
 		unsigned int		s_iflags;
-		unsigned int		lsm_flags;
 		enum fs_context_purpose	purpose:8;
 		...
 	};
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 05ae23657527d..397c096d874eb 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1274,9 +1274,6 @@ int nfs_get_tree_common(struct fs_context *fc)
 		if (ctx->clone_data.sb->s_flags & SB_SYNCHRONOUS)
 			fc->sb_flags |= SB_SYNCHRONOUS;
 
-	if (server->caps & NFS_CAP_SECURITY_LABEL)
-		fc->lsm_flags |= SECURITY_LSM_NATIVE_LABELS;
-
 	/* Get a superblock - note that we may end up sharing one that already exists */
 	fc->s_fs_info = server;
 	s = sget_fc(fc, compare_super, nfs_set_super);
diff --git a/include/linux/fs_context.h b/include/linux/fs_context.h
index 5469ffee21c73..ff6341e09925b 100644
--- a/include/linux/fs_context.h
+++ b/include/linux/fs_context.h
@@ -104,7 +104,6 @@ struct fs_context {
 	unsigned int		sb_flags;	/* Proposed superblock flags (SB_*) */
 	unsigned int		sb_flags_mask;	/* Superblock flags that were changed */
 	unsigned int		s_iflags;	/* OR'd with sb->s_iflags */
-	unsigned int		lsm_flags;	/* Information flags from the fs to the LSM */
 	enum fs_context_purpose	purpose:8;
 	enum fs_context_phase	phase:8;	/* The phase the context is in */
 	bool			need_free:1;	/* Need to call ops->free() */
diff --git a/include/linux/security.h b/include/linux/security.h
index 5984d0d550b41..db9b659b02b91 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -68,7 +68,7 @@ struct watch_notification;
 /* If capable is being called by a setid function */
 #define CAP_OPT_INSETID BIT(2)
 
-/* LSM Agnostic defines for fs_context::lsm_flags */
+/* LSM Agnostic defines for security_sb_set_mnt_opts() flags */
 #define SECURITY_LSM_NATIVE_LABELS	1
 
 struct ctl_table;
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH RESEND] fs_context: drop the unused lsm_flags member
  2023-03-16 13:07 [PATCH RESEND] fs_context: drop the unused lsm_flags member Ondrej Mosnacek
@ 2023-03-16 13:46 ` Christian Brauner
  0 siblings, 0 replies; 2+ messages in thread
From: Christian Brauner @ 2023-03-16 13:46 UTC (permalink / raw)
  To: Ondrej Mosnacek
  Cc: Christian Brauner, linux-security-module, linux-nfs,
	linux-fsdevel, Al Viro

From: Christian Brauner (Microsoft) <brauner@kernel.org>


On Thu, 16 Mar 2023 14:07:51 +0100, Ondrej Mosnacek wrote:
> This isn't ever used by VFS now, and it couldn't even work. Any FS that
> uses the SECURITY_LSM_NATIVE_LABELS flag needs to also process the
> value returned back from the LSM, so it needs to do its
> security_sb_set_mnt_opts() call on its own anyway.
> 
> 

Seems indeed unused currently. I don't see fc->lsm_flags being used after
having been set. So applied. Please yell, if there's some subtle place where
this should matter after all,

tree: git://git.kernel.org/pub/scm/linux/kernel/git/vfs/idmapping.git
branch: fs.misc

[1/1] fs_context: drop the unused lsm_flags member
      commit: 4e04143c869c5b6d499fbd5083caa860d5c942c3

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-16 13:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-16 13:07 [PATCH RESEND] fs_context: drop the unused lsm_flags member Ondrej Mosnacek
2023-03-16 13:46 ` Christian Brauner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).