Skip to content

Validate VM file descriptors before ownership transfer#177

Merged
fkorotkov-oai merged 2 commits into
openai:mainfrom
fallintoplace:agent/validate-vm-fd
Jul 16, 2026
Merged

Validate VM file descriptors before ownership transfer#177
fkorotkov-oai merged 2 commits into
openai:mainfrom
fallintoplace:agent/validate-vm-fd

Conversation

@fallintoplace

Copy link
Copy Markdown
Contributor

Summary

  • Reject negative --vm-fd values during CLI parsing.
  • Duplicate the supplied descriptor with F_DUPFD_CLOEXEC before taking ownership.
  • Verify that the duplicate is an open AF_UNIX datagram socket.
  • Add coverage for negative, closed, non-socket, non-datagram, and ownership cases.

Why

VM::new previously converted the caller-supplied raw descriptor directly into a UnixDatagram. Invalid input could fail unpredictably, and dropping the VM wrapper could close a descriptor still owned by the caller. Softnet now owns only a validated duplicate.

Validation

  • cargo fmt --all -- --check
  • cargo check --all-targets
  • cargo check --target aarch64-apple-darwin --all-targets
  • Focused library and CLI tests passed directly.

The repository's full test command is configured to run through sudo -E; that runner could not authenticate in this environment, so the focused test binaries were run without the configured runner.

@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: 344572e104

ℹ️ 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 lib/vm.rs Outdated
@fkorotkov-oai
fkorotkov-oai requested a review from edi-oai July 14, 2026 17:22
@fkorotkov-oai

Copy link
Copy Markdown
Collaborator

LGTM. Could you please check linting issues

@fallintoplace
fallintoplace force-pushed the agent/validate-vm-fd branch from 36cbc4a to 1135bfd Compare July 14, 2026 22:08
@fkorotkov-oai
fkorotkov-oai merged commit 5d6b4b9 into openai:main Jul 16, 2026
2 checks passed
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