linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Casey Schaufler <casey@schaufler-ca.com>
To: Vivek Goyal <vgoyal@redhat.com>,
	linux-fsdevel@vger.kernel.org, selinux@vger.kernel.org,
	linux-security-module@vger.kernel.org, miklos@szeredi.hu
Cc: virtio-fs@redhat.com, chirantan@chromium.org,
	stephen.smalley.work@gmail.com, dwalsh@redhat.com,
	omosnace@redhat.com, Casey Schaufler <casey@schaufler-ca.com>
Subject: Re: [PATCH v2 1/2] fuse: Add a flag FUSE_SECURITY_CTX
Date: Tue, 12 Oct 2021 12:09:35 -0700	[thread overview]
Message-ID: <2a7afeee-1f34-fb1c-13b1-0af1dcd95b68@schaufler-ca.com> (raw)
In-Reply-To: <20211012180624.447474-2-vgoyal@redhat.com>

On 10/12/2021 11:06 AM, Vivek Goyal 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 (preferrably) 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.

his only works for SELinux, as I've mentioned before. Perhaps:

If the server is using SELinux and backed by a "real" linux file system
that supports extended attributes it can write the security context value
to /proc/thread-self/attr/fscreate before making the syscall to create
the inode.

>
> Vivek:
> This patch is slightly modified version of patch from
> Chirantan Ekbote <chirantan@chromium.org>. I made changes so that this
> patch applies to latest kernel.
>
> Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
> ---
>  include/uapi/linux/fuse.h | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h
> index 36ed092227fa..2fe54c80051a 100644
> --- a/include/uapi/linux/fuse.h
> +++ b/include/uapi/linux/fuse.h
> @@ -184,6 +184,10 @@
>   *
>   *  7.34
>   *  - add FUSE_SYNCFS
> + *
> + *  7.35
> + *  - add FUSE_SECURITY_CTX flag for fuse_init_out
> + *  - add security context to create, mkdir, symlink, and mknod requests
>   */
>  
>  #ifndef _LINUX_FUSE_H
> @@ -219,7 +223,7 @@
>  #define FUSE_KERNEL_VERSION 7
>  
>  /** Minor version number of this interface */
> -#define FUSE_KERNEL_MINOR_VERSION 34
> +#define FUSE_KERNEL_MINOR_VERSION 35
>  
>  /** The node ID of the root inode */
>  #define FUSE_ROOT_ID 1
> @@ -336,6 +340,8 @@ struct fuse_file_lock {
>   *			write/truncate sgid is killed only if file has group
>   *			execute permission. (Same as Linux VFS behavior).
>   * FUSE_SETXATTR_EXT:	Server supports extended struct fuse_setxattr_in
> + * FUSE_SECURITY_CTX:	add security context to create, mkdir, symlink, and
> + * 			mknod
>   */
>  #define FUSE_ASYNC_READ		(1 << 0)
>  #define FUSE_POSIX_LOCKS	(1 << 1)
> @@ -367,6 +373,7 @@ struct fuse_file_lock {
>  #define FUSE_SUBMOUNTS		(1 << 27)
>  #define FUSE_HANDLE_KILLPRIV_V2	(1 << 28)
>  #define FUSE_SETXATTR_EXT	(1 << 29)
> +#define FUSE_SECURITY_CTX	(1 << 30)
>  
>  /**
>   * CUSE INIT request/reply flags

  reply	other threads:[~2021-10-12 19:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-12 18:06 [PATCH v2 0/2] fuse: Send file/inode security context during creation Vivek Goyal
2021-10-12 18:06 ` [PATCH v2 1/2] fuse: Add a flag FUSE_SECURITY_CTX Vivek Goyal
2021-10-12 19:09   ` Casey Schaufler [this message]
2021-10-12 20:38     ` Vivek Goyal
2021-10-12 18:06 ` [PATCH v2 2/2] fuse: Send security context of inode on file creation Vivek Goyal
2021-10-12 18:24   ` Casey Schaufler
2021-10-12 18:34     ` Vivek Goyal
2021-10-12 18:41       ` Casey Schaufler
2021-11-02 14:00   ` Miklos Szeredi
2021-11-02 15:30     ` Vivek Goyal
2021-11-02 15:38       ` Miklos Szeredi
2021-11-02 19:09         ` Vivek Goyal
2021-10-25 15:55 ` [PATCH v2 0/2] fuse: Send file/inode security context during creation Vivek Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2a7afeee-1f34-fb1c-13b1-0af1dcd95b68@schaufler-ca.com \
    --to=casey@schaufler-ca.com \
    --cc=chirantan@chromium.org \
    --cc=dwalsh@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=omosnace@redhat.com \
    --cc=selinux@vger.kernel.org \
    --cc=stephen.smalley.work@gmail.com \
    --cc=vgoyal@redhat.com \
    --cc=virtio-fs@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).