Linux-Fsdevel Archive on lore.kernel.org
help / color / mirror / Atom feed
* [RESEND] [PATCHv4 1/2] uapi: fuse: Add FUSE_SECURITY_CTX
@ 2020-07-22  9:07 Chirantan Ekbote
  2020-07-22  9:07 ` [RESEND] [PATCHv4 2/2] fuse: Call security hooks on new inodes Chirantan Ekbote
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Chirantan Ekbote @ 2020-07-22  9:07 UTC (permalink / raw)
  To: Miklos Szeredi, Stephen Smalley
  Cc: Vivek Goyal, Stefan Hajnoczi, linux-fsdevel, virtio-fs,
	Dylan Reid, Suleiman Souhlal, fuse-devel, selinux,
	Chirantan Ekbote

Add the FUSE_SECURITY_CTX flag for the `flags` field of the
fuse_init_out struct.  When this flag is set the kernel will append the
security context for a newly created inode to the request (create,
mkdir, mknod, and symlink).  The server is responsible for ensuring that
the inode appears atomically with the requested security context.

For example, if the server is backed by a "real" linux file system then
it can write the security context value to
/proc/thread-self/attr/fscreate before making the syscall to create the
inode.

Signed-off-by: Chirantan Ekbote <chirantan@chromium.org>
---
Changes in v4:
  * Added signoff to commit message.

 include/uapi/linux/fuse.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h
index 373cada898159..e2099b45fd44b 100644
--- a/include/uapi/linux/fuse.h
+++ b/include/uapi/linux/fuse.h
@@ -172,6 +172,10 @@
  *  - add FUSE_WRITE_KILL_PRIV flag
  *  - add FUSE_SETUPMAPPING and FUSE_REMOVEMAPPING
  *  - add map_alignment to fuse_init_out, add FUSE_MAP_ALIGNMENT flag
+ *
+ *  7.32
+ *  - add FUSE_SECURITY_CTX flag for fuse_init_out
+ *  - add security context to create, mkdir, symlink, and mknod requests
  */
 
 #ifndef _LINUX_FUSE_H
@@ -207,7 +211,7 @@
 #define FUSE_KERNEL_VERSION 7
 
 /** Minor version number of this interface */
-#define FUSE_KERNEL_MINOR_VERSION 31
+#define FUSE_KERNEL_MINOR_VERSION 32
 
 /** The node ID of the root inode */
 #define FUSE_ROOT_ID 1
@@ -314,6 +318,7 @@ struct fuse_file_lock {
  * FUSE_NO_OPENDIR_SUPPORT: kernel supports zero-message opendir
  * FUSE_EXPLICIT_INVAL_DATA: only invalidate cached pages on explicit request
  * FUSE_MAP_ALIGNMENT: map_alignment field is valid
+ * FUSE_SECURITY_CTX: add security context to create, mkdir, symlink, and mknod
  */
 #define FUSE_ASYNC_READ		(1 << 0)
 #define FUSE_POSIX_LOCKS	(1 << 1)
@@ -342,6 +347,7 @@ struct fuse_file_lock {
 #define FUSE_NO_OPENDIR_SUPPORT (1 << 24)
 #define FUSE_EXPLICIT_INVAL_DATA (1 << 25)
 #define FUSE_MAP_ALIGNMENT	(1 << 26)
+#define FUSE_SECURITY_CTX	(1 << 27)
 
 /**
  * CUSE INIT request/reply flags
-- 
2.27.0.383.g050319c2ae-goog


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

* [RESEND] [PATCHv4 2/2] fuse: Call security hooks on new inodes
  2020-07-22  9:07 [RESEND] [PATCHv4 1/2] uapi: fuse: Add FUSE_SECURITY_CTX Chirantan Ekbote
@ 2020-07-22  9:07 ` Chirantan Ekbote
  2020-08-14  5:20 ` [RESEND] [PATCHv4 1/2] uapi: fuse: Add FUSE_SECURITY_CTX Chirantan Ekbote
  2021-06-14 21:28 ` Vivek Goyal
  2 siblings, 0 replies; 7+ messages in thread
From: Chirantan Ekbote @ 2020-07-22  9:07 UTC (permalink / raw)
  To: Miklos Szeredi, Stephen Smalley
  Cc: Vivek Goyal, Stefan Hajnoczi, linux-fsdevel, virtio-fs,
	Dylan Reid, Suleiman Souhlal, fuse-devel, selinux,
	Chirantan Ekbote

