Please sign in to comment.
userns: also map extents in the reverse map to kernel IDs
The current logic first clones the extent array and sorts both copies, then maps the lower IDs of the forward mapping into the lower namespace, but doesn't map the lower IDs of the reverse mapping. This means that code in a nested user namespace with >5 extents will see incorrect IDs. It also breaks some access checks, like inode_owner_or_capable() and privileged_wrt_inode_uidgid(), so a process can incorrectly appear to be capable relative to an inode. To fix it, we have to make sure that the "lower_first" members of extents in both arrays are translated; and we have to make sure that the reverse map is sorted *after* the translation (since otherwise the translation can break the sorting). This is CVE-2018-18955. Fixes: 6397fac ("userns: bump idmap limits to 340") Cc: email@example.com Signed-off-by: Jann Horn <firstname.lastname@example.org> Tested-by: Eric W. Biederman <email@example.com> Reviewed-by: Eric W. Biederman <firstname.lastname@example.org> Signed-off-by: Eric W. Biederman <email@example.com>
- Loading branch information...