Re: [PATCH 11/13] fuse: fix UAF in rcu pathwalks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 5, 2024 at 3:52 PM Miklos Szeredi <miklos@xxxxxxxxxx> wrote:
>
> On Mon, 5 Feb 2024 at 13:31, Christian Brauner <brauner@xxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxx>
> > > ---
> >
> > Reviewed-by: Christian Brauner <brauner@xxxxxxxxxx>
>
> Acked-by: Miklos Szeredi <mszeredi@xxxxxxxxxx>
>

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.





[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux