Skip to content

Commit

Permalink
Merge pull request #7919 from rhatdan/subuid
Browse files Browse the repository at this point in the history
Fix handling of CheckRootlessUIDRange
  • Loading branch information
openshift-merge-robot authored Oct 5, 2020
2 parents a0bf026 + 30bd8ed commit f48b163
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/util/utils_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,12 @@ func CheckRootlessUIDRange(uid int) error {
if err != nil {
return err
}
total := 0
for _, u := range uids {
// add 1 since we also map in the user's own UID
if uid > u.Size+1 {
return errors.Errorf("requested user's UID %d is too large for the rootless user namespace", uid)
}
total += u.Size
}
if uid > total {
return errors.Errorf("requested user's UID %d is too large for the rootless user namespace", uid)
}
return nil
}

0 comments on commit f48b163

Please sign in to comment.