Skip to contentSkip to conversation

Setting FS_USERNS_MOUNT in btrfs_fs_type.fs_flags

DISCUSSION Shea Levy 3 participants 4 messages Sep 17, 2014 Btrfs file system

lore
Share & tools
lore

Shea Levy

author
#0 lore raw

Hi all,

What work would be required to mark btrfs_fs_type with FS_USERNS_MOUNT so that btrfs images can be mounted by unprivileged users within a user namespace (along with something like [1])? I'd like to be able to create disk images without having to start a VM (and --rootdir isn't flexible enough because I want to make subvolumes).

Cheers,
Shea Levy

P.S. I am not subscribed to either list, please CC me in replies

[1] https://lkml.org/lkml/2014/5/27/690

#1 lore raw
Quoted 7 lines · Shea Levy

Hi all,

What work would be required to mark btrfs_fs_type with FS_USERNS_MOUNT so that btrfs images can be mounted by unprivileged users within a user namespace (along with something like [1])? I'd like to be able to create disk images without having to start a VM (and --rootdir isn't flexible enough because I want to make subvolumes).

Er... Which is to say, you have an audit of btrfs code making sure that it can cope with arbitrary image hand-crafted by potential attacker? Because without that FS_USERNS_MOUNT could open one hell of security hole; things like user being able to execute an arbitrary code in kernel mode, etc.

#2 lore raw
Quoted 11 lines · Al Viro
Quoted 7 lines · Shea Levy

Hi all,

What work would be required to mark btrfs_fs_type with FS_USERNS_MOUNT so that btrfs images can be mounted by unprivileged users within a user namespace (along with something like [1])? I'd like to be able to create disk images without having to start a VM (and --rootdir isn't flexible enough because I want to make subvolumes).

Er... Which is to say, you have an audit of btrfs code making sure that it can cope with arbitrary image hand-crafted by potential attacker?

It definitely can't cope. The easiest places to find bugs are the hundreds of BUG_ON() sites, many can be triggered by on-disk structures. The sheer volume of those makes me trust that you could find much worse if you did a thorough audit.

- z
(fun related fact: distros automount btrfs images)

author
#3 lore raw
Quoted 13 lines · Zach Brown
Quoted 11 lines · Al Viro
Quoted 7 lines · Shea Levy

Hi all,

What work would be required to mark btrfs_fs_type with FS_USERNS_MOUNT so that btrfs images can be mounted by unprivileged users within a user namespace (along with something like [1])? I'd like to be able to create disk images without having to start a VM (and --rootdir isn't flexible enough because I want to make subvolumes).

Er... Which is to say, you have an audit of btrfs code making sure that it can cope with arbitrary image hand-crafted by potential attacker?

Quoted 7 lines

It definitely can't cope. The easiest places to find bugs are the hundreds of BUG_ON() sites, many can be triggered by on-disk structures. The sheer volume of those makes me trust that you could find much worse if you did a thorough audit.

- z
(fun related fact: distros automount btrfs images)

OK, so it seems like the answer to my question is "a helluva lot". Guess I won't count on seeing it any time soon :)

Thanks,
Shea