Re: [systemd-devel] [PATCH 1/2] Add detect_userns to detect uid/gid shifts

2015-01-09 Thread Lennart Poettering
On Fri, 09.01.15 01:16, Tom Gundersen (t...@jklm.no) wrote: > On Fri, Jan 9, 2015 at 12:55 AM, Stéphane Graber wrote: > > I expect we'll run into some more problems when dealing with units that > > start with their own view of /dev since mknod in a userns isn't allowed > > but I haven't run into

Re: [systemd-devel] [PATCH 1/2] Add detect_userns to detect uid/gid shifts

2015-01-09 Thread Lennart Poettering
On Thu, 08.01.15 18:55, Stéphane Graber (stgra...@ubuntu.com) wrote: > On Fri, Jan 09, 2015 at 12:39:23AM +0100, Lennart Poettering wrote: > > On Thu, 08.01.15 15:33, Stéphane Graber (stgra...@ubuntu.com) wrote: > > > > > As far as I know there's no obvious way to detect this case (well, > > > sh

Re: [systemd-devel] [PATCH 1/2] Add detect_userns to detect uid/gid shifts

2015-01-08 Thread Stéphane Graber
On Fri, Jan 09, 2015 at 01:16:15AM +0100, Tom Gundersen wrote: > On Fri, Jan 9, 2015 at 12:55 AM, Stéphane Graber wrote: > > I expect we'll run into some more problems when dealing with units that > > start with their own view of /dev since mknod in a userns isn't allowed > > but I haven't run int

Re: [systemd-devel] [PATCH 1/2] Add detect_userns to detect uid/gid shifts

2015-01-08 Thread Tom Gundersen
On Fri, Jan 9, 2015 at 12:55 AM, Stéphane Graber wrote: > I expect we'll run into some more problems when dealing with units that > start with their own view of /dev since mknod in a userns isn't allowed > but I haven't run into one of those yet so it's not very high on my list. > > Once that happ

Re: [systemd-devel] [PATCH 1/2] Add detect_userns to detect uid/gid shifts

2015-01-08 Thread Stéphane Graber
On Fri, Jan 09, 2015 at 12:39:23AM +0100, Lennart Poettering wrote: > On Thu, 08.01.15 15:33, Stéphane Graber (stgra...@ubuntu.com) wrote: > > > As far as I know there's no obvious way to detect this case (well, > > short of trying a bunch of restricted syscalls). The only way I'm > > aware of is

Re: [systemd-devel] [PATCH 1/2] Add detect_userns to detect uid/gid shifts

2015-01-08 Thread Lennart Poettering
On Thu, 08.01.15 15:33, Stéphane Graber (stgra...@ubuntu.com) wrote: > As far as I know there's no obvious way to detect this case (well, > short of trying a bunch of restricted syscalls). The only way I'm > aware of is by comparing the target of /proc/self/ns/user to that of > /proc//ns/user whic

Re: [systemd-devel] [PATCH 1/2] Add detect_userns to detect uid/gid shifts

2015-01-08 Thread Stéphane Graber
On Thu, Jan 08, 2015 at 11:17:44PM +0100, Lennart Poettering wrote: > On Thu, 08.01.15 14:27, Stéphane Graber (stgra...@ubuntu.com) wrote: > > > This adds a new detect_userns function in virt.c which will check > > whether systemd is running in the host user namespace (single map of all > > availa

Re: [systemd-devel] [PATCH 1/2] Add detect_userns to detect uid/gid shifts

2015-01-08 Thread Djalal Harouni
On Thu, Jan 08, 2015 at 09:25:07PM +0100, Tom Gundersen wrote: > On Thu, Jan 8, 2015 at 8:59 PM, Stéphane Graber wrote: > > On Thu, Jan 08, 2015 at 08:43:12PM +0100, Tom Gundersen wrote: > >> On Thu, Jan 8, 2015 at 8:27 PM, Stéphane Graber > >> wrote: > >> > +/* If both uid_map and gid_m

Re: [systemd-devel] [PATCH 1/2] Add detect_userns to detect uid/gid shifts

2015-01-08 Thread Lennart Poettering
On Thu, 08.01.15 14:27, Stéphane Graber (stgra...@ubuntu.com) wrote: > This adds a new detect_userns function in virt.c which will check > whether systemd is running in the host user namespace (single map of all > available uids and gids) or is using a uid/gid map. > > The check makes sure that u

Re: [systemd-devel] [PATCH 1/2] Add detect_userns to detect uid/gid shifts

2015-01-08 Thread Stéphane Graber
On Thu, Jan 08, 2015 at 09:25:07PM +0100, Tom Gundersen wrote: > On Thu, Jan 8, 2015 at 8:59 PM, Stéphane Graber wrote: > > On Thu, Jan 08, 2015 at 08:43:12PM +0100, Tom Gundersen wrote: > >> On Thu, Jan 8, 2015 at 8:27 PM, Stéphane Graber > >> wrote: > >> > +/* If both uid_map and gid_m

Re: [systemd-devel] [PATCH 1/2] Add detect_userns to detect uid/gid shifts

2015-01-08 Thread Tom Gundersen
On Thu, Jan 8, 2015 at 8:59 PM, Stéphane Graber wrote: > On Thu, Jan 08, 2015 at 08:43:12PM +0100, Tom Gundersen wrote: >> On Thu, Jan 8, 2015 at 8:27 PM, Stéphane Graber wrote: >> > +/* If both uid_map and gid_map don't exist or if they both match >> > + * the full uid/gid range,

Re: [systemd-devel] [PATCH 1/2] Add detect_userns to detect uid/gid shifts

2015-01-08 Thread Djalal Harouni
On Thu, Jan 08, 2015 at 02:59:46PM -0500, Stéphane Graber wrote: > On Thu, Jan 08, 2015 at 08:43:12PM +0100, Tom Gundersen wrote: > > On Thu, Jan 8, 2015 at 8:27 PM, Stéphane Graber wrote: > > > This adds a new detect_userns function in virt.c which will check > > > whether systemd is running in t

Re: [systemd-devel] [PATCH 1/2] Add detect_userns to detect uid/gid shifts

2015-01-08 Thread Stéphane Graber
On Thu, Jan 08, 2015 at 08:43:12PM +0100, Tom Gundersen wrote: > On Thu, Jan 8, 2015 at 8:27 PM, Stéphane Graber wrote: > > This adds a new detect_userns function in virt.c which will check > > whether systemd is running in the host user namespace (single map of all > > available uids and gids) or

Re: [systemd-devel] [PATCH 1/2] Add detect_userns to detect uid/gid shifts

2015-01-08 Thread Tom Gundersen
On Thu, Jan 8, 2015 at 8:27 PM, Stéphane Graber wrote: > This adds a new detect_userns function in virt.c which will check > whether systemd is running in the host user namespace (single map of all > available uids and gids) or is using a uid/gid map. > > The check makes sure that uid_map and gid_

[systemd-devel] [PATCH 1/2] Add detect_userns to detect uid/gid shifts

2015-01-08 Thread Stéphane Graber
This adds a new detect_userns function in virt.c which will check whether systemd is running in the host user namespace (single map of all available uids and gids) or is using a uid/gid map. The check makes sure that uid_map and gid_map are both exactly equal to the default host map (assuming 32bi