userns: Document what the invariant required for safe unprivileged mappings.
authorEric W. Biederman <ebiederm@xmission.com>
Fri, 5 Dec 2014 23:51:47 +0000 (17:51 -0600)
committersungmin ha <sungmin82.ha@samsung.com>
Wed, 11 Mar 2015 10:50:40 +0000 (19:50 +0900)
commit00aa27ac13d0b65547d175064083687eb5f7c1c1
tree13f1d147e18e2c5fcd6620ec48fb364637f4bb7f
parent0106547004ef5da4b572801e87ce8aff4473c4e6
userns: Document what the invariant required for safe unprivileged mappings.

The rule is simple.  Don't allow anything that wouldn't be allowed
without unprivileged mappings.

It was previously overlooked that establishing gid mappings would
allow dropping groups and potentially gaining permission to files and
directories that had lesser permissions for a specific group than for
all other users.

This is the rule needed to fix CVE-2014-8989 and prevent any other
security issues with new_idmap_permitted.

The reason for this rule is that the unix permission model is old and
there are programs out there somewhere that take advantage of every
little corner of it.  So allowing a uid or gid mapping to be
established without privielge that would allow anything that would not
be allowed without that mapping will result in expectations from some
code somewhere being violated.  Violated expectations about the
behavior of the OS is a long way to say a security issue.

Change-Id: I66a4970dab52327190bc2c4540c4558219703267
Cc: stable@vger.kernel.org
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
kernel/user_namespace.c