uidgid: Do not consider two invalid ids to be equal

INVALID_{U,G}ID do not represent actual ids; rather, the represent the
absence of a valid id. Two different invalid ids may represent different
things -- for example, one may represent an unitialized id while another
might represent an id from a filesystem with no mapping in a particular
user namespace, or they may represent different on-disk ids which both
fail to map into a user namespace. Treating two arbitrary invalid ids as
equal may lead to errors.

Change {u,g}id_eq() to return false when both ids are invalid. This will
harden the kernel against accidental comparison between invalid ids.

There are legitimate reasons for checking whether an id is invalid, but
code which needs to do this can use {u,g}id_valid(). All code which was
using {u,g}id_eq() to check for invalid ids were updated in the previous
patch.

Signed-off-by: Seth Forshee <sforshee@digitalocean.com>
1 file changed