Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ jobs:
steps:
- uses: actions/checkout@v4

# necessary for sandbox
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libunwind-dev

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
Expand Down
11 changes: 5 additions & 6 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ uuid = { version = "1", features = ["v4"] }
nfsserve = "0.10"
async-trait = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
# Sandbox dependencies - (requires libunwind-dev on ARM)
agentfs-sandbox = { path = "../sandbox" }
reverie = { git = "https://github.com/facebookexperimental/reverie" }
reverie-ptrace = { git = "https://github.com/facebookexperimental/reverie" }
reverie-process = { git = "https://github.com/facebookexperimental/reverie" }

# macOS dependencies for FUSE and NFS functionality
[target.'cfg(target_os = "macos")'.dependencies]
Expand All @@ -52,12 +57,6 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] }
# with Apple clang (`veor3q_u8` in `aegis128l_neon_sha3.c`).
aegis = { version = "0.9.6", features = ["pure-rust"] }

# Sandbox dependencies - Linux x86_64 only (requires libunwind-ptrace)
[target.'cfg(all(target_os = "linux", target_arch = "x86_64"))'.dependencies]
agentfs-sandbox = { path = "../sandbox" }
reverie = { git = "https://github.com/facebookexperimental/reverie" }
reverie-ptrace = { git = "https://github.com/facebookexperimental/reverie" }
reverie-process = { git = "https://github.com/facebookexperimental/reverie" }

# The profile that 'dist' will build with
[profile.dist]
Expand Down
3 changes: 1 addition & 2 deletions cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ use std::process::Command;

fn main() {
// Sandbox uses libunwind-ptrace which depends on liblzma and gcc_s.
// Only available on Linux x86_64.
#[cfg(all(target_os = "linux", target_arch = "x86_64"))]
#[cfg(target_os = "linux")]
{
println!("cargo:rustc-link-lib=lzma");
// libgcc_s provides _Unwind_RaiseException and other exception handling symbols
Expand Down
4 changes: 2 additions & 2 deletions cli/src/cmd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ mod mount;
// - macOS: use NFS-based sandbox (run_nfs.rs)
// - Other platforms: use stub (run_stub.rs)

#[cfg(all(target_os = "linux", target_arch = "x86_64"))]
#[cfg(target_os = "linux")]
mod run;

#[cfg(target_os = "macos")]
#[path = "run_nfs.rs"]
mod run;

#[cfg(not(any(all(target_os = "linux", target_arch = "x86_64"), target_os = "macos")))]
#[cfg(not(any(all(target_os = "linux"), target_os = "macos")))]
#[path = "run_stub.rs"]
mod run;

Expand Down
2 changes: 1 addition & 1 deletion cli/src/cmd/run.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Run command handler for Linux x86_64.
//! Run command handler for Linux.
//!
//! Dispatches to either the overlay sandbox (default) or the experimental
//! ptrace-based sandbox based on command-line flags.
Expand Down
4 changes: 3 additions & 1 deletion cli/src/cmd/run_stub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ pub async fn handle_run_command(
_command: PathBuf,
_args: Vec<String>,
) -> Result<()> {
eprintln!("Error: The 'run' command is only available on Linux x86_64.");
eprintln!(
"Error: The 'run' command is only available on Linux (on ARM requires libunwind-dev)."
);
eprintln!();
eprintln!("However, you can still use the other AgentFS commands:");
eprintln!(" - 'agentfs init' to create a new agent filesystem");
Expand Down
4 changes: 2 additions & 2 deletions cli/src/sandbox/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
//! - `overlay`: FUSE + namespace-based sandbox with copy-on-write filesystem
//! - `ptrace`: ptrace-based syscall interception sandbox (experimental)

#[cfg(all(target_os = "linux", target_arch = "x86_64"))]
#[cfg(target_os = "linux")]
pub mod overlay;

#[cfg(all(target_os = "linux", target_arch = "x86_64"))]
#[cfg(target_os = "linux")]
pub mod ptrace;
Loading