Skip to content

Commit 329bcf9

Browse files
committed
fix: wcow: cache: refactor the privilege logic down on the call stack
Fixes #5906, reverts #5980 Occasionally, the privilege disabling deffered call is executed before some kernel-side operations are complete. We therefore end up with some access denied errors in `prepareDigest` -> `os.Open()`. Fix this by taking the call closer to where the privileged operation takes place, but outside the recursion for optimal calls. Signed-off-by: Anthony Nandaa <[email protected]>
1 parent 5d47024 commit 329bcf9

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

cache/contenthash/checksum.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,6 @@ func (cm *cacheManager) Checksum(ctx context.Context, ref cache.ImmutableRef, p
111111
if err != nil {
112112
return "", nil
113113
}
114-
// only applies for Windows, it's a no-op on non-Windows.
115-
enableProcessPrivileges()
116-
defer disableProcessPrivileges()
117114
return cc.Checksum(ctx, ref, p, opts, s)
118115
}
119116

@@ -856,6 +853,10 @@ func (cc *cacheContext) scanChecksum(ctx context.Context, m *mount, p string, fo
856853
k := convertPathToKey(p)
857854
txn := cc.tree.Txn()
858855
root = txn.Root()
856+
857+
// only applies to Windows, it's a no-op for the rest.
858+
enableProcessPrivileges()
859+
defer disableProcessPrivileges()
859860
cr, updated, err := cc.checksum(ctx, root, txn, m, k, followTrailing)
860861
if err != nil {
861862
return nil, err

client/client_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6883,9 +6883,6 @@ func readFileInImage(ctx context.Context, t *testing.T, c *Client, ref, path str
68836883
}
68846884

68856885
func testCachedMounts(t *testing.T, sb integration.Sandbox) {
6886-
// TODO(profnandaa): skipping on Windows, investigating. #5906
6887-
integration.SkipOnPlatform(t, "windows")
6888-
68896886
c, err := New(sb.Context(), sb.Address())
68906887
require.NoError(t, err)
68916888
defer c.Close()

0 commit comments

Comments
 (0)