diff options
author | Lepton Wu <lepton@chromium.org> | 2019-03-14 11:38:31 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-03-14 20:53:52 -0700 |
commit | 9105e9fbe54afcbda54676e6de7410c4a2d0a07d (patch) | |
tree | 90384038edf3750d49e7ffce76ad40f39257bbf8 /src | |
parent | 4725a399f794709c97bb62f4e1cd8a5b6bfafd5c (diff) | |
download | crosvm-9105e9fbe54afcbda54676e6de7410c4a2d0a07d.tar crosvm-9105e9fbe54afcbda54676e6de7410c4a2d0a07d.tar.gz crosvm-9105e9fbe54afcbda54676e6de7410c4a2d0a07d.tar.bz2 crosvm-9105e9fbe54afcbda54676e6de7410c4a2d0a07d.tar.lz crosvm-9105e9fbe54afcbda54676e6de7410c4a2d0a07d.tar.xz crosvm-9105e9fbe54afcbda54676e6de7410c4a2d0a07d.tar.zst crosvm-9105e9fbe54afcbda54676e6de7410c4a2d0a07d.zip |
Remove "multiprocess" argument.
Both "multiprocess" and "disable-sandbox" control the same config and actually they have same final effects. So just remove "multiprocess" argument and also rename "multiprocess" to "sandbox" to make it more clear. BUG=None TEST=`cros_run_unit_tests --board=eve --packages=crosvm` Change-Id: I313d110af48b43231b1426332b63868cb0218490 Reviewed-on: https://chromium-review.googlesource.com/1524375 Commit-Ready: Lepton Wu <lepton@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/linux.rs | 8 | ||||
-rw-r--r-- | src/main.rs | 10 | ||||
-rw-r--r-- | src/plugin/mod.rs | 2 |
3 files changed, 8 insertions, 12 deletions
diff --git a/src/linux.rs b/src/linux.rs index 995e2c9..ee659cb 100644 --- a/src/linux.rs +++ b/src/linux.rs @@ -237,7 +237,7 @@ fn create_base_minijail(root: &Path, seccomp_policy: &Path) -> Result<Minijail> } fn simple_jail(cfg: &Config, policy: &str) -> Result<Option<Minijail>> { - if cfg.multiprocess { + if cfg.sandbox { let pivot_root: &str = option_env!("DEFAULT_PIVOT_ROOT").unwrap_or("/var/empty"); // A directory for a jailed device's pivot root. let root_path = Path::new(pivot_root); @@ -496,7 +496,7 @@ fn create_gpu_device( let dev = virtio::Gpu::new( exit_evt.try_clone().map_err(Error::CloneEventFd)?, Some(gpu_socket), - if cfg.multiprocess { + if cfg.sandbox { &jailed_wayland_path } else { wayland_socket_path @@ -558,7 +558,7 @@ fn create_wayland_device( let jailed_wayland_path = jailed_wayland_dir.join(wayland_socket_name); let dev = virtio::Wl::new( - if cfg.multiprocess { + if cfg.sandbox { &jailed_wayland_path } else { socket_path @@ -1044,7 +1044,7 @@ fn file_to_u64<P: AsRef<Path>>(path: P) -> io::Result<u64> { } pub fn run_config(cfg: Config) -> Result<()> { - if cfg.multiprocess { + if cfg.sandbox { // Printing something to the syslog before entering minijail so that libc's syslogger has a // chance to open files necessary for its operation, like `/etc/localtime`. After jailing, // access to those files will not be possible. diff --git a/src/main.rs b/src/main.rs index 1971e1a..a0cc1c2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -120,7 +120,7 @@ pub struct Config { wayland_socket_path: Option<PathBuf>, wayland_dmabuf: bool, shared_dirs: Vec<(PathBuf, String)>, - multiprocess: bool, + sandbox: bool, seccomp_policy_dir: PathBuf, gpu: bool, software_tpm: bool, @@ -160,7 +160,7 @@ impl Default for Config { wayland_socket_path: None, wayland_dmabuf: false, shared_dirs: Vec::new(), - multiprocess: !cfg!(feature = "default-no-sandbox"), + sandbox: !cfg!(feature = "default-no-sandbox"), seccomp_policy_dir: PathBuf::from(SECCOMP_POLICY_DIR), cras_audio: false, null_audio: false, @@ -395,11 +395,8 @@ fn set_argument(cfg: &mut Config, name: &str, value: Option<&str>) -> argument:: } cfg.socket_path = Some(socket_path); } - "multiprocess" => { - cfg.multiprocess = true; - } "disable-sandbox" => { - cfg.multiprocess = false; + cfg.sandbox = false; } "cid" => { if cfg.cid.is_some() { @@ -684,7 +681,6 @@ fn run_vm(args: std::env::Args) -> std::result::Result<(), ()> { "socket", "PATH", "Path to put the control socket. If PATH is a directory, a name will be generated."), - Argument::short_flag('u', "multiprocess", "Run each device in a child process(default)."), Argument::flag("disable-sandbox", "Run all devices in one, non-sandboxed process."), Argument::value("cid", "CID", "Context ID for virtual sockets."), Argument::value("shared-dir", "PATH:TAG", diff --git a/src/plugin/mod.rs b/src/plugin/mod.rs index b79176e..4ec7a41 100644 --- a/src/plugin/mod.rs +++ b/src/plugin/mod.rs @@ -461,7 +461,7 @@ pub fn run_config(cfg: Config) -> Result<()> { // quickly. let sigchld_fd = SignalFd::new(SIGCHLD).map_err(Error::CreateSignalFd)?; - let jail = if cfg.multiprocess { + let jail = if cfg.sandbox { // An empty directory for jailed plugin pivot root. let root_path = match cfg.plugin_root { Some(ref dir) => Path::new(dir), |