Add a new `init_security` field to `fuse_conn` that controls whether we
initialize security when a new inode is created.  Set this to true when
the `flags` field of the fuse_init_out struct contains
FUSE_SECURITY_CTX.

When set to true, get the security context for a newly created inode via
`security_dentry_init_security` and append it to the create, mkdir,
mknod, and symlink requests.

Signed-off-by: Chirantan Ekbote <chirantan@chromium.org>
---
Changes in v4:
  * Added signoff to commit message.
  * Fixed style warnings reported by checkpatch.pl.

Changes in v3:
  * Moved uapi changes into a separate patch.
  * Refactored duplicated common code into create_new_entry.
  * Dropped check if security_ctxlen > 0 since kfree can handle NULL.

Changes in v2:
  * Added the FUSE_SECURITY_CTX flag for init_out responses.
  * Switched to security_dentry_init_security.
  * Send security context with create, mknod, mkdir, and symlink
    requests instead of applying it after creation.

 fs/fuse/dir.c    | 60 ++++++++++++++++++++++++++++++++++++++++++++----
 fs/fuse/fuse_i.h |  3 +++
 fs/fuse/inode.c  |  5 +++-
 3 files changed, 62 insertions(+), 6 deletions(-)

diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index ee190119f45cc..c6791c49afe4d 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -16,6 +16,9 @@
 #include <linux/xattr.h>
 #include <linux/iversion.h>
 #include <linux/posix_acl.h>
