[CRIU] [PATCH 05/14] userns: define protobuf messages for uid and gid maps

Andrew Vagin avagin at parallels.com
Thu Oct 30 08:44:11 PDT 2014


On Thu, Oct 30, 2014 at 04:01:30PM +0400, Pavel Emelyanov wrote:
> On 10/14/2014 03:38 PM, Andrey Vagin wrote:
> > Normally, one of the first steps after creating a new user namespace is
> > to define the mappings used for the user and group IDs of the processes
> > that will be created in that namespace. This is done by writing mapping
> > information to the /proc/PID/uid_map and /proc/PID/gid_map files
> > corresponding to one of the processes in the user namespace.
> > 
> > Signed-off-by: Andrey Vagin <avagin at openvz.org>
> > ---
> >  protobuf/Makefile     |  1 +
> >  protobuf/userns.proto | 10 ++++++++++
> >  2 files changed, 11 insertions(+)
> >  create mode 100644 protobuf/userns.proto
> > 
> > diff --git a/protobuf/Makefile b/protobuf/Makefile
> > index 509f3c3..983629e 100644
> > --- a/protobuf/Makefile
> > +++ b/protobuf/Makefile
> > @@ -62,6 +62,7 @@ proto-obj-y	+= siginfo.o
> >  proto-obj-y	+= rpc.o
> >  proto-obj-y	+= ext-file.o
> >  proto-obj-y	+= cgroup.o
> > +proto-obj-y	+= userns.o
> >  
> >  proto		:= $(proto-obj-y:.o=)
> >  proto-c		:= $(proto-obj-y:.o=.pb-c.c)
> > diff --git a/protobuf/userns.proto b/protobuf/userns.proto
> > new file mode 100644
> > index 0000000..9428549
> > --- /dev/null
> > +++ b/protobuf/userns.proto
> > @@ -0,0 +1,10 @@
> > +message uid_gid_extent {
> > +	required uint32 first		= 1;
> > +	required uint32 lower_first	= 2;
> > +	required uint32 count		= 3;
> > +}
> > +
> > +message userns_entry {
> > +	repeated uid_gid_extent uid_map	= 1;
> 
> Why repeated? Can one userns have more than one mapping?

Yes, it can.
> 
> > +	repeated uid_gid_extent gid_map = 2;
> > +}
> > 
> 


More information about the CRIU mailing list