History

fuse: add a flag FUSE_OPEN_KILL_SUIDGID for open() request

With FUSE_HANDLE_KILLPRIV_V2 support, server will need to kill suid/sgid/ security.capability on open(O_TRUNC), if server supports FUSE_ATOMIC_O_TRUNC. But server needs to kill suid/sgid only if caller does not have CAP_FSETID. Given server does not have this information, client needs to send this info to server. So add a flag FUSE_OPEN_KILL_SUIDGID to fuse_open_in request which tells server to kill suid/sgid (only if group execute is set). This flag is added to the FUSE_OPEN request, as well as the FUSE_CREATE request if the create was non-exclusive, since that might result in an existing file being opened/truncated.

Vivek Goyal committed 6 years ago

Commit 643a6661 parent 8981bdf3 files · +21 −2Browse files

Showing the changes to include/uapi (1 of 3 files). Show all

Unified · Split

include/uapi/linux/fuse.h+9−2
@@ -178,6 +178,7 @@ · 177 unmodified lines
178178 *
179179 * 7.33
180180 * - add FUSE_HANDLE_KILLPRIV_V2, FUSE_WRITE_KILL_SUIDGID, FATTR_KILL_SUIDGID
181+ * - add FUSE_OPEN_KILL_SUIDGID
181182 */
182183
183184 #ifndef _LINUX_FUSE_H
@@ -444,6 +445,12 @@ struct fuse_file_lock { · 260 unmodified lines
444445 */
445446 #define FUSE_ATTR_SUBMOUNT (1 << 0)
446447
448+/**
449+ * Open flags
450+ * FUSE_OPEN_KILL_SUIDGID: Kill suid and sgid if executable
451+ */
452+#define FUSE_OPEN_KILL_SUIDGID (1 << 0)
453+
447454 enum fuse_opcode {
448455 FUSE_LOOKUP = 1,
449456 FUSE_FORGET = 2, /* no reply */
@@ -605,14 +612,14 @@ struct fuse_setattr_in { · 155 unmodified lines
605612
606613 struct fuse_open_in {
607614 uint32_t flags;
608− uint32_t unused;
615+ uint32_t open_flags; /* FUSE_OPEN_... */
609616 };
610617
611618 struct fuse_create_in {
612619 uint32_t flags;
613620 uint32_t mode;
614621 uint32_t umask;
615− uint32_t padding;
622+ uint32_t open_flags; /* FUSE_OPEN_... */
616623 };
617624
618625 struct fuse_open_out {