[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201123164622.GJ27294@quack2.suse.cz>
Date: Mon, 23 Nov 2020 17:46:22 +0100
From: Jan Kara <jack@...e.cz>
To: Paweł Jasiak <pawel@...iak.xyz>
Cc: Jan Kara <jack@...e.cz>, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org, x86@...nel.org,
Thomas Gleixner <tglx@...utronix.de>,
Brian Gerst <brgerst@...il.com>,
Andy Lutomirski <luto@...nel.org>
Subject: Re: PROBLEM: fanotify_mark EFAULT on x86
On Tue 03-11-20 22:17:47, Paweł Jasiak wrote:
> I have written small patch that fixes problem for me and doesn't break
> x86_64.
OK, with a help of Boris Petkov I think I have a fix that looks correct
(attach). Can you please try whether it works for you? Thanks!
Honza
>
> diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
> index 3e01d8f2ab90..cf0b97309975 100644
> --- a/fs/notify/fanotify/fanotify_user.c
> +++ b/fs/notify/fanotify/fanotify_user.c
> @@ -1285,12 +1285,27 @@ static int do_fanotify_mark(int fanotify_fd, unsigned int flags, __u64 mask,
> return ret;
> }
>
> +#if defined(CONFIG_X86) && !defined(CONFIG_64BIT)
> +SYSCALL_DEFINE6(fanotify_mark,
> + int, fanotify_fd, unsigned int, flags, __u32, mask0,
> + __u32, mask1, int, dfd, const char __user *, pathname)
> +{
> + return do_fanotify_mark(fanotify_fd, flags,
> +#ifdef __BIG_ENDIAN
> + ((__u64)mask0 << 32) | mask1,
> +#else
> + ((__u64)mask1 << 32) | mask0,
> +#endif
> + dfd, pathname);
> +}
> +#else
> SYSCALL_DEFINE5(fanotify_mark, int, fanotify_fd, unsigned int, flags,
> __u64, mask, int, dfd,
> const char __user *, pathname)
> {
> return do_fanotify_mark(fanotify_fd, flags, mask, dfd, pathname);
> }
> +#endif
>
> #ifdef CONFIG_COMPAT
> COMPAT_SYSCALL_DEFINE6(fanotify_mark,
>
>
> --
>
> Paweł Jasiak
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
View attachment "0001-fanotify-Fix-fanotify_mark-on-32-bit-archs.patch" of type "text/x-patch" (2203 bytes)
Powered by blists - more mailing lists