Re: [RFC v2 PATCH 0/8] VFS:userns: support portable root filesystems
From: Serge Hallyn
Date: Wed May 04 2016 - 19:30:23 EST
Quoting Djalal Harouni (tixxdz@xxxxxxxxx):
> This is version 2 of the VFS:userns support portable root filesystems
> RFC. Changes since version 1:
>
> * Update documentation and remove some ambiguity about the feature.
> Based on Josh Triplett comments.
> * Use a new email address to send the RFC :-)
>
>
> This RFC tries to explore how to support filesystem operations inside
> user namespace using only VFS and a per mount namespace solution. This
> allows to take advantage of user namespace separations without
> introducing any change at the filesystems level. All this is handled
> with the virtual view of mount namespaces.
Given your use case, is there any way we could work in some tradeoffs
to protect the host? What I'm thinking is that containers can all
share devices uid-mapped at will, however any device mounted with
uid shifting cannot be used by the inital user namespace. Or maybe
just non-executable in that case, as you'll need enough access to
the fs to set up the containers you want to run.
So if /dev/sda1 is your host /, you have to use /dev/sda2 as the
container rootfs source. Mount it under /containers with uid
shifting. Now all containers regardless of uid mappings see
the shifted fs contents. But the host root cannot be tricked by
files on it, as /dev/sda2 is non-executable as far as it is
concerned.
Just a thought.