qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] virtiofsd: Add support for file security context at creation
@ 2021-09-24 19:48 Vivek Goyal
  2021-09-24 19:48 ` [PATCH 1/5] fuse: Header file changes for FUSE_SECURITY_CTX Vivek Goyal
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Vivek Goyal @ 2021-09-24 19:48 UTC (permalink / raw)
  To: qemu-devel, virtio-fs
  Cc: miklos, chirantan, stephen.smalley.work, dwalsh, dgilbert, vgoyal

Hi,

These patches add support to receive and set file security context at
the time of file creation. This is one of the components needed to
support SELinux on virtiofs.

I have posted kernel patches here just now.

https://lore.kernel.org/linux-fsdevel/20210924192442.916927-1-vgoyal@redhat.com/T/#m971f9001dd622b3f7a96a65899e3f146d2185841

These patches will allow users to configure virtiofsd in multiple modes
to set security context.

A. Guest and host selinux policies can work with each other.
	- virtiofsd will use /proc/thread-self/attr/fscreate knob to
	  set security context before file creation.

B. Remap guest selinux security xattr to something else say,
   trusted.virtiofs.security.selinux.
	- Give CAP_SYS_ADMIN to virtiofsd.
	- "-o -o xattrmap=:map:security.selinux:trusted.virtiofsd.:"

C. If no SELinux on host.
	- Give CAP_SYS_ADMIN to virtiofsd. 

I have tested mode A and B but yet to test mode C.

I think either mode B or mode C will be most commonly used mode when
guest does need SELinux support in virtiofs.

With these patches, I am able to boot a guest VM with rootfs on virtiofs
and with SELinux enabled in guest. 

Please review.

Thanks
Vivek


Vivek Goyal (5):
  fuse: Header file changes for FUSE_SECURITY_CTX
  fuse_lowlevel.c: Add capability to parse security context
  virtiofsd: Move core file creation code in separate function
  virtiofsd: Create new file with fscreate set
  virtiofsd: Create new file using O_TMPFILE and set security context

 include/standard-headers/linux/fuse.h |  14 +-
 tools/virtiofsd/fuse_common.h         |   5 +
 tools/virtiofsd/fuse_i.h              |   7 +
 tools/virtiofsd/fuse_lowlevel.c       |  74 ++++++
 tools/virtiofsd/passthrough_ll.c      | 366 ++++++++++++++++++++++++--
 5 files changed, 436 insertions(+), 30 deletions(-)

-- 
2.31.1



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

end of thread, other threads:[~2021-09-24 19:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-24 19:48 [PATCH 0/5] virtiofsd: Add support for file security context at creation Vivek Goyal
2021-09-24 19:48 ` [PATCH 1/5] fuse: Header file changes for FUSE_SECURITY_CTX Vivek Goyal
2021-09-24 19:48 ` [PATCH 2/5] fuse_lowlevel.c: Add capability to parse security context Vivek Goyal
2021-09-24 19:48 ` [PATCH 3/5] virtiofsd: Move core file creation code in separate function Vivek Goyal
2021-09-24 19:48 ` [PATCH 4/5] virtiofsd: Create new file with fscreate set Vivek Goyal
2021-09-24 19:48 ` [PATCH 5/5] virtiofsd: Create new file using O_TMPFILE and set security context 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).