Skip to content

Fix rootfs-upper tar to preserve opaque xattrs#12769

Open
copybara-service[bot] wants to merge 1 commit intomasterfrom
test/cl886990834
Open

Fix rootfs-upper tar to preserve opaque xattrs#12769
copybara-service[bot] wants to merge 1 commit intomasterfrom
test/cl886990834

Conversation

@copybara-service
Copy link

Fix rootfs-upper tar to preserve opaque xattrs

Summary

  • The runsc tar rootfs-upper command was not preserving extended attributes (xattrs) during serialization. This caused trusted.overlay.opaque to be lost, resulting in stale lower-layer files being resurrected when restoring from a tar snapshot.
  • Xattrs are now serialized to PAXRecords using the standard SCHILY.xattr. prefix during tar creation, and restored during tar extraction.
  • Added RawXattrs/SetRawXattrs methods to SimpleExtendedAttributes for unchecked access in the kernel serialization path.

Test plan

  • Added TestTarRootfsUpperLayerOpaqueDir regression test that deletes /usr/share (which has lower-layer files), recreates it with only a marker file, tars the upper layer, restores it, and verifies no stale files leak through.
  • Verify the regression test fails on the parent commit (without the fix) by checking out HEAD~1 and running the test.
  • Run the full container test suite to check for regressions.

🤖 Generated with Claude Code

FUTURE_COPYBARA_INTEGRATE_REVIEW=#12633 from danielnorberg:fix-tar-rootfs-upper-opaque-xattr 4c7c190

@copybara-service copybara-service bot added the exported Issue was exported automatically label Mar 20, 2026
@copybara-service copybara-service bot force-pushed the test/cl886990834 branch 2 times, most recently from 987d8ba to f2f8a04 Compare March 20, 2026 23:20
## Summary
- The `runsc tar rootfs-upper` command was not preserving extended attributes (xattrs) during serialization. This caused `trusted.overlay.opaque` to be lost, resulting in stale lower-layer files being resurrected when restoring from a tar snapshot.
- Xattrs are now serialized to PAXRecords using the standard `SCHILY.xattr.` prefix during tar creation, and restored during tar extraction.
- Added `RawXattrs`/`SetRawXattrs` methods to `SimpleExtendedAttributes` for unchecked access in the kernel serialization path.

## Test plan
- [x] Added `TestTarRootfsUpperLayerOpaqueDir` regression test that deletes `/usr/share` (which has lower-layer files), recreates it with only a marker file, tars the upper layer, restores it, and verifies no stale files leak through.
- [x] Verify the regression test fails on the parent commit (without the fix) by checking out `HEAD~1` and running the test.
- [x] Run the full container test suite to check for regressions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

FUTURE_COPYBARA_INTEGRATE_REVIEW=#12633 from danielnorberg:fix-tar-rootfs-upper-opaque-xattr 4c7c190
PiperOrigin-RevId: 886990834
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

exported Issue was exported automatically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant