• Linus Torvalds's avatar
    Merge tag 'vfs-6.11-rc1.fixes.3' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs · bc4eee85
    Linus Torvalds authored
    Pull vfs fixes from Christian Brauner:
     "This contains two fixes for this merge window:
    
      VFS:
    
       - I noticed that it is possible for a privileged user to mount most
         filesystems with a non-initial user namespace in sb->s_user_ns.
    
         When fsopen() is called in a non-init namespace the caller's
         namespace is recorded in fs_context->user_ns. If the returned file
         descriptor is then passed to a process privileged in init_user_ns,
         that process can call fsconfig(fd_fs, FSCONFIG_CMD_CREATE*),
         creating a new superblock with sb->s_user_ns set to the namespace
         of the process which called fsopen().
    
         This is problematic as only filesystems that raise FS_USERNS_MOUNT
         are known to be able to support a non-initial s_user_ns. Others may
         suffer security issues, on-disk corruption or outright crash the
         kernel. Prevent that by restricting such delegation to filesystems
         that allow FS_USERNS_MOUNT.
    
         Note, that this delegation requires a privileged process to
         actually create the superblock so either the privileged process is
         cooperaing or someone must have tricked a privileged process into
         operating on a fscontext file descriptor whose origin it doesn't
         know (a stupid idea).
    
         The bug dates back to about 5 years afaict.
    
      Misc:
    
       - Fix hostfs parsing when the mount request comes in via the legacy
         mount api.
    
         In the legacy mount api hostfs allows to specify the host directory
         mount without any key.
    
         Restore that behavior"
    
    * tag 'vfs-6.11-rc1.fixes.3' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
      hostfs: fix the host directory parse when mounting.
      fs: don't allow non-init s_user_ns for filesystems without FS_USERNS_MOUNT
    bc4eee85
hostfs_kern.c 23.2 KB