]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
Smack: Add support for unprivileged mounts from user namespaces
authorSeth Forshee <seth.forshee@canonical.com>
Wed, 23 Sep 2015 20:16:06 +0000 (15:16 -0500)
committerEric W. Biederman <ebiederm@xmission.com>
Fri, 24 Jun 2016 15:40:42 +0000 (10:40 -0500)
commit9f50eda2a9277e0bc51d8ca5dd2ec1d0e73601bc
treeade4a2e1d8f8b4c861f3abe4ce11dcc9e475eb85
parent380cf5ba6b0a0b307f4afb62b186ca801defb203
Smack: Add support for unprivileged mounts from user namespaces

Security labels from unprivileged mounts cannot be trusted.
Ideally for these mounts we would assign the objects in the
filesystem the same label as the inode for the backing device
passed to mount. Unfortunately it's currently impossible to
determine which inode this is from the LSM mount hooks, so we
settle for the label of the process doing the mount.

This label is assigned to s_root, and also to smk_default to
ensure that new inodes receive this label. The transmute property
is also set on s_root to make this behavior more explicit, even
though it is technically not necessary.

If a filesystem has existing security labels, access to inodes is
permitted if the label is the same as smk_root, otherwise access
is denied. The SMACK64EXEC xattr is completely ignored.

Explicit setting of security labels continues to require
CAP_MAC_ADMIN in init_user_ns.

Altogether, this ensures that filesystem objects are not
accessible to subjects which cannot already access the backing
store, that MAC is not violated for any objects in the fileystem
which are already labeled, and that a user cannot use an
unprivileged mount to gain elevated MAC privileges.

sysfs, tmpfs, and ramfs are already mountable from user
namespaces and support security labels. We can't rule out the
possibility that these filesystems may already be used in mounts
from user namespaces with security lables set from the init
namespace, so failing to trust lables in these filesystems may
introduce regressions. It is safe to trust labels from these
filesystems, since the unprivileged user does not control the
backing store and thus cannot supply security labels, so an
explicit exception is made to trust labels from these
filesystems.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Acked-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
security/smack/smack.h
security/smack/smack_lsm.c