Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: tar extract with overlayfs whiteout #546

Open
rchincha opened this issue May 30, 2024 · 1 comment
Open

bug: tar extract with overlayfs whiteout #546

rchincha opened this issue May 30, 2024 · 1 comment

Comments

@rchincha
Copy link
Contributor

rchincha commented May 30, 2024

If the tar contents are

/a/.wh.b
/a/b/c/d

and we use a tar extractor with overlayfs whiteout option (assuming I want to overlayfs the unpacked layers), then at:
https://github.com/opencontainers/umoci/blob/main/oci/layer/tar_extract.go#L490
^ a mknod happens when /a/.wh.b is encountered.

However, when /a/b/c/d is encountered, cannot really do a mkdir /a/b/c/ at:
https://github.com/opencontainers/umoci/blob/main/oci/layer/tar_extract.go#L513
^ since /a/b is a non-dir entry.

There are two ways to fix this:

  1. on a /a/.wh.b, just remove that entry completely (rm -rf /a/b) and proceed
  2. set trusted.overlay.opaque=y for /a/b and proceed ... basically force this https://github.com/opencontainers/umoci/blob/main/oci/layer/tar_extract.go#L369

@cyphar Thoughts?

@rchincha
Copy link
Contributor Author

rchincha commented May 30, 2024

+++ b/oci/layer/tar_extract.go
@@ -380,7 +380,9 @@ func (te *TarExtractor) overlayFSWhiteout(dir string, file string) error {

-       err := te.fsEval.Mknod(p, unix.S_IFCHR|0666, unix.Mkdev(0, 0))
+       err := te.fsEval.Lsetxattr(dir, "user.overlay.opaque", []byte("y"), 0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant