From: Jingbo Xu <jefflexu@linux.alibaba.com>
To: Amir Goldstein <amir73il@gmail.com>
Cc: miklos@szeredi.hu, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [RFC] fuse: disable support for file handle when FUSE_EXPORT_SUPPORT not configured
Date: Tue, 23 Jan 2024 18:40:40 +0800 [thread overview]
Message-ID: <3d1d06de-cb59-40d7-b0df-110e7dc904d6@linux.alibaba.com> (raw)
In-Reply-To: <CAOQ4uxgna=Eimk4KHUByk5ZRu7NKHTPJQukgV9GE_DNN_3_ztA@mail.gmail.com>
On 1/23/24 6:17 PM, Amir Goldstein wrote:
> If you somehow find a way to mitigate the regression for NFS export of
> old fuse servers (maybe an opt-in Kconfig?), your patch is also going to
> regress AT_HANDLE_FID functionality, which can be used by fanotify to
> monitor fuse.
>
> AT_HANDLE_FID flag to name_to_handle_at(2) means that
> open_by_handle_at(2) is not supposed to be called on that fh.
>
> The correct way to deal with that would be something like this:
>
> +static const struct export_operations fuse_fid_operations = {
> + .encode_fh = fuse_encode_fh,
> +};
> +
> static const struct export_operations fuse_export_operations = {
> .fh_to_dentry = fuse_fh_to_dentry,
> .fh_to_parent = fuse_fh_to_parent,
> @@ -1529,12 +1533,16 @@ static void fuse_fill_attr_from_inode(struct
> fuse_attr *attr,
>
> static void fuse_sb_defaults(struct super_block *sb)
> {
> + struct fuse_mount *fm = get_fuse_mount_super(sb);
> +
> sb->s_magic = FUSE_SUPER_MAGIC;
> sb->s_op = &fuse_super_operations;
> sb->s_xattr = fuse_xattr_handlers;
> sb->s_maxbytes = MAX_LFS_FILESIZE;
> sb->s_time_gran = 1;
> - sb->s_export_op = &fuse_export_operations;
> + if (fm->fc->export_support)
> + sb->s_export_op = &fuse_export_operations;
> + else
> + sb->s_export_op = &fuse_fid_operations;
> sb->s_iflags |= SB_I_IMA_UNVERIFIABLE_SIGNATURE;
> if (sb->s_user_ns != &init_user_ns)
> sb->s_iflags |= SB_I_UNTRUSTED_MOUNTER;
>
> ---
>
> This would make name_to_handle_at() without AT_HANDLE_FID fail
> and name_to_handle_at() with AT_HANDLE_FID to succeed as it should.
>
Oh I didn't notice this. Many thanks!
--
Thanks,
Jingbo
next prev parent reply other threads:[~2024-01-23 10:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-23 9:37 Jingbo Xu
2024-01-23 10:17 ` Amir Goldstein
2024-01-23 10:36 ` Jingbo Xu
2024-01-23 10:40 ` Jingbo Xu [this message]
2024-01-23 10:46 ` Miklos Szeredi
2024-01-23 11:35 ` Jingbo Xu
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=3d1d06de-cb59-40d7-b0df-110e7dc904d6@linux.alibaba.com \
--to=jefflexu@linux.alibaba.com \
--cc=amir73il@gmail.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®