Skip to content

Commit

Permalink
Merge pull request #72 from giuseppe/fix-huser-rootless
Browse files Browse the repository at this point in the history
psgo: use the host process to read uids/gids
  • Loading branch information
vrothberg authored Jun 1, 2020
2 parents fe6129b + a083b59 commit 1082112
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions psgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ func processHPID(p *process.Process, ctx *psContext) (string, error) {
func processHUSER(p *process.Process, ctx *psContext) (string, error) {
if hp := findHostProcess(p, ctx); hp != nil {
if ctx.opts != nil && len(ctx.opts.UIDMap) > 0 {
return findID(p.Status.Uids[1], ctx.opts.UIDMap, process.LookupUID, "/proc/sys/fs/overflowuid")
return findID(hp.Status.Uids[1], ctx.opts.UIDMap, process.LookupUID, "/proc/sys/fs/overflowuid")
}
return hp.Huser, nil
}
Expand All @@ -860,7 +860,7 @@ func processHUSER(p *process.Process, ctx *psContext) (string, error) {
func processHGROUP(p *process.Process, ctx *psContext) (string, error) {
if hp := findHostProcess(p, ctx); hp != nil {
if ctx.opts != nil && len(ctx.opts.GIDMap) > 0 {
return findID(p.Status.Gids[1], ctx.opts.GIDMap, process.LookupGID, "/proc/sys/fs/overflowgid")
return findID(hp.Status.Gids[1], ctx.opts.GIDMap, process.LookupGID, "/proc/sys/fs/overflowgid")
}
return hp.Hgroup, nil
}
Expand Down

0 comments on commit 1082112

Please sign in to comment.