Skip to content

test: add overlay copy-up tests for FIFOs and sockets - #14075

Open
wpan36 wants to merge 1 commit into
google:masterfrom
wpan36:test-13998-overlay-copyup
Open

test: add overlay copy-up tests for FIFOs and sockets#14075
wpan36 wants to merge 1 commit into
google:masterfrom
wpan36:test-13998-overlay-copyup

Conversation

@wpan36

@wpan36 wpan36 commented Aug 11, 2026

Copy link
Copy Markdown

Description

Add CopyUpTest coverage for non-copy-upable lower-layer FIFOs and Unix domain sockets under overlayfs.

The tests verify that:

  • access(..., W_OK) fails with EACCES for lower-layer FIFOs and sockets.
  • open(O_WRONLY) fails with EPERM instead of proceeding through an invalid copy-up path.

The host FIFO and UDS test fixtures are also adjusted for overlay variants. Individual special-file bind mounts are omitted because a FIFO or socket cannot itself be used as an overlay lower root, while the directory-backed mounts remain available to expose these files as lower-layer dentries.

This covers the non-copy-upable FIFO/socket cases from #13998. The remaining copy-up trigger, permission, and read-only mount cases can be covered separately.

Updates #13998

Testing

  • make syscall-tests OPTIONS="--nocache_test_results" TARGETS="//test/syscalls:copy_up_test_runsc_systrap_overlay"
  • make syscall-tests OPTIONS="--nocache_test_results" TARGETS="//test/syscalls:copy_up_test_runsc_systrap_directfs"
  • make syscall-tests OPTIONS="--nocache_test_results" TARGETS="//test/syscalls:pipe_external_test_runsc_systrap_directfs"
  • make syscall-tests OPTIONS="--nocache_test_results" TARGETS="//test/syscalls:connect_external_test_runsc_systrap_directfs"
  • make test TARGETS="//test/runner:runner_nogo"

Also verified the regression coverage by locally restoring the writable-open ordering that previously bypassed the non-copy-upable lower-layer check: LowerFIFOOpenForWriteFails failed with EROFS instead of the expected EPERM. Restoring the current implementation makes the test pass.

Add syscall coverage for lower-layer FIFOs and Unix sockets under overlayfs. Verify that write access fails with EACCES and writable opens fail with EPERM for non-copy-upable lower dentries.

Adjust host FIFO and UDS fixtures so special-file attach mounts are omitted from overlay variants while preserving the directory-backed lower layers used by the tests.

Updates google#13998

Assisted-by: ChatGPT
Comment thread test/syscalls/BUILD
add_host_fifo = True,
add_host_uds = True,
add_overlay = True,
allow_native = False,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why "allow_native = False" ? The whole point of these tests is to test compatibility against Linux...

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I originally set allow_native = False because the generated native syscall-test variant does not get the runner-provided overlay setup. In test/runner/defs.bzl, allow_native = True generates a native variant with overlay = False. As a result, my current native tests would just hit the IsOverlayfs() skip rather than actually exercise Linux overlayfs.

I also tested the equivalent setup manually on native Linux overlayfs on Ubuntu 22.04.5 LTS with kernel 6.8.0-136-generic. I observed:

  • access(path, W_OK) on lower FIFO/socket succeeds.
  • open(FIFO, O_WRONLY | O_NONBLOCK) returns ENXIO when there is no reader.
  • This differs from the current gVisor expectations of EACCES / EPERM.

Would you prefer that I update the expected behavior accordingly?

Also, for the native variant, would you recommend having the test create its own Linux overlayfs setup (lower/upper/work/merged), or extending the runner so that the native variant gets an overlay-backed test tree as well? I don't see an existing syscall_test option that generates a native variant with the runner's overlay setup, so I'd appreciate your guidance on which approach fits the test infrastructure better.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I see. IMO it makes sense to do it right and extend the runner, and yeah for those places where we have a divergence with Linux we should fix it unless it's there for a specific reason.

@milantracy WDYT?

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

Successfully merging this pull request may close these issues.

2 participants