Skip to content

Conversation

@viyatb-oai
Copy link
Collaborator

@viyatb-oai viyatb-oai commented Jan 26, 2026

Summary

This PR introduces a gated Bubblewrap (bwrap) Linux sandbox path. The curent Linux sandbox path relies on in-process restrictions (including Landlock). Bubblewrap gives us a more uniform filesystem isolation model, especially explicit writable roots with the option to make some directories read-only and granular network controls.

This is behind a feature flag so we can validate behavior safely before making it the default.

  • Added temporary rollout flag:
    • features.use_linux_sandbox_bwrap
  • Preserved existing default path when the flag is off.
  • In Bubblewrap mode:
    • Added internal retry without /proc when /proc mount is not permitted by the host/container.

@viyatb-oai viyatb-oai requested a review from bolinfest January 27, 2026 23:40
@viyatb-oai viyatb-oai changed the title linux sandbox improvements feat(linux-sandbox): swap landlock for bwrap for sandboxing Feb 2, 2026
@viyatb-oai viyatb-oai changed the base branch from main to codex/viyatb/bwrap-vendoring February 2, 2026 21:24
@viyatb-oai viyatb-oai marked this pull request as ready for review February 2, 2026 21:24
Copy link
Contributor

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

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: 5aa61a15ff

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

@viyatb-oai viyatb-oai changed the title feat(linux-sandbox): swap landlock for bwrap for sandboxing feat(linux-sandbox): add bwrap support Feb 2, 2026
@viyatb-oai viyatb-oai force-pushed the viyat/bwrap branch 2 times, most recently from 4d27a26 to 0198203 Compare February 3, 2026 04:22
@viyatb-oai viyatb-oai force-pushed the codex/viyatb/bwrap-vendoring branch from 3a4a6ed to 077419b Compare February 3, 2026 04:27
@viyatb-oai viyatb-oai force-pushed the viyat/bwrap branch 2 times, most recently from a7b4ed5 to 669ccb9 Compare February 3, 2026 07:16
viyatb-oai added a commit that referenced this pull request Feb 3, 2026
## Summary

Vendor Bubblewrap into the repo and add minimal build plumbing in
`codex-linux-sandbox` to compile/link it.

## Why

We want to move Linux sandboxing toward Bubblewrap, but in a safe
two-step rollout:
1) vendoring/build setup (this PR),  
2) runtime integration (follow-up PR).

## Included

- Add `codex-rs/vendor/bubblewrap` sources.
- Add build-time FFI path in `codex-rs/linux-sandbox`.
- Update `build.rs` rerun tracking for vendored files.
- Small vendored compile warning fix (`sockaddr_nl` full init).

follow up in #9938
Base automatically changed from codex/viyatb/bwrap-vendoring to main February 3, 2026 07:33

/// Execute the build-time bubblewrap `main` function with the given argv.
pub(crate) fn exec_vendored_bwrap(argv: Vec<String>) -> ! {
let exit_code = run_vendored_bwrap_main(&argv);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, so this appears to be the end of main():

https://github.com/containers/bubblewrap/blob/535238486c5d41be5ee49c6a85842b6f29ba93b5/bubblewrap.c#L3626-L3640

where:

if (execvp (exec_path, argv) == -1)

leads to:

die_with_error ("execvp %s", exec_path);

but if execvp() does not return -1, then bwrap's main returns 0, even though that suggests something has gone horribly wrong?

Copy link
Collaborator

@bolinfest bolinfest left a comment

Choose a reason for hiding this comment

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

OK, a handful of questions/clarifications!

@viyatb-oai viyatb-oai merged commit ae4de43 into main Feb 4, 2026
41 of 44 checks passed
@viyatb-oai viyatb-oai deleted the viyat/bwrap branch February 4, 2026 19:13
@github-actions github-actions bot locked and limited conversation to collaborators Feb 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants