Commit aadbec3a authored by Seth Forshee's avatar Seth Forshee Committed by Tim Gardner

UBUNTU: SAUCE: kernfs: Do not match superblock in another user namespace when mounting

BugLink: http://bugs.launchpad.net/bugs/1570906

Two kernfs-based filesystems are currently mountable from
non-init user namespaces, sysfs and cgroupfs. Both of these have
use cases which end up attempting to mount the same superblock
from different user namespaces, but sget() no longer allows this
so these mount attempts will fail.

Update kernfs_test_super() to return false whenever s_user_ns is
not the current user namespace, resulting in a new super block
being allocated for these mounts. kernfs, sysfs, and cgroupfs are
all equipped to handle this situation.
Tested-by: default avatarTycho Andersen <tycho.andersen@canonical.com>
Acked-by: default avatarLeann Ogasawara <leann.ogasawara@canonical.com>
Signed-off-by: default avatarTim Gardner <tim.gardner@canonical.com>
parent 82673736
......@@ -171,7 +171,8 @@ static int kernfs_test_super(struct super_block *sb, void *data)
struct kernfs_super_info *sb_info = kernfs_info(sb);
struct kernfs_super_info *info = data;
return sb_info->root == info->root && sb_info->ns == info->ns;
return sb_info->root == info->root && sb_info->ns == info->ns &&
sb->s_user_ns == current_user_ns();
}
static int kernfs_set_super(struct super_block *sb, void *data)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment