lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 21 May 2021 11:33:01 +0300
From:   Amir Goldstein <amir73il@...il.com>
To:     Gabriel Krisman Bertazi <krisman@...labora.com>
Cc:     kernel@...labora.com, "Darrick J . Wong" <djwong@...nel.org>,
        "Theodore Ts'o" <tytso@....edu>,
        Dave Chinner <david@...morbit.com>, Jan Kara <jack@...e.com>,
        David Howells <dhowells@...hat.com>,
        Khazhismel Kumykov <khazhy@...gle.com>,
        linux-fsdevel <linux-fsdevel@...r.kernel.org>,
        Ext4 <linux-ext4@...r.kernel.org>
Subject: Re: [PATCH 02/11] fanotify: Split fsid check from other fid mode checks

On Fri, May 21, 2021 at 5:42 AM Gabriel Krisman Bertazi
<krisman@...labora.com> wrote:
>
> FAN_ERROR will require fsid, but not necessarily require the filesystem
> to expose a file handle.  Split those checks into different functions, so
> they can be used separately when setting up an event.
>
> Signed-off-by: Gabriel Krisman Bertazi <krisman@...labora.com>
>
> Changes since v1:
>   (Amir)
>   - Rename fanotify_check_path_fsid -> fanotify_test_fsid
>   - Use dentry directly instead of path
> ---
>  fs/notify/fanotify/fanotify_user.c | 43 ++++++++++++++++++------------
>  1 file changed, 26 insertions(+), 17 deletions(-)
>
> diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
> index 3ccdee3c9f1e..9cc6c8808ed5 100644
> --- a/fs/notify/fanotify/fanotify_user.c
> +++ b/fs/notify/fanotify/fanotify_user.c
> @@ -1178,15 +1178,31 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags)
>  }
>
>  /* Check if filesystem can encode a unique fid */
> -static int fanotify_test_fid(struct path *path, __kernel_fsid_t *fsid)
> +static int fanotify_test_fid(struct dentry *dentry)
> +{
> +       /*
> +        * We need to make sure that the file system supports at least
> +        * encoding a file handle so user can use name_to_handle_at() to
> +        * compare fid returned with event to the file handle of watched
> +        * objects. However, name_to_handle_at() requires that the
> +        * filesystem also supports decoding file handles.
> +        */
> +       if (!dentry->d_sb->s_export_op ||
> +           !dentry->d_sb->s_export_op->fh_to_dentry)
> +               return -EOPNOTSUPP;
> +
> +       return 0;
> +}
> +

Nit: move this helper below test_fsid.
The patch will be smaller and easier to review and more
important, less churn that hides the true git blame on the code above.

Thanks,
Amir.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