All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH RFC 01/12] userns: Support 9p interacting with multiple user namespaces
@ 2012-11-21  9:20 Zhao Hongjiang
       [not found] ` <50AC9CD8.8020207-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Zhao Hongjiang @ 2012-11-21  9:20 UTC (permalink / raw)
  To: Eric W. Biederman; +Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

On 2012/11/20 20:43, Eric W. Biederman wrote:
> From: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>

> diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
> index d934f04..1c750ab 100644
> --- a/fs/9p/v9fs.c
> +++ b/fs/9p/v9fs.c
> @@ -161,7 +161,13 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
>  				ret = r;
>  				continue;
>  			}
> -			v9ses->dfltuid = option;
> +			v9ses->dfltuid = make_kuid(&init_user_ns, option);

I think the init_user_ns should be current_user_ns() cause the value is come from userspace
and in kernel we should mapping it to its own user_ns.

Hongjiang

> +			if (!uid_valid(v9ses->dfltuid)) {
> +				p9_debug(P9_DEBUG_ERROR,
> +					 "uid field, but not a uid?\n");
> +				ret = -EINVAL;
> +				continue;
> +			}
>  			break;
>  		case Opt_dfltgid:
>  			r = match_int(&args[0], &option);
> @@ -171,7 +177,13 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
>  				ret = r;
>  				continue;
>  			}
> -			v9ses->dfltgid = option;
> +			v9ses->dfltgid = make_kgid(&init_user_ns, option);

And this one.

> +			if (!gid_valid(v9ses->dfltgid)) {
> +				p9_debug(P9_DEBUG_ERROR,
> +					 "gid field, but not a gid?\n");
> +				ret = -EINVAL;
> +				continue;
> +			}
>  			break;
>  		case Opt_afid:
>  			r = match_int(&args[0], &option);
> @@ -248,8 +260,9 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
>  			else if (strcmp(s, "client") == 0) {
>  				v9ses->flags |= V9FS_ACCESS_CLIENT;
>  			} else {
> +				uid_t uid;
>  				v9ses->flags |= V9FS_ACCESS_SINGLE;
> -				v9ses->uid = simple_strtoul(s, &e, 10);
> +				uid = simple_strtoul(s, &e, 10);
>  				if (*e != '\0') {
>  					ret = -EINVAL;
>  					pr_info("Unknown access argument %s\n",
> @@ -257,6 +270,13 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
>  					kfree(s);
>  					goto free_and_return;
>  				}
> +				v9ses->uid = make_kuid(&init_user_ns, uid);

Also this one.

> +				if (!uid_valid(v9ses->uid)) {
> +					ret = -EINVAL;
> +					pr_info("Uknown uid %s\n", s);
> +					kfree(s);
> +					goto free_and_return;
> +				}
>  			}
>
>  			kfree(s);




.

^ permalink raw reply	[flat|nested] 5+ messages in thread
* [PATCH RFC 0/12] Final userns conversions
@ 2012-11-20 12:42 Eric W. Biederman
       [not found] ` <87pq38wimv.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Eric W. Biederman @ 2012-11-20 12:42 UTC (permalink / raw)
  To: linux-fsdevel-u79uwXL29TY76Z2rM5mHXA
  Cc: Linux Containers, linux-kernel-u79uwXL29TY76Z2rM5mHXA


This patchset contain the basic user namespace changes for filesystems
that have needed nontrivial work.  Along with the 2 patches that depend
on these changes.

I belive these patches to be correct for allowing the remaining
filesystems to work in the presence of user namespaces.  At the same
time I would like to give all of these much deeper scrutiny, just
because there is so much going on.  Unfortunately these patches
individually are not obviously correct.

Since I won't have much time until after Thanksgiving and because the
merge window is looming I figure I will put these changes out there and
let people see I am looking at these changes, and see if anyone happens
to spot anything.

If I can figure out how to responsibly get these changes into linux-next
I want to get these changes into linux-next so that user namespace bugs
show up in allyesconfig builds.

For people who want to see what else I am cooking my git tree is at:
git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace.git

Eric W. Biederman (12):
      userns: Support 9p interacting with multiple user namespaces
      userns: Convert afs to use kuid/kgid where appropriate
      userns: Convert ceph to use kuid/kgid where appropriate
      userns: Convert cifs to use kuid/kgid where appropriate
      userns: Convert coda's to use kuid/kgid where appropriate
      userns: Convert gfs2 to use kuid/kgid where appropriate
      userns: Convert ncpfs to use kuid and kgid where appropriate
      userns: Convert nfs and nfsd to use kuid/kgid where appropriate
      userns: Convert ocfs2 to use kuid and kgid where appropriate
      userns: Convert xfs to use kuid/kgid/kprojid where appropriate
      userns: Now that everything has been converted remove the unnecessary infrastructure
      userns: Remove the EXPERMINTAL kconfig tag

 fs/9p/fid.c                       |   17 +++--
 fs/9p/v9fs.c                      |   34 ++++++++--
 fs/9p/v9fs.h                      |   10 ++--
 fs/9p/vfs_inode.c                 |    8 +-
 fs/9p/vfs_inode_dotl.c            |   22 +++---
 fs/afs/afs.h                      |    4 +-
 fs/afs/fsclient.c                 |   14 +++-
 fs/afs/inode.c                    |    6 +-
 fs/ceph/caps.c                    |   16 ++--
 fs/ceph/inode.c                   |   18 +++---
 fs/ceph/mds_client.c              |    4 +-
 fs/ceph/super.h                   |    4 +-
 fs/cifs/cifs_fs_sb.h              |    8 +-
 fs/cifs/cifs_spnego.c             |    4 +-
 fs/cifs/cifsacl.c                 |  115 +++++++++++++++++++++++++--------
 fs/cifs/cifsacl.h                 |   16 ++++-
 fs/cifs/cifsfs.c                  |   12 ++-
 fs/cifs/cifsglob.h                |   22 +++---
 fs/cifs/cifspdu.h                 |    2 +
 fs/cifs/cifsproto.h               |    9 ++-
 fs/cifs/cifssmb.c                 |   11 +++-
 fs/cifs/connect.c                 |   58 +++++++++++++----
 fs/cifs/dir.c                     |   18 +++---
 fs/cifs/file.c                    |    8 +-
 fs/cifs/inode.c                   |   28 ++++----
 fs/cifs/misc.c                    |    2 +-
 fs/coda/cache.c                   |    4 +-
 fs/coda/coda_fs_i.h               |    2 +-
 fs/coda/coda_linux.c              |    8 +-
 fs/coda/inode.c                   |    2 +-
 fs/coda/upcall.c                  |    6 +-
 fs/gfs2/acl.c                     |    2 +-
 fs/gfs2/bmap.c                    |    2 +-
 fs/gfs2/dir.c                     |    2 +-
 fs/gfs2/glops.c                   |    4 +-
 fs/gfs2/incore.h                  |    3 +-
 fs/gfs2/inode.c                   |   36 ++++++-----
 fs/gfs2/quota.c                   |  128 ++++++++++++++++---------------------
 fs/gfs2/quota.h                   |   15 ++--
 fs/gfs2/super.c                   |    6 +-
 fs/gfs2/sys.c                     |   14 ++++-
 fs/gfs2/xattr.c                   |    4 +-
 fs/ncpfs/inode.c                  |   55 ++++++++++------
 fs/ncpfs/ioctl.c                  |   25 ++++---
 fs/ncpfs/ncp_fs_sb.h              |    6 +-
 fs/nfs/idmap.c                    |   45 ++++++++-----
 fs/nfs/inode.c                    |   12 ++--
 fs/nfs/nfs2xdr.c                  |    8 +-
 fs/nfs/nfs3xdr.c                  |    8 +-
 fs/nfs/nfs4xdr.c                  |   16 ++--
 fs/nfs_common/nfsacl.c            |   37 ++++++----
 fs/nfsd/acl.h                     |    2 -
 fs/nfsd/auth.c                    |   12 ++--
 fs/nfsd/export.c                  |   22 ++++--
 fs/nfsd/idmap.h                   |    8 +-
 fs/nfsd/nfs3xdr.c                 |    9 ++-
 fs/nfsd/nfs4acl.c                 |   63 +++++++++++++-----
 fs/nfsd/nfs4idmap.c               |   34 ++++++----
 fs/nfsd/nfs4recover.c             |    4 +-
 fs/nfsd/nfs4state.c               |    6 +-
 fs/nfsd/nfs4xdr.c                 |   42 ++++++++-----
 fs/nfsd/nfsxdr.c                  |    9 ++-
 fs/nfsd/vfs.c                     |    8 +-
 fs/ocfs2/acl.c                    |   31 ++++++++-
 fs/ocfs2/dlmglue.c                |    8 +-
 fs/ocfs2/file.c                   |   11 ++--
 fs/ocfs2/inode.c                  |   12 ++--
 fs/ocfs2/namei.c                  |    4 +-
 fs/ocfs2/refcounttree.c           |    2 +-
 fs/xfs/xfs_acl.c                  |   23 ++++++-
 fs/xfs/xfs_dquot.c                |   36 +++++++----
 fs/xfs/xfs_dquot.h                |    5 +-
 fs/xfs/xfs_inode.c                |   33 ++++++----
 fs/xfs/xfs_inode.h                |   32 ++--------
 fs/xfs/xfs_ioctl.c                |   23 +++++--
 fs/xfs/xfs_iops.c                 |   18 +++---
 fs/xfs/xfs_itable.c               |    8 +-
 fs/xfs/xfs_qm.c                   |   87 +++++++++++++------------
 fs/xfs/xfs_qm.h                   |    4 +-
 fs/xfs/xfs_qm_bhv.c               |    3 +-
 fs/xfs/xfs_qm_syscalls.c          |   24 ++++---
 fs/xfs/xfs_quota.h                |    4 +-
 fs/xfs/xfs_quotaops.c             |   20 +-----
 fs/xfs/xfs_rename.c               |    2 +-
 fs/xfs/xfs_trans_dquot.c          |    6 +--
 fs/xfs/xfs_utils.c                |    2 +-
 fs/xfs/xfs_utils.h                |    2 +-
 fs/xfs/xfs_vnodeops.c             |   14 ++--
 include/linux/coda_psdev.h        |    2 +-
 include/linux/nfs4.h              |    6 ++-
 include/linux/nfs_idmap.h         |   10 ++--
 include/linux/nfs_xdr.h           |    4 +-
 include/linux/nfsd/export.h       |    4 +-
 include/linux/posix_acl.h         |    3 -
 include/linux/projid.h            |   15 ----
 include/linux/sunrpc/auth.h       |    7 +-
 include/linux/sunrpc/svcauth.h    |    4 +-
 include/linux/uidgid.h            |   22 ------
 include/net/9p/client.h           |   12 ++--
 init/Kconfig                      |   40 +-----------
 net/9p/client.c                   |   28 +++++----
 net/sunrpc/auth.c                 |    6 +-
 net/sunrpc/auth_generic.c         |   16 +++--
 net/sunrpc/auth_gss/auth_gss.c    |   33 ++++++----
 net/sunrpc/auth_gss/svcauth_gss.c |   14 ++++-
 net/sunrpc/auth_unix.c            |   36 ++++------
 net/sunrpc/svcauth_unix.c         |   40 +++++++-----
 107 files changed, 1035 insertions(+), 820 deletions(-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-11-22 11:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-21  9:20 [PATCH RFC 01/12] userns: Support 9p interacting with multiple user namespaces Zhao Hongjiang
     [not found] ` <50AC9CD8.8020207-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-11-22 11:58   ` Eric W. Biederman
  -- strict thread matches above, loose matches on Subject: below --
2012-11-20 12:42 [PATCH RFC 0/12] Final userns conversions Eric W. Biederman
     [not found] ` <87pq38wimv.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2012-11-20 12:43   ` [PATCH RFC 01/12] userns: Support 9p interacting with multiple user namespaces Eric W. Biederman
2012-11-20 12:43     ` Eric W. Biederman
2012-11-20 12:43     ` Eric W. Biederman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.