Commit b6fde09a authored by Luis Henriques's avatar Luis Henriques

Revert "(namespace) Revert "UBUNTU: SAUCE: fs: Refuse uid/gid changes which...

Revert "(namespace) Revert "UBUNTU: SAUCE: fs: Refuse uid/gid changes which don't map into s_user_ns""

BugLink: https://bugs.launchpad.net/bugs/1644165

This reverts commit 412b16ef.

The kernel fix for bug #1634964 breaks LXD userspace, in particular the
following commits:

ac7f3f73 (namespace) vfs: Don't modify inodes with a uid or gid unknown to the vfs
ca52383a (namespace) vfs: Don't create inodes with a uid or gid unknown to the vfs

LXD 2.0.6 will include changes to support these kernel changes, but it isn't
available yet on xenial, so for now we just revert these commits.
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent 75a5ec4a
......@@ -79,6 +79,17 @@ int inode_change_ok(const struct inode *inode, struct iattr *attr)
return error;
}
/*
* Verify that uid/gid changes are valid in the target namespace
* of the superblock. This cannot be overriden using ATTR_FORCE.
*/
if (ia_valid & ATTR_UID &&
from_kuid(inode->i_sb->s_user_ns, attr->ia_uid) == (uid_t)-1)
return -EOVERFLOW;
if (ia_valid & ATTR_GID &&
from_kgid(inode->i_sb->s_user_ns, attr->ia_gid) == (gid_t)-1)
return -EOVERFLOW;
/* If force is set do it anyway. */
if (ia_valid & ATTR_FORCE)
return 0;
......
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