From: Bernd Schubert <bschubert@ddn.com>
To: linux-fsdevel@vger.kernel.org, miklos@szeredi.hu
Cc: vgoyal@redhat.com, jefflexu@linux.alibaba.com, dsingh@ddn.com
Subject: [PATCH] fuse: Apply flags2 only when userspace set the FUSE_INIT_EXT flag
Date: Fri, 15 Apr 2022 13:53:56 +0200 [thread overview]
Message-ID: <165002363635.1457422.5930635235733982079.stgit@localhost> (raw)
This is just a safety precaution to avoid checking flags
on memory that was initialized on the user space side.
libfuse zeroes struct fuse_init_out outarg, but this is not
guranteed to be done in all implementations. Better is to
act on flags and to only apply flags2 when FUSE_INIT_EXT
is set.
There is a risk with this change, though - it might break existing
user space libraries, which are already using flags2 without
setting FUSE_INIT_EXT.
The corresponding libfuse patch is here
https://github.com/libfuse/libfuse/pull/662
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
---
fs/fuse/inode.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 9ee36aa73251..8115a06d5fbb 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -1115,7 +1115,10 @@ static void process_init_reply(struct fuse_mount *fm, struct fuse_args *args,
process_init_limits(fc, arg);
if (arg->minor >= 6) {
- u64 flags = arg->flags | (u64) arg->flags2 << 32;
+ u64 flags = arg->flags;
+
+ if (flags & FUSE_INIT_EXT)
+ flags |= (u64) arg->flags2 << 32;
ra_pages = arg->max_readahead / PAGE_SIZE;
if (flags & FUSE_ASYNC_READ)
next reply other threads:[~2022-04-15 11:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-15 11:53 Bernd Schubert [this message]
2022-04-21 15:36 ` [PATCH] fuse: Apply flags2 only when userspace set the FUSE_INIT_EXT flag Miklos Szeredi
2022-04-21 16:28 ` Bernd Schubert
2022-04-24 8:29 ` Vivek Goyal
[not found] ` <DM5PR1901MB20375D0CF53C5F7D338154D0B5F99@DM5PR1901MB2037.namprd19.prod.outlook.com>
2022-04-24 11:32 ` JeffleXu
2022-04-25 8:09 ` Miklos Szeredi
2022-04-26 13:01 ` Vivek Goyal
2022-04-26 13:13 ` Miklos Szeredi
2022-04-26 13:24 ` 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=165002363635.1457422.5930635235733982079.stgit@localhost \
--to=bschubert@ddn.com \
--cc=dsingh@ddn.com \
--cc=jefflexu@linux.alibaba.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=vgoyal@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).