Skip to content

Commit

Permalink
Merge pull request #932 from rhatdan/master
Browse files Browse the repository at this point in the history
canUseShifting can segfault
  • Loading branch information
vrothberg authored Jun 9, 2021
2 parents b168bfb + 3b2f449 commit 38ac468
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions store.go
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ func (s *store) ContainerStore() (ContainerStore, error) {
}

func (s *store) canUseShifting(uidmap, gidmap []idtools.IDMap) bool {
if !s.graphDriver.SupportsShifting() {
if s.graphDriver == nil || !s.graphDriver.SupportsShifting() {
return false
}
if uidmap != nil && !idtools.IsContiguous(uidmap) {
Expand Down Expand Up @@ -2668,6 +2668,10 @@ func (s *store) mount(id string, options drivers.MountOpts) (string, error) {
s.lastLoaded = time.Now()
}

if options.UidMaps != nil || options.GidMaps != nil {
options.DisableShifting = !s.canUseShifting(options.UidMaps, options.GidMaps)
}

if rlstore.Exists(id) {
return rlstore.Mount(id, options)
}
Expand Down Expand Up @@ -2708,7 +2712,6 @@ func (s *store) Mount(id, mountLabel string) (string, error) {
options.Volatile = v.(bool)
}
}
options.DisableShifting = !s.canUseShifting(container.UIDMap, container.GIDMap)
}
return s.mount(id, options)
}
Expand Down

0 comments on commit 38ac468

Please sign in to comment.