Skip to content

fix(vm): give guest-visible directories explicit modes under a strict service umask - #5147

Closed
vineethsai7 wants to merge 1 commit into
NVIDIA:mainfrom
vineethsai7:fix/4014-vm-guest-dir-modes
Closed

vineethsai7 wants to merge 1 commit into
NVIDIA:mainfrom
vineethsai7:fix/4014-vm-guest-dir-modes

Conversation

@vineethsai7

Copy link
Copy Markdown

Summary

Give VM guest root directories explicit permissions so a non-root sandbox can traverse its root filesystem when the gateway uses the packaged UMask=0077. The capability probe's /proc/self/status error is the first visible failure after the guest switches to the sandbox UID.

Related Issue

Closes #4014

Changes

  • The VM driver formats ext4 disks from staging directories. Under UMask=0077, its overlay /upper was copied into the disk as 0700; the guest mounts that upper directory at /newroot. Set /upper and the image preparation /upper/srv to 0755 explicitly.
  • Keep the host staging root and the guest disk's root-only /work and /config directories at 0700. No gateway service umask or host state directory permissions change.
  • Give the host-built rootfs and directories newly added to it 0755. Newly generated /etc/passwd and /etc/group are 0644; /etc/shadow and /etc/gshadow are 0600. Existing /srv, /opt, and /etc directories from the image retain their modes.
  • Add regression tests that create both guest disk layouts and the host-built rootfs under umask 0077, then check the resulting directory and account-file modes. The disk test reads inode modes from the formatted ext4 images.

Release Notes

MicroVM guest disk creation now supports non-root sandboxes under the gateway's restrictive service umask.

Testing

  • Checks appropriate to the affected code and behavior pass
  • Unit tests added/updated (if applicable)
  • E2E tests added/updated (if applicable)

The new disk regression test failed before the fix with /upper at 0700 instead of 0755, then passed after it. All of the following passed:

cargo fmt --check --package openshell-driver-vm
cargo clippy --quiet -p openshell-driver-vm --all-targets -- -D warnings
cargo test --quiet -p openshell-driver-vm

The crate test run passed 270 library tests, 23 driver binary tests, 2 VM init tests, and 3 integration tests. A live VM startup check remains open.

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Architecture docs updated (if applicable; no architecture change)

Signed-off-by: Vineeth Sai Narajala <vnarajal@cisco.com>
@copy-pr-bot

copy-pr-bot Bot commented Nov 2, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T19:25:34.298234Z f2737ff PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: f2737ff6ce

ℹ️ 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".

fs::create_dir_all(staging_dir.join("config"))
.map_err(|err| format!("create overlay config dir: {err}"))?;
create_disk_staging_dir(&staging_dir, 0o700)?;
create_disk_staging_dir(&staging_dir.join("upper"), 0o755)?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Bump the overlay-template cache layout version

On an upgraded packaged gateway that already has images/overlay-templates/sandbox-overlay-ext4-v1/<size>.ext4 from the old UMask=0077 code, overlay_template_image_ready and ensure_sandbox_overlay_template_image accept that file solely by its length, so this 0755 creation is never reached and every newly cloned overlay still has /upper at 0700; the sandbox user therefore still cannot traverse /newroot. Bump OVERLAY_TEMPLATE_CACHE_LAYOUT_VERSION (or validate and rebuild the cached inode mode) and cover the populated-cache upgrade path so the required sandbox e2e flow actually exercises the fix.

AGENTS.md reference: AGENTS.md:L163-L163

Useful? React with 👍 / 👎.

@vineethsai7

Copy link
Copy Markdown
Author

Closing this in favour of #5099, which was opened first and takes the same approach: explicit 0755 on the guest directories, whatever the service umask.

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.

bug(vm): capability probe cannot read /proc/self/status on rootless RHEL HPC host

1 participant