mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Connor Kuehl <ckuehl@redhat.com>
To: linux-fsdevel@vger.kernel.org
Cc: Miklos Szeredi <miklos@szeredi.hu>, linux-kernel@vger.kernel.org
Subject: [PATCH] fuse: Send FUSE_WRITE_KILL_SUIDGID for killpriv v1
Date: Fri, 23 Apr 2021 10:19:19 -0500	[thread overview]
Message-ID: <20210423151919.195033-1-ckuehl@redhat.com> (raw)

FUSE doesn't seem to be adding the FUSE_WRITE_KILL_SUIDGID flag on write
requests for FUSE connections that support FUSE_HANDLE_KILLPRIV but not
FUSE_HANDLE_KILLPRIV_V2.

However, the FUSE userspace header states:

	FUSE_HANDLE_KILLPRIV: fs handles killing suid/sgid/cap on
	write/chown/trunc
	^^^^^

To improve backwards compatibility with file servers that don't support
FUSE_HANDLE_KILLPRIV_V2, add the FUSE_WRITE_KILL_SUIDGID flag to write
requests if FUSE_HANDLE_KILLPRIV has been negotiated -OR- if the
conditions for FUSE_HANDLE_KILLPRIV_V2 support are met.

Signed-off-by: Connor Kuehl <ckuehl@redhat.com>
---
 fs/fuse/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 8cccecb55fb8..7dc9182d1ece 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1106,7 +1106,7 @@ static ssize_t fuse_send_write_pages(struct fuse_io_args *ia,
 
 	fuse_write_args_fill(ia, ff, pos, count);
 	ia->write.in.flags = fuse_write_flags(iocb);
-	if (fm->fc->handle_killpriv_v2 && !capable(CAP_FSETID))
+	if (fm->fc->handle_killpriv || (fm->fc->handle_killpriv_v2 && !capable(CAP_FSETID)))
 		ia->write.in.write_flags |= FUSE_WRITE_KILL_SUIDGID;
 
 	err = fuse_simple_request(fm, &ap->args);
-- 
2.30.2


             reply	other threads:[~2021-04-23 15:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-23 15:19 Connor Kuehl [this message]
2021-06-21  8:26 ` Miklos Szeredi
2021-06-21 13:54   ` Connor Kuehl

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=20210423151919.195033-1-ckuehl@redhat.com \
    --to=ckuehl@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /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

all inboxes | Powered by JetHome®