Expose the bwrap command line at /run/agent-sandbox inside every sandbox
This commit is contained in:
@@ -373,6 +373,7 @@ fn blacklist_overlays_survive_absolute_var_run_symlink() {
|
||||
// layout inside the sandbox to reproduce on any host.
|
||||
let _guard = HostGlobsLock::for_scan();
|
||||
let mut bwrap_args = build_bwrap_command(&["--blacklist", "--no-seccomp", "--", "true"]);
|
||||
strip_command_line_bind(&mut bwrap_args);
|
||||
inject_absolute_var_run_symlink(&mut bwrap_args);
|
||||
|
||||
let output = Command::new(&bwrap_args[0])
|
||||
@@ -568,6 +569,15 @@ fn rand_suffix() -> String {
|
||||
format!("{nanos:08x}")
|
||||
}
|
||||
|
||||
// The bind reads from an fd that only exists in the agent-sandbox process.
|
||||
fn strip_command_line_bind(bwrap_args: &mut Vec<String>) {
|
||||
let start = bwrap_args
|
||||
.iter()
|
||||
.position(|a| a == "--ro-bind-data")
|
||||
.expect("dry-run output should bind the bwrap command line");
|
||||
bwrap_args.drain(start..start + 3);
|
||||
}
|
||||
|
||||
fn inject_absolute_var_run_symlink(bwrap_args: &mut Vec<String>) {
|
||||
assert_eq!(bwrap_args[1], "--ro-bind");
|
||||
assert_eq!(bwrap_args[2], "/");
|
||||
|
||||
Reference in New Issue
Block a user