+#include <linux/security.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
 
 static void fuse_advise_use_readdirplus(struct inode *dir)
 {
@@ -442,6 +445,8 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry,
 	struct fuse_entry_out outentry;
 	struct fuse_inode *fi;
 	struct fuse_file *ff;
+	void *security_ctx = NULL;
+	u32 security_ctxlen = 0;
 
 	/* Userspace expects S_IFREG in create mode */
 	BUG_ON((mode & S_IFMT) != S_IFREG);
@@ -477,6 +482,21 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry,
 	args.out_args[0].value = &outentry;
 	args.out_args[1].size = sizeof(outopen);
 	args.out_args[1].value = &outopen;
+
+	if (fc->init_security) {
+		err = security_dentry_init_security(entry, mode, &entry->d_name,
+						    &security_ctx,
+						    &security_ctxlen);
+		if (err)
+			goto out_put_forget_req;
+
+		if (security_ctxlen > 0) {
+			args.in_numargs = 3;
+			args.in_args[2].size = security_ctxlen;
+			args.in_args[2].value = security_ctx;
+		}
+	}
+
 	err = fuse_simple_request(fc, &args);
 	if (err)
 		goto out_free_ff;
@@ -513,6 +533,7 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry,
 	return err;
 
 out_free_ff:
+	kfree(security_ctx);
 	fuse_file_free(ff);
 out_put_forget_req:
 	kfree(forget);
@@ -569,13 +590,15 @@ static int fuse_atomic_open(struct inode *dir, struct dentry *entry,
  */
 static int create_new_entry(struct fuse_conn *fc, struct fuse_args *args,
 			    struct inode *dir, struct dentry *entry,
-			    umode_t mode)
+			    umode_t mode, bool init_security)
 {
 	struct fuse_entry_out outarg;
 	struct inode *inode;
 	struct dentry *d;
 	int err;
 	struct fuse_forget_link *forget;
+	void *security_ctx = NULL;
+	u32 security_ctxlen = 0;
 
 	forget = fuse_alloc_forget();
 	if (!forget)
@@ -586,7 +609,29 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_args *args,
 	args->out_numargs = 1;
 	args->out_args[0].size = sizeof(outarg);
 	args->out_args[0].value = &outarg;
+
+	if (init_security) {
+		unsigned short idx = args->in_numargs;
+
+		if ((size_t)idx >= ARRAY_SIZE(args->in_args))
+			return -ENOMEM;
+
+		err = security_dentry_init_security(entry, mode, &entry->d_name,
+						    &security_ctx,
+						    &security_ctxlen);
+		if (err)
+			return err;
+
+		if (security_ctxlen > 0) {
+			args->in_args[idx].size = security_ctxlen;
+			args->in_args[idx].value = security_ctx;
+			args->in_numargs++;
+		}
+	}
+
 	err = fuse_simple_request(fc, args);
+	kfree(security_ctx);
+
 	if (err)
 		goto out_put_forget_req;
 
@@ -644,7 +689,8 @@ static int fuse_mknod(struct inode *dir, struct dentry *entry, umode_t mode,
 	args.in_args[0].value = &inarg;
 	args.in_args[1].size = entry->d_name.len + 1;
 	args.in_args[1].value = entry->d_name.name;
-	return create_new_entry(fc, &args, dir, entry, mode);
+
+	return create_new_entry(fc, &args, dir, entry, mode, fc->init_security);
 }
 
 static int fuse_create(struct inode *dir, struct dentry *entry, umode_t mode,
@@ -671,7 +717,9 @@ static int fuse_mkdir(struct inode *dir, struct dentry *entry, umode_t mode)
 	args.in_args[0].value = &inarg;
 	args.in_args[1].size = entry->d_name.len + 1;
 	args.in_args[1].value = entry->d_name.name;
-	return create_new_entry(fc, &args, dir, entry, S_IFDIR);
+
+	return create_new_entry(fc, &args, dir, entry, S_IFDIR,
+				fc->init_security);
 }
 
 static int fuse_symlink(struct inode *dir, struct dentry *entry,
@@ -687,7 +735,9 @@ static int fuse_symlink(struct inode *dir, struct dentry *entry,
 	args.in_args[0].value = entry->d_name.name;
 	args.in_args[1].size = len;
 	args.in_args[1].value = link;
-	return create_new_entry(fc, &args, dir, entry, S_IFLNK);
+
+	return create_new_entry(fc, &args, dir, entry, S_IFLNK,
+				fc->init_security);
 }
 
 void fuse_update_ctime(struct inode *inode)
@@ -858,7 +908,7 @@ static int fuse_link(struct dentry *entry, struct inode *newdir,
 	args.in_args[0].value = &inarg;
 	args.in_args[1].size = newent->d_name.len + 1;
 	args.in_args[1].value = newent->d_name.name;
-	err = create_new_entry(fc, &args, newdir, newent, inode->i_mode);
+	err = create_new_entry(fc, &args, newdir, newent, inode->i_mode, false);
 	/* Contrary to "normal" filesystems it can happen that link
 	   makes two "logical" inodes point to the same "physical"
 	   inode.  We invalidate the attributes of the old one, so it
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index d7cde216fc871..dd7422d83da3d 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -720,6 +720,9 @@ struct fuse_conn {
 	/* Do not show mount options */
 	unsigned int no_mount_options:1;
 
+	/* Initialize security xattrs when creating a new inode */
+	unsigned int init_security : 1;
+
 	/** The number of requests waiting for completion */
 	atomic_t num_waiting;
 
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 16aec32f7f3d7..1a311771c5555 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -951,6 +951,8 @@ static void process_init_reply(struct fuse_conn *fc, struct fuse_args *args,
 					min_t(unsigned int, FUSE_MAX_MAX_PAGES,
 					max_t(unsigned int, arg->max_pages, 1));
 			}
+			if (arg->flags & FUSE_SECURITY_CTX)
+				fc->init_security = 1;
 		} else {
 			ra_pages = fc->max_read / PAGE_SIZE;
 			fc->no_lock = 1;
@@ -988,7 +990,8 @@ void fuse_send_init(struct fuse_conn *fc)
 		FUSE_WRITEBACK_CACHE | FUSE_NO_OPEN_SUPPORT |
 		FUSE_PARALLEL_DIROPS | FUSE_HANDLE_KILLPRIV | FUSE_POSIX_ACL |
 		FUSE_ABORT_ERROR | FUSE_MAX_PAGES | FUSE_CACHE_SYMLINKS |
-		FUSE_NO_OPENDIR_SUPPORT | FUSE_EXPLICIT_INVAL_DATA;
+		FUSE_NO_OPENDIR_SUPPORT | FUSE_EXPLICIT_INVAL_DATA |
+		FUSE_SECURITY_CTX;
 	ia->args.opcode = FUSE_INIT;
 	ia->args.in_numargs = 1;
 	ia->args.in_args[0].size = sizeof(ia->in);
-- 
2.27.0.383.g050319c2ae-goog


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

* Re: [RESEND] [PATCHv4 1/2] uapi: fuse: Add FUSE_SECURITY_CTX
  2020-07-22  9:07 [RESEND] [PATCHv4 1/2] uapi: fuse: Add FUSE_SECURITY_CTX Chirantan Ekbote
  2020-07-22  9:07 ` [RESEND] [PATCHv4 2/2] fuse: Call security hooks on new inodes Chirantan Ekbote
@ 2020-08-14  5:20 ` Chirantan Ekbote
  2020-08-14 15:44   ` Casey Schaufler
  2021-06-14 21:28 ` Vivek Goyal
  2 siblings, 1 reply; 7+ messages in thread
From: Chirantan Ekbote @ 2020-08-14  5:20 UTC (permalink / raw)
  To: Miklos Szeredi, Stephen Smalley
  Cc: Vivek Goyal, Stefan Hajnoczi, Linux FS Devel, virtio-fs-list,
	Dylan Reid, Suleiman Souhlal, fuse-devel, SElinux list

On Wed, Jul 22, 2020 at 6:09 PM Chirantan Ekbote <chirantan@chromium.org> wrote:
>
> Add the FUSE_SECURITY_CTX flag for the `flags` field of the
> fuse_init_out struct.  When this flag is set the kernel will append the
> security context for a newly created inode to the request (create,
> mkdir, mknod, and symlink).  The server is responsible for ensuring that
> the inode appears atomically with the requested security context.
>
> For example, if the server is backed by a "real" linux file system then
> it can write the security context value to
> /proc/thread-self/attr/fscreate before making the syscall to create the
> inode.
>

Friendly ping. Will this (and the next patch in the series) be merged into 5.9?

Chirantan


Chirantan

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

* Re: [RESEND] [PATCHv4 1/2] uapi: fuse: Add FUSE_SECURITY_CTX
  2020-08-14  5:20 ` [RESEND] [PATCHv4 1/2] uapi: fuse: Add FUSE_SECURITY_CTX Chirantan Ekbote
@ 2020-08-14 15:44   ` Casey Schaufler
  0 siblings, 0 replies; 7+ messages in thread
From: Casey Schaufler @ 2020-08-14 15:44 UTC (permalink / raw)
  To: Chirantan Ekbote, Miklos Szeredi, Stephen Smalley
  Cc: Vivek Goyal, Stefan Hajnoczi, Linux FS Devel, virtio-fs-list,
	Dylan Reid, Suleiman Souhlal, fuse-devel, SElinux list,
	Casey Schaufler

On 8/13/2020 10:20 PM, Chirantan Ekbote wrote:
> On Wed, Jul 22, 2020 at 6:09 PM Chirantan Ekbote <chirantan@chromium.org> wrote:
>> Add the FUSE_SECURITY_CTX flag for the `flags` field of the
>> fuse_init_out struct.  When this flag is set the kernel will append the
>> security context for a newly created inode to the request (create,
>> mkdir, mknod, and symlink).  The server is responsible for ensuring that
>> the inode appears atomically with the requested security context.
>>
>> For example, if the server is backed by a "real" linux file system then
>> it can write the security context value to
>> /proc/thread-self/attr/fscreate before making the syscall to create the
>> inode.
>>
> Friendly ping. Will this (and the next patch in the series) be merged into 5.9?

This really needed to go to the LSM List <linux-security-module@vger.kernel.org>.


>
> Chirantan
>
>
> Chirantan

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

* Re: [RESEND] [PATCHv4 1/2] uapi: fuse: Add FUSE_SECURITY_CTX
  2020-07-22  9:07 [RESEND] [PATCHv4 1/2] uapi: fuse: Add FUSE_SECURITY_CTX Chirantan Ekbote
  2020-07-22  9:07 ` [RESEND] [PATCHv4 2/2] fuse: Call security hooks on new inodes Chirantan Ekbote
  2020-08-14  5:20 ` [RESEND] [PATCHv4 1/2] uapi: fuse: Add FUSE_SECURITY_CTX Chirantan Ekbote
@ 2021-06-14 21:28 ` Vivek Goyal
  2021-06-15  9:35   ` Chirantan Ekbote
  2 siblings, 1 reply; 7+ messages in thread
From: Vivek Goyal @ 2021-06-14 21:28 UTC (permalink / raw)
  To: Chirantan Ekbote
  Cc: Miklos Szeredi, Stephen Smalley, Stefan Hajnoczi, linux-fsdevel,
	virtio-fs, Dylan Reid, Suleiman Souhlal, fuse-devel, selinux

On Wed, Jul 22, 2020 at 06:07:57PM +0900, Chirantan Ekbote wrote:
> Add the FUSE_SECURITY_CTX flag for the `flags` field of the
> fuse_init_out struct.  When this flag is set the kernel will append the
> security context for a newly created inode to the request (create,
> mkdir, mknod, and symlink).  The server is responsible for ensuring that
> the inode appears atomically with the requested security context.
> 
> For example, if the server is backed by a "real" linux file system then
> it can write the security context value to
> /proc/thread-self/attr/fscreate before making the syscall to create the
> inode.
> 
> Signed-off-by: Chirantan Ekbote <chirantan@chromium.org>

Hi Chirantan,

I am wondering what's the status of this work now. Looks like it
was not merged.

We also need the capability to set selinux security xattrs on newly
created files in virtiofs.  

Will you be interested in reviving this work and send patches again
and copy the selinux as well as linux security module list
(linux-security-module@vger.kernel.org) as suggested by casey.

How are you managing in the meantime. Carrying patches in your own
kernel?

Thanks
Vivek

> ---
> Changes in v4:
>   * Added signoff to commit message.
> 
>  include/uapi/linux/fuse.h | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h
> index 373cada898159..e2099b45fd44b 100644
> --- a/include/uapi/linux/fuse.h
> +++ b/include/uapi/linux/fuse.h
> @@ -172,6 +172,10 @@
>   *  - add FUSE_WRITE_KILL_PRIV flag
>   *  - add FUSE_SETUPMAPPING and FUSE_REMOVEMAPPING
>   *  - add map_alignment to fuse_init_out, add FUSE_MAP_ALIGNMENT flag
> + *
> + *  7.32
> + *  - add FUSE_SECURITY_CTX flag for fuse_init_out
> + *  - add security context to create, mkdir, symlink, and mknod requests
>   */
>  
>  #ifndef _LINUX_FUSE_H
> @@ -207,7 +211,7 @@
>  #define FUSE_KERNEL_VERSION 7
>  
>  /** Minor version number of this interface */
> -#define FUSE_KERNEL_MINOR_VERSION 31
> +#define FUSE_KERNEL_MINOR_VERSION 32
>  
>  /** The node ID of the root inode */
>  #define FUSE_ROOT_ID 1
> @@ -314,6 +318,7 @@ struct fuse_file_lock {
>   * FUSE_NO_OPENDIR_SUPPORT: kernel supports zero-message opendir
>   * FUSE_EXPLICIT_INVAL_DATA: only invalidate cached pages on explicit request
>   * FUSE_MAP_ALIGNMENT: map_alignment field is valid
> + * FUSE_SECURITY_CTX: add security context to create, mkdir, symlink, and mknod
>   */
>  #define FUSE_ASYNC_READ		(1 << 0)
>  #define FUSE_POSIX_LOCKS	(1 << 1)
> @@ -342,6 +347,7 @@ struct fuse_file_lock {
>  #define FUSE_NO_OPENDIR_SUPPORT (1 << 24)
>  #define FUSE_EXPLICIT_INVAL_DATA (1 << 25)
>  #define FUSE_MAP_ALIGNMENT	(1 << 26)
> +#define FUSE_SECURITY_CTX	(1 << 27)
>  
>  /**
>   * CUSE INIT request/reply flags
> -- 
> 2.27.0.383.g050319c2ae-goog
> 


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

* Re: [RESEND] [PATCHv4 1/2] uapi: fuse: Add FUSE_SECURITY_CTX
  2021-06-14 21:28 ` Vivek Goyal
@ 2021-06-15  9:35   ` Chirantan Ekbote
  2021-06-15 13:32     ` Vivek Goyal
  0 siblings, 1 reply; 7+ messages in thread
From: Chirantan Ekbote @ 2021-06-15  9:35 UTC (permalink / raw)
  To: Vivek Goyal
  Cc: Miklos Szeredi, Stephen Smalley, Stefan Hajnoczi, Linux FS Devel,
	virtio-fs-list, Dylan Reid, Suleiman Souhlal, fuse-devel,
	SElinux list

Hi Vivek,

On Tue, Jun 15, 2021 at 6:28 AM Vivek Goyal <vgoyal@redhat.com> wrote:
>
> On Wed, Jul 22, 2020 at 06:07:57PM +0900, Chirantan Ekbote wrote:
> > Add the FUSE_SECURITY_CTX flag for the `flags` field of the
> > fuse_init_out struct.  When this flag is set the kernel will append the
> > security context for a newly created inode to the request (create,
> > mkdir, mknod, and symlink).  The server is responsible for ensuring that
> > the inode appears atomically with the requested security context.
> >
> > For example, if the server is backed by a "real" linux file system then
> > it can write the security context value to
> > /proc/thread-self/attr/fscreate before making the syscall to create the
> > inode.
> >
> > Signed-off-by: Chirantan Ekbote <chirantan@chromium.org>
>
> Hi Chirantan,
>
> I am wondering what's the status of this work now. Looks like it
> was not merged.
>
> We also need the capability to set selinux security xattrs on newly
> created files in virtiofs.
>
> Will you be interested in reviving this work and send patches again
> and copy the selinux as well as linux security module list
> (linux-security-module@vger.kernel.org) as suggested by casey.
>

Not really.  We have our own local solution for this (see below) so if
you or someone else wants to pick it up, please go ahead.

> How are you managing in the meantime. Carrying patches in your own
> kernel?
>

Kind of. This patch series changes the protocol and the feature bit we
were using was claimed by FUSE_SUBMOUNTS instead so carrying it
locally is not really viable long term.  Instead we're carrying a
patch similar to the original RFC patch that doesn't change the
protocol [1].

Chirantan

[1]: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2581172

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

* Re: [RESEND] [PATCHv4 1/2] uapi: fuse: Add FUSE_SECURITY_CTX
  2021-06-15  9:35   ` Chirantan Ekbote
@ 2021-06-15 13:32     ` Vivek Goyal
  0 siblings, 0 replies; 7+ messages in thread
From: Vivek Goyal @ 2021-06-15 13:32 UTC (permalink / raw)
  To: Chirantan Ekbote
  Cc: Miklos Szeredi, Stephen Smalley, Stefan Hajnoczi, Linux FS Devel,
	virtio-fs-list, Dylan Reid, Suleiman Souhlal, fuse-devel,
	SElinux list

On Tue, Jun 15, 2021 at 06:35:21PM +0900, Chirantan Ekbote wrote:
> Hi Vivek,
> 
> On Tue, Jun 15, 2021 at 6:28 AM Vivek Goyal <vgoyal@redhat.com> wrote:
> >
> > On Wed, Jul 22, 2020 at 06:07:57PM +0900, Chirantan Ekbote wrote:
> > > Add the FUSE_SECURITY_CTX flag for the `flags` field of the
> > > fuse_init_out struct.  When this flag is set the kernel will append the
> > > security context for a newly created inode to the request (create,
> > > mkdir, mknod, and symlink).  The server is responsible for ensuring that
> > > the inode appears atomically with the requested security context.
> > >
> > > For example, if the server is backed by a "real" linux file system then
> > > it can write the security context value to
> > > /proc/thread-self/attr/fscreate before making the syscall to create the
> > > inode.
> > >
> > > Signed-off-by: Chirantan Ekbote <chirantan@chromium.org>
> >
> > Hi Chirantan,
> >
> > I am wondering what's the status of this work now. Looks like it
> > was not merged.
> >
> > We also need the capability to set selinux security xattrs on newly
> > created files in virtiofs.
> >
> > Will you be interested in reviving this work and send patches again
> > and copy the selinux as well as linux security module list
> > (linux-security-module@vger.kernel.org) as suggested by casey.
> >
> 
> Not really.  We have our own local solution for this (see below) so if
> you or someone else wants to pick it up, please go ahead.
> 

Ok.

> > How are you managing in the meantime. Carrying patches in your own
> > kernel?
> >
> 
> Kind of. This patch series changes the protocol and the feature bit we
> were using was claimed by FUSE_SUBMOUNTS instead so carrying it
> locally is not really viable long term.  Instead we're carrying a
> patch similar to the original RFC patch that doesn't change the
> protocol [1].

Ok, got it. So you went ahead for simpler solution of setting security
xattr after creating file hence making it non-atomic. But changelog
suggests that it works for your use case as you always do a restorecon
on reboot. 

But I guess upstream will need a solution where file creation and
security xattr setting can be atomic.

Thanks. If time permits, I might look into the patches you had posted.

Thanks
Vivek


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

end of thread, other threads:[~2021-06-15 13:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-22  9:07 [RESEND] [PATCHv4 1/2] uapi: fuse: Add FUSE_SECURITY_CTX Chirantan Ekbote
2020-07-22  9:07 ` [RESEND] [PATCHv4 2/2] fuse: Call security hooks on new inodes Chirantan Ekbote
2020-08-14  5:20 ` [RESEND] [PATCHv4 1/2] uapi: fuse: Add FUSE_SECURITY_CTX Chirantan Ekbote
2020-08-14 15:44   ` Casey Schaufler
2021-06-14 21:28 ` Vivek Goyal
2021-06-15  9:35   ` Chirantan Ekbote
2021-06-15 13:32     ` Vivek Goyal

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).