linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fuse: Send FUSE_WRITE_KILL_SUIDGID for killpriv v1
@ 2021-04-23 15:19 Connor Kuehl
  2021-06-21  8:26 ` Miklos Szeredi
  0 siblings, 1 reply; 3+ messages in thread
From: Connor Kuehl @ 2021-04-23 15:19 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Miklos Szeredi, linux-kernel

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


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

* Re: [PATCH] fuse: Send FUSE_WRITE_KILL_SUIDGID for killpriv v1
  2021-04-23 15:19 [PATCH] fuse: Send FUSE_WRITE_KILL_SUIDGID for killpriv v1 Connor Kuehl
@ 2021-06-21  8:26 ` Miklos Szeredi
  2021-06-21 13:54   ` Connor Kuehl
  0 siblings, 1 reply; 3+ messages in thread
From: Miklos Szeredi @ 2021-06-21  8:26 UTC (permalink / raw)
  To: Connor Kuehl; +Cc: linux-fsdevel, linux-kernel

On Fri, 23 Apr 2021 at 17:19, Connor Kuehl <ckuehl@redhat.com> wrote:
>
> 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.


If server does not support FUSE_HANDLE_KILLPRIV_V2, then it does not
support FUSE_WRITE_KILL_SUIDGID either.  The two were introduced
together and the latter is only meaningful if the
FUSE_HANDLE_KILLPRIV_V2 feature was negotiated.

What am I missing?

Thanks,
Miklos

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

* Re: [PATCH] fuse: Send FUSE_WRITE_KILL_SUIDGID for killpriv v1
  2021-06-21  8:26 ` Miklos Szeredi
@ 2021-06-21 13:54   ` Connor Kuehl
  0 siblings, 0 replies; 3+ messages in thread
From: Connor Kuehl @ 2021-06-21 13:54 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: linux-fsdevel, linux-kernel

On 6/21/21 3:26 AM, Miklos Szeredi wrote:
> On Fri, 23 Apr 2021 at 17:19, Connor Kuehl <ckuehl@redhat.com> wrote:
>>
>> 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.
> 
> 
> If server does not support FUSE_HANDLE_KILLPRIV_V2, then it does not
> support FUSE_WRITE_KILL_SUIDGID either.  The two were introduced
> together and the latter is only meaningful if the
> FUSE_HANDLE_KILLPRIV_V2 feature was negotiated.
> 
> What am I missing?

You're not missing anything, this patch is wrong. Let's nack this.

Thanks!

Connor


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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-23 15:19 [PATCH] fuse: Send FUSE_WRITE_KILL_SUIDGID for killpriv v1 Connor Kuehl
2021-06-21  8:26 ` Miklos Szeredi
2021-06-21 13:54   ` Connor Kuehl

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