• Seth Forshee's avatar
    fs: Allow sysfs and cgroupfs to share super blocks between user namespaces · 2fc00781
    Seth Forshee authored
    Both of these filesystems already have use cases for mounting the
    same super block from multiple user namespaces. For sysfs this
    happens when using criu for snapshotting a container, where sysfs
    is mounted in the containers network ns but the hosts user ns.
    The cgroup filesystem shares the same super block for all mounts
    of the same hierarchy regardless of the namespace.
    
    As a result, the restriction on mounting a super block from a
    single user namespace creates regressions for existing uses of
    these filesystems. For these specific filesystems this
    restriction isn't really necessary since the backing store is
    objects in kernel memory and thus the ids assigned from inodes
    is not subject to translation relative to s_user_ns.
    
    Add a new filesystem flag, FS_USERNS_SHARE_SB, which when set
    causes sget_userns() to skip the check of s_user_ns. Set this
    flag for the sysfs and cgroup filesystems to fix the
    regressions.
    Signed-off-by: default avatarSeth Forshee <seth.forshee@canonical.com>
    2fc00781
cgroup.c 172 KB