Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1281933 > unrolled thread
| Started by | Seth Forshee <seth.forshee@canonical.com> |
|---|---|
| First post | 2015-12-02 16:50 +0100 |
| Last post | 2015-12-04 20:50 +0100 |
| Articles | 4 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 09/19] fs: Refuse uid/gid changes which don't map into s_user_ns Seth Forshee <seth.forshee@canonical.com> - 2015-12-02 16:50 +0100
Re: [PATCH 09/19] fs: Refuse uid/gid changes which don't map into s_user_ns "Serge E. Hallyn" <serge.hallyn@ubuntu.com> - 2015-12-04 18:30 +0100
Re: [PATCH 09/19] fs: Refuse uid/gid changes which don't map into s_user_ns Seth Forshee <seth.forshee@canonical.com> - 2015-12-04 18:50 +0100
Re: [PATCH 09/19] fs: Refuse uid/gid changes which don't map into s_user_ns "Serge E. Hallyn" <serge@hallyn.com> - 2015-12-04 20:50 +0100
| From | Seth Forshee <seth.forshee@canonical.com> |
|---|---|
| Date | 2015-12-02 16:50 +0100 |
| Subject | [PATCH 09/19] fs: Refuse uid/gid changes which don't map into s_user_ns |
| Message-ID | <qBhPl-FC-51@gated-at.bofh.it> |
Add checks to inode_change_ok to verify that uid and gid changes will map into the superblock's user namespace. If they do not fail with -EOVERFLOW. This cannot be overriden with ATTR_FORCE. Signed-off-by: Seth Forshee <seth.forshee@canonical.com> --- fs/attr.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/fs/attr.c b/fs/attr.c index 6530ced19697..55b46e3aa888 100644 --- a/fs/attr.c +++ b/fs/attr.c @@ -42,6 +42,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; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | "Serge E. Hallyn" <serge.hallyn@ubuntu.com> |
|---|---|
| Date | 2015-12-04 18:30 +0100 |
| Subject | Re: [PATCH 09/19] fs: Refuse uid/gid changes which don't map into s_user_ns |
| Message-ID | <qC2lc-5GD-21@gated-at.bofh.it> |
| In reply to | #1281933 |
On Wed, Dec 02, 2015 at 09:40:09AM -0600, Seth Forshee wrote: > Add checks to inode_change_ok to verify that uid and gid changes > will map into the superblock's user namespace. If they do not > fail with -EOVERFLOW. This cannot be overriden with ATTR_FORCE. > > Signed-off-by: Seth Forshee <seth.forshee@canonical.com> Acked-by: Serge Hallyn <serge.hallyn@canonical.com> ... although i could see root on the host being upset that it can't assign a uid not valid in the mounter's ns. But it does seem safer. > --- > fs/attr.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/fs/attr.c b/fs/attr.c > index 6530ced19697..55b46e3aa888 100644 > --- a/fs/attr.c > +++ b/fs/attr.c > @@ -42,6 +42,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; > -- > 1.9.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Seth Forshee <seth.forshee@canonical.com> |
|---|---|
| Date | 2015-12-04 18:50 +0100 |
| Subject | Re: [PATCH 09/19] fs: Refuse uid/gid changes which don't map into s_user_ns |
| Message-ID | <qC2Ey-5Oo-31@gated-at.bofh.it> |
| In reply to | #1284074 |
On Fri, Dec 04, 2015 at 11:27:38AM -0600, Serge E. Hallyn wrote: > On Wed, Dec 02, 2015 at 09:40:09AM -0600, Seth Forshee wrote: > > Add checks to inode_change_ok to verify that uid and gid changes > > will map into the superblock's user namespace. If they do not > > fail with -EOVERFLOW. This cannot be overriden with ATTR_FORCE. > > > > Signed-off-by: Seth Forshee <seth.forshee@canonical.com> > > Acked-by: Serge Hallyn <serge.hallyn@canonical.com> > > ... although i could see root on the host being upset that it can't > assign a uid not valid in the mounter's ns. But it does seem safer. That change wouldn't be representable in the backing store though, and that could lead to unexpected behaviour. It's better to tell root that we can't make the requested change, in my opinion. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | "Serge E. Hallyn" <serge@hallyn.com> |
|---|---|
| Date | 2015-12-04 20:50 +0100 |
| Subject | Re: [PATCH 09/19] fs: Refuse uid/gid changes which don't map into s_user_ns |
| Message-ID | <qC4wG-6ZX-15@gated-at.bofh.it> |
| In reply to | #1284112 |
Quoting Seth Forshee (seth.forshee@canonical.com): > On Fri, Dec 04, 2015 at 11:27:38AM -0600, Serge E. Hallyn wrote: > > On Wed, Dec 02, 2015 at 09:40:09AM -0600, Seth Forshee wrote: > > > Add checks to inode_change_ok to verify that uid and gid changes > > > will map into the superblock's user namespace. If they do not > > > fail with -EOVERFLOW. This cannot be overriden with ATTR_FORCE. > > > > > > Signed-off-by: Seth Forshee <seth.forshee@canonical.com> > > > > Acked-by: Serge Hallyn <serge.hallyn@canonical.com> > > > > ... although i could see root on the host being upset that it can't > > assign a uid not valid in the mounter's ns. But it does seem safer. > > That change wouldn't be representable in the backing store though, and > that could lead to unexpected behaviour. It's better to tell root that > we can't make the requested change, in my opinion. Makes sense. Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web