Merge pull request #8254 from gabriel-samfira/fix-access-denied-on-vhdx-mount
Fix access denied on mounted vhdx root
This commit is contained in:
@@ -478,7 +478,13 @@ func (s *snapshotter) convertScratchToReadOnlyLayer(ctx context.Context, snapsho
|
||||
writer.CloseWithError(err)
|
||||
}()
|
||||
|
||||
if _, err := ociwclayer.ImportLayerFromTar(ctx, reader, path, parentLayerPaths); err != nil {
|
||||
// It seems that in certain situations, like having the containerd root and state on a file system hosted on a
|
||||
// mounted VHDX, we need SeSecurityPrivilege when opening a file with winio.ACCESS_SYSTEM_SECURITY. This happens
|
||||
// in the base layer writer in hcsshim when adding a new file.
|
||||
if err := winio.RunWithPrivileges([]string{winio.SeSecurityPrivilege}, func() error {
|
||||
_, err := ociwclayer.ImportLayerFromTar(ctx, reader, path, parentLayerPaths)
|
||||
return err
|
||||
}); err != nil {
|
||||
return fmt.Errorf("failed to reimport snapshot: %w", err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user