[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOQ4uxhBwmZ1LDcWD6jdaheUkDQAQUTeSNNMygRAg3v_0H5sDQ@mail.gmail.com>
Date: Mon, 4 Mar 2024 16:36:46 +0200
From: Amir Goldstein <amir73il@...il.com>
To: Miklos Szeredi <miklos@...redi.hu>
Cc: Christian Brauner <brauner@...nel.org>, Al Viro <viro@...iv.linux.org.uk>,
linux-fsdevel@...r.kernel.org, Linus Torvalds <torvalds@...ux-foundation.org>,
linux-ext4@...r.kernel.org, linux-nfs@...r.kernel.org,
linux-cifs@...r.kernel.org
Subject: Re: [PATCH 11/13] fuse: fix UAF in rcu pathwalks
On Mon, Feb 5, 2024 at 3:52 PM Miklos Szeredi <miklos@...redi.hu> wrote:
>
> On Mon, 5 Feb 2024 at 13:31, Christian Brauner <brauner@...nel.org> wrote:
> >
> > On Sun, Feb 04, 2024 at 02:17:37AM +0000, Al Viro wrote:
> > > ->permission(), ->get_link() and ->inode_get_acl() might dereference
> > > ->s_fs_info (and, in case of ->permission(), ->s_fs_info->fc->user_ns
> > > as well) when called from rcu pathwalk.
> > >
> > > Freeing ->s_fs_info->fc is rcu-delayed; we need to make freeing ->s_fs_info
> > > and dropping ->user_ns rcu-delayed too.
> > >
> > > Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
> > > ---
> >
> > Reviewed-by: Christian Brauner <brauner@...nel.org>
>
> Acked-by: Miklos Szeredi <mszeredi@...hat.com>
>
Miklos,
FYI, this is now merged and conflicts with:
dc076c73b9f9 ("fuse: implement ioctls to manage backing files")
from fuse/for-next:
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@@ -1373,7 -1398,9 +1405,13 @@@ EXPORT_SYMBOL_GPL(fuse_send_init)
void fuse_free_conn(struct fuse_conn *fc)
{
WARN_ON(!list_empty(&fc->devices));
++<<<<<<< HEAD
+ kfree(fc);
++=======
+ if (IS_ENABLED(CONFIG_FUSE_PASSTHROUGH))
+ fuse_backing_files_free(fc);
+ kfree_rcu(fc, rcu);
++>>>>>>> fuse/for-next
}
EXPORT_SYMBOL_GPL(fuse_free_conn);
Note that fuse_backing_files_free() calls
fuse_backing_id_free() => fuse_backing_free() => kfree_rcu()
Should we move fuse_backing_files_free() into
fuse_conn_put() above fuse_dax_conn_free()?
That will avoid the merge conflict and still be correct. no?
Thanks,
Amir.
Powered by blists - more mailing lists