Skip to content

test(e2e): reproduce constrained dev shm failure#522

Open
wan9chi wants to merge 1 commit into
fspy-shm-lifecyclefrom
constrained-dev-shm-e2e
Open

test(e2e): reproduce constrained dev shm failure#522
wan9chi wants to merge 1 commit into
fspy-shm-lifecyclefrom
constrained-dev-shm-e2e

Conversation

@wan9chi

@wan9chi wan9chi commented Jul 9, 2026

Copy link
Copy Markdown
Member

Motivation

Capture issue #353 as a deterministic Linux-glibc E2E failure before changing the shared-memory implementation.

Background

The current Linux backend creates a sparse 4 GiB POSIX shared-memory object under /dev/shm. On constrained container or Kubernetes tmpfs mounts, touching pages beyond available capacity raises SIGBUS. The reproduction needs to exceed one native page with very few accesses and prove that the eventual fix changes the backing store rather than weakening the test.

Changes

  • Adds vtt small_dev_shm, which enters private user and mount namespaces and mounts a one-page tmpfs at /dev/shm.
  • Adds vtt stat_long_filename <count> without changing the existing stat-file utility.
  • Calls std::fs::metadata with a 1 MiB pathname so fspy serializes a frame larger than any supported base page before the kernel returns ENAMETOOLONG.
  • Intercepts glibc's statx symbol so Rust metadata calls travel through fspy's normal preload path.
  • Adds a Linux-glibc-only cached-task fixture and explanatory generated snapshot.
  • Records the pre-fix behavior as exit code 135 from SIGBUS while keeping the snapshot test itself green.

wan9chi commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aaaf01b298

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/vite_task_bin/src/vtt/stat_file.rs Outdated
Comment thread crates/vite_task_bin/src/vtt/stat_file.rs
@wan9chi wan9chi force-pushed the fspy-shm-lifecycle branch from 67ee808 to 669ab52 Compare July 9, 2026 07:57
@wan9chi wan9chi force-pushed the constrained-dev-shm-e2e branch from aaaf01b to a64e9b8 Compare July 9, 2026 07:57
@wan9chi wan9chi force-pushed the fspy-shm-lifecycle branch 2 times, most recently from 70822fb to 8716c77 Compare July 9, 2026 14:16
@wan9chi wan9chi force-pushed the constrained-dev-shm-e2e branch from a64e9b8 to ae72983 Compare July 9, 2026 14:16
@wan9chi wan9chi marked this pull request as draft July 10, 2026 01:16
@wan9chi wan9chi force-pushed the fspy-shm-lifecycle branch from 8716c77 to 4e0e749 Compare July 10, 2026 06:02
@wan9chi wan9chi force-pushed the constrained-dev-shm-e2e branch from ae72983 to ac080f6 Compare July 10, 2026 06:02
Comment thread crates/vite_task_bin/src/vtt/small_dev_shm.rs
Comment thread crates/vite_task_bin/src/vtt/small_dev_shm.rs Outdated
Comment thread crates/vite_task_bin/src/vtt/small_dev_shm.rs Outdated
Comment thread crates/vite_task_bin/src/vtt/stat_long_filename.rs
Comment thread crates/vite_task_bin/Cargo.toml
@wan9chi wan9chi force-pushed the constrained-dev-shm-e2e branch 3 times, most recently from 4119fee to d949311 Compare July 10, 2026 07:14
@wan9chi wan9chi force-pushed the constrained-dev-shm-e2e branch from d949311 to 23ada60 Compare July 10, 2026 07:27
@wan9chi wan9chi marked this pull request as ready for review July 10, 2026 07:37

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 23ada60b5c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

comment = """
Mounting a one-page `/dev/shm` reproduces the SIGBUS seen before fspy moved its shared-memory backing to memfd.
"""
platform = "linux-gnu"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Guard the namespace-dependent fixture

This schedules the new fixture in the default Linux-glibc e2e run, but its step invokes vtt small_dev_shm, which immediately creates user/mount namespaces and mounts a tmpfs over /dev/shm. On glibc Linux hosts or containers where unprivileged user namespaces or mounts are disabled by sysctl/seccomp, the helper exits with an error instead of the expected SIGBUS 135, so cargo test -p vite_task_bin --test e2e_snapshots fails before exercising the regression. Please mark this case ignored or add a capability probe/skip.

Useful? React with 👍 / 👎.

Co-authored-by: GPT-5.6 <gpt-5.6@openai.com>
Co-authored-by: GPT-5 Codex <codex@openai.com>
@wan9chi wan9chi force-pushed the constrained-dev-shm-e2e branch from 23ada60 to 7c023af Compare July 10, 2026 08:12
#[expect(clippy::allow_attributes, reason = "using allow because unused_imports may or may not fire depending on macro expansion")]
#[allow(unused_imports, reason = "glob import brings types into scope for macro-generated code")]
use super::*;
$(#[$original_attribute])*

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Don't add this. Hardcode the allow attribute here.

Comment on lines +28 to +33
#[cfg(not(target_os = "linux"))]
mod small_dev_shm {
pub fn run(_args: &[String]) -> anyhow::Result<()> {
anyhow::bail!("vtt small_dev_shm is only supported on Linux")
}
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Don't mock run. Directly bail inside the match arm

Comment on lines +63 to +65
// SAFETY: forwards statx through the existing syscall interposer, which
// records the access, handles null availability probes, and calls the
// original libc syscall function. The final zero supplies its sixth

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Don't do this. Forward to statx instead of syscall

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.

1 participant