Andrew Walbran | d6dce6f | 2021-03-05 16:39:08 +0000 | [diff] [blame] | 1 | // Copyright 2021, The Android Open Source Project |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | //! Functions for running instances of `crosvm`. |
| 16 | |
Andrew Walbran | dae0716 | 2021-03-12 17:05:20 +0000 | [diff] [blame] | 17 | use crate::aidl::VirtualMachineCallbacks; |
Andrew Walbran | d6dce6f | 2021-03-05 16:39:08 +0000 | [diff] [blame] | 18 | use crate::Cid; |
Andrew Walbran | f5fbb7d | 2021-05-12 17:15:48 +0000 | [diff] [blame] | 19 | use anyhow::{bail, Error}; |
Andrew Walbran | 02b8ec0 | 2021-06-22 13:07:02 +0000 | [diff] [blame] | 20 | use command_fds::CommandFdExt; |
Andrew Walbran | 3a5a921 | 2021-05-04 17:09:08 +0000 | [diff] [blame] | 21 | use log::{debug, error, info}; |
Andrew Walbran | dae0716 | 2021-03-12 17:05:20 +0000 | [diff] [blame] | 22 | use shared_child::SharedChild; |
Andrew Walbran | f5fbb7d | 2021-05-12 17:15:48 +0000 | [diff] [blame] | 23 | use std::fs::{remove_dir_all, File}; |
Andrew Walbran | b15cd6e | 2021-07-05 16:38:07 +0000 | [diff] [blame] | 24 | use std::num::NonZeroU32; |
Andrew Walbran | 02b8ec0 | 2021-06-22 13:07:02 +0000 | [diff] [blame] | 25 | use std::os::unix::io::{AsRawFd, RawFd}; |
Andrew Walbran | f5fbb7d | 2021-05-12 17:15:48 +0000 | [diff] [blame] | 26 | use std::path::PathBuf; |
Andrew Walbran | dae0716 | 2021-03-12 17:05:20 +0000 | [diff] [blame] | 27 | use std::process::Command; |
| 28 | use std::sync::atomic::{AtomicBool, Ordering}; |
Inseob Kim | 7f61fe7 | 2021-08-20 20:50:47 +0900 | [diff] [blame] | 29 | use std::sync::{Arc, Mutex}; |
Andrew Walbran | dae0716 | 2021-03-12 17:05:20 +0000 | [diff] [blame] | 30 | use std::thread; |
Inseob Kim | 7f61fe7 | 2021-08-20 20:50:47 +0900 | [diff] [blame] | 31 | use vsock::VsockStream; |
Andrew Walbran | d6dce6f | 2021-03-05 16:39:08 +0000 | [diff] [blame] | 32 | |
| 33 | const CROSVM_PATH: &str = "/apex/com.android.virt/bin/crosvm"; |
| 34 | |
Andrew Walbran | f5fbb7d | 2021-05-12 17:15:48 +0000 | [diff] [blame] | 35 | /// Configuration for a VM to run with crosvm. |
| 36 | #[derive(Debug)] |
Andrew Walbran | d3a8418 | 2021-09-07 14:48:52 +0000 | [diff] [blame] | 37 | pub struct CrosvmConfig { |
Andrew Walbran | f5fbb7d | 2021-05-12 17:15:48 +0000 | [diff] [blame] | 38 | pub cid: Cid, |
Andrew Walbran | d3a8418 | 2021-09-07 14:48:52 +0000 | [diff] [blame] | 39 | pub bootloader: Option<File>, |
| 40 | pub kernel: Option<File>, |
| 41 | pub initrd: Option<File>, |
Andrew Walbran | f5fbb7d | 2021-05-12 17:15:48 +0000 | [diff] [blame] | 42 | pub disks: Vec<DiskFile>, |
| 43 | pub params: Option<String>, |
Andrew Walbran | f865042 | 2021-06-09 15:54:09 +0000 | [diff] [blame] | 44 | pub protected: bool, |
Andrew Walbran | b15cd6e | 2021-07-05 16:38:07 +0000 | [diff] [blame] | 45 | pub memory_mib: Option<NonZeroU32>, |
Andrew Walbran | d3a8418 | 2021-09-07 14:48:52 +0000 | [diff] [blame] | 46 | pub log_fd: Option<File>, |
| 47 | pub indirect_files: Vec<File>, |
Andrew Walbran | f5fbb7d | 2021-05-12 17:15:48 +0000 | [diff] [blame] | 48 | } |
| 49 | |
| 50 | /// A disk image to pass to crosvm for a VM. |
| 51 | #[derive(Debug)] |
| 52 | pub struct DiskFile { |
| 53 | pub image: File, |
| 54 | pub writable: bool, |
| 55 | } |
| 56 | |
Andrew Walbran | 6b65066 | 2021-09-07 13:13:23 +0000 | [diff] [blame] | 57 | /// The lifecycle state which the payload in the VM has reported itself to be in. |
| 58 | /// |
| 59 | /// Note that the order of enum variants is significant; only forward transitions are allowed by |
| 60 | /// [`VmInstance::update_payload_state`]. |
| 61 | #[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)] |
| 62 | pub enum PayloadState { |
| 63 | Starting, |
| 64 | Started, |
| 65 | Ready, |
| 66 | Finished, |
| 67 | } |
| 68 | |
Andrew Walbran | d6dce6f | 2021-03-05 16:39:08 +0000 | [diff] [blame] | 69 | /// Information about a particular instance of a VM which is running. |
| 70 | #[derive(Debug)] |
| 71 | pub struct VmInstance { |
| 72 | /// The crosvm child process. |
Andrew Walbran | dae0716 | 2021-03-12 17:05:20 +0000 | [diff] [blame] | 73 | child: SharedChild, |
Andrew Walbran | d6dce6f | 2021-03-05 16:39:08 +0000 | [diff] [blame] | 74 | /// The CID assigned to the VM for vsock communication. |
| 75 | pub cid: Cid, |
Andrew Walbran | f865042 | 2021-06-09 15:54:09 +0000 | [diff] [blame] | 76 | /// Whether the VM is a protected VM. |
| 77 | pub protected: bool, |
Andrew Walbran | f5fbb7d | 2021-05-12 17:15:48 +0000 | [diff] [blame] | 78 | /// Directory of temporary files used by the VM while it is running. |
| 79 | pub temporary_directory: PathBuf, |
Andrew Walbran | f6a1eb9 | 2021-04-01 11:16:02 +0000 | [diff] [blame] | 80 | /// The UID of the process which requested the VM. |
| 81 | pub requester_uid: u32, |
| 82 | /// The SID of the process which requested the VM. |
Andrew Walbran | 0203449 | 2021-04-13 15:05:07 +0000 | [diff] [blame] | 83 | pub requester_sid: String, |
Andrew Walbran | f6a1eb9 | 2021-04-01 11:16:02 +0000 | [diff] [blame] | 84 | /// The PID of the process which requested the VM. Note that this process may no longer exist |
| 85 | /// and the PID may have been reused for a different process, so this should not be trusted. |
Andrew Walbran | 0203449 | 2021-04-13 15:05:07 +0000 | [diff] [blame] | 86 | pub requester_debug_pid: i32, |
Andrew Walbran | dae0716 | 2021-03-12 17:05:20 +0000 | [diff] [blame] | 87 | /// Whether the VM is still running. |
| 88 | running: AtomicBool, |
| 89 | /// Callbacks to clients of the VM. |
| 90 | pub callbacks: VirtualMachineCallbacks, |
Inseob Kim | 7f61fe7 | 2021-08-20 20:50:47 +0900 | [diff] [blame] | 91 | /// Input/output stream of the payload run in the VM. |
| 92 | pub stream: Mutex<Option<VsockStream>>, |
Andrew Walbran | 6b65066 | 2021-09-07 13:13:23 +0000 | [diff] [blame] | 93 | /// The latest lifecycle state which the payload reported itself to be in. |
| 94 | payload_state: Mutex<PayloadState>, |
Andrew Walbran | d6dce6f | 2021-03-05 16:39:08 +0000 | [diff] [blame] | 95 | } |
| 96 | |
| 97 | impl VmInstance { |
| 98 | /// Create a new `VmInstance` for the given process. |
Andrew Walbran | f6a1eb9 | 2021-04-01 11:16:02 +0000 | [diff] [blame] | 99 | fn new( |
Andrew Walbran | dae0716 | 2021-03-12 17:05:20 +0000 | [diff] [blame] | 100 | child: SharedChild, |
Andrew Walbran | f6a1eb9 | 2021-04-01 11:16:02 +0000 | [diff] [blame] | 101 | cid: Cid, |
Andrew Walbran | f865042 | 2021-06-09 15:54:09 +0000 | [diff] [blame] | 102 | protected: bool, |
Andrew Walbran | f5fbb7d | 2021-05-12 17:15:48 +0000 | [diff] [blame] | 103 | temporary_directory: PathBuf, |
Andrew Walbran | f6a1eb9 | 2021-04-01 11:16:02 +0000 | [diff] [blame] | 104 | requester_uid: u32, |
Andrew Walbran | 0203449 | 2021-04-13 15:05:07 +0000 | [diff] [blame] | 105 | requester_sid: String, |
| 106 | requester_debug_pid: i32, |
Andrew Walbran | f6a1eb9 | 2021-04-01 11:16:02 +0000 | [diff] [blame] | 107 | ) -> VmInstance { |
Andrew Walbran | dae0716 | 2021-03-12 17:05:20 +0000 | [diff] [blame] | 108 | VmInstance { |
| 109 | child, |
| 110 | cid, |
Andrew Walbran | f865042 | 2021-06-09 15:54:09 +0000 | [diff] [blame] | 111 | protected, |
Andrew Walbran | f5fbb7d | 2021-05-12 17:15:48 +0000 | [diff] [blame] | 112 | temporary_directory, |
Andrew Walbran | dae0716 | 2021-03-12 17:05:20 +0000 | [diff] [blame] | 113 | requester_uid, |
| 114 | requester_sid, |
Andrew Walbran | 0203449 | 2021-04-13 15:05:07 +0000 | [diff] [blame] | 115 | requester_debug_pid, |
Andrew Walbran | dae0716 | 2021-03-12 17:05:20 +0000 | [diff] [blame] | 116 | running: AtomicBool::new(true), |
| 117 | callbacks: Default::default(), |
Inseob Kim | 7f61fe7 | 2021-08-20 20:50:47 +0900 | [diff] [blame] | 118 | stream: Mutex::new(None), |
Andrew Walbran | 6b65066 | 2021-09-07 13:13:23 +0000 | [diff] [blame] | 119 | payload_state: Mutex::new(PayloadState::Starting), |
Andrew Walbran | dae0716 | 2021-03-12 17:05:20 +0000 | [diff] [blame] | 120 | } |
Andrew Walbran | d6dce6f | 2021-03-05 16:39:08 +0000 | [diff] [blame] | 121 | } |
| 122 | |
| 123 | /// Start an instance of `crosvm` to manage a new VM. The `crosvm` instance will be killed when |
| 124 | /// the `VmInstance` is dropped. |
Andrew Walbran | f6a1eb9 | 2021-04-01 11:16:02 +0000 | [diff] [blame] | 125 | pub fn start( |
Andrew Walbran | d3a8418 | 2021-09-07 14:48:52 +0000 | [diff] [blame] | 126 | config: CrosvmConfig, |
Andrew Walbran | f5fbb7d | 2021-05-12 17:15:48 +0000 | [diff] [blame] | 127 | temporary_directory: PathBuf, |
Andrew Walbran | f6a1eb9 | 2021-04-01 11:16:02 +0000 | [diff] [blame] | 128 | requester_uid: u32, |
Andrew Walbran | 0203449 | 2021-04-13 15:05:07 +0000 | [diff] [blame] | 129 | requester_sid: String, |
| 130 | requester_debug_pid: i32, |
Andrew Walbran | dae0716 | 2021-03-12 17:05:20 +0000 | [diff] [blame] | 131 | ) -> Result<Arc<VmInstance>, Error> { |
Andrew Walbran | d3a8418 | 2021-09-07 14:48:52 +0000 | [diff] [blame] | 132 | let cid = config.cid; |
| 133 | let protected = config.protected; |
| 134 | let child = run_vm(config)?; |
Andrew Walbran | 0203449 | 2021-04-13 15:05:07 +0000 | [diff] [blame] | 135 | let instance = Arc::new(VmInstance::new( |
| 136 | child, |
Andrew Walbran | d3a8418 | 2021-09-07 14:48:52 +0000 | [diff] [blame] | 137 | cid, |
| 138 | protected, |
Andrew Walbran | f5fbb7d | 2021-05-12 17:15:48 +0000 | [diff] [blame] | 139 | temporary_directory, |
Andrew Walbran | 0203449 | 2021-04-13 15:05:07 +0000 | [diff] [blame] | 140 | requester_uid, |
| 141 | requester_sid, |
| 142 | requester_debug_pid, |
| 143 | )); |
Andrew Walbran | d6dce6f | 2021-03-05 16:39:08 +0000 | [diff] [blame] | 144 | |
Andrew Walbran | dae0716 | 2021-03-12 17:05:20 +0000 | [diff] [blame] | 145 | let instance_clone = instance.clone(); |
| 146 | thread::spawn(move || { |
| 147 | instance_clone.monitor(); |
| 148 | }); |
| 149 | |
| 150 | Ok(instance) |
| 151 | } |
| 152 | |
| 153 | /// Wait for the crosvm child process to finish, then mark the VM as no longer running and call |
| 154 | /// any callbacks. |
| 155 | fn monitor(&self) { |
| 156 | match self.child.wait() { |
| 157 | Err(e) => error!("Error waiting for crosvm instance to die: {}", e), |
| 158 | Ok(status) => info!("crosvm exited with status {}", status), |
| 159 | } |
| 160 | self.running.store(false, Ordering::Release); |
| 161 | self.callbacks.callback_on_died(self.cid); |
Andrew Walbran | f5fbb7d | 2021-05-12 17:15:48 +0000 | [diff] [blame] | 162 | |
| 163 | // Delete temporary files. |
| 164 | if let Err(e) = remove_dir_all(&self.temporary_directory) { |
Andrew Walbran | 806f154 | 2021-06-10 14:07:12 +0000 | [diff] [blame] | 165 | error!("Error removing temporary directory {:?}: {}", self.temporary_directory, e); |
Andrew Walbran | f5fbb7d | 2021-05-12 17:15:48 +0000 | [diff] [blame] | 166 | } |
Andrew Walbran | dae0716 | 2021-03-12 17:05:20 +0000 | [diff] [blame] | 167 | } |
| 168 | |
| 169 | /// Return whether `crosvm` is still running the VM. |
| 170 | pub fn running(&self) -> bool { |
| 171 | self.running.load(Ordering::Acquire) |
| 172 | } |
| 173 | |
Andrew Walbran | 6b65066 | 2021-09-07 13:13:23 +0000 | [diff] [blame] | 174 | /// Returns the last reported state of the VM payload. |
| 175 | pub fn payload_state(&self) -> PayloadState { |
| 176 | *self.payload_state.lock().unwrap() |
| 177 | } |
| 178 | |
| 179 | /// Updates the payload state to the given value, if it is a valid state transition. |
| 180 | pub fn update_payload_state(&self, new_state: PayloadState) -> Result<(), Error> { |
| 181 | let mut state_locked = self.payload_state.lock().unwrap(); |
| 182 | // Only allow forward transitions, e.g. from starting to started or finished, not back in |
| 183 | // the other direction. |
| 184 | if new_state > *state_locked { |
| 185 | *state_locked = new_state; |
| 186 | Ok(()) |
| 187 | } else { |
| 188 | bail!("Invalid payload state transition from {:?} to {:?}", *state_locked, new_state) |
| 189 | } |
| 190 | } |
| 191 | |
Andrew Walbran | dae0716 | 2021-03-12 17:05:20 +0000 | [diff] [blame] | 192 | /// Kill the crosvm instance. |
| 193 | pub fn kill(&self) { |
Andrew Walbran | d6dce6f | 2021-03-05 16:39:08 +0000 | [diff] [blame] | 194 | // TODO: Talk to crosvm to shutdown cleanly. |
| 195 | if let Err(e) = self.child.kill() { |
| 196 | error!("Error killing crosvm instance: {}", e); |
| 197 | } |
Andrew Walbran | d6dce6f | 2021-03-05 16:39:08 +0000 | [diff] [blame] | 198 | } |
| 199 | } |
| 200 | |
Andrew Walbran | d3a8418 | 2021-09-07 14:48:52 +0000 | [diff] [blame] | 201 | /// Starts an instance of `crosvm` to manage a new VM. |
| 202 | fn run_vm(config: CrosvmConfig) -> Result<SharedChild, Error> { |
| 203 | validate_config(&config)?; |
Andrew Walbran | d6dce6f | 2021-03-05 16:39:08 +0000 | [diff] [blame] | 204 | |
| 205 | let mut command = Command::new(CROSVM_PATH); |
| 206 | // TODO(qwandor): Remove --disable-sandbox. |
Andrew Walbran | f5fbb7d | 2021-05-12 17:15:48 +0000 | [diff] [blame] | 207 | command.arg("run").arg("--disable-sandbox").arg("--cid").arg(config.cid.to_string()); |
Andrew Walbran | 3a5a921 | 2021-05-04 17:09:08 +0000 | [diff] [blame] | 208 | |
Andrew Walbran | f865042 | 2021-06-09 15:54:09 +0000 | [diff] [blame] | 209 | if config.protected { |
| 210 | command.arg("--protected-vm"); |
| 211 | } |
| 212 | |
Andrew Walbran | b15cd6e | 2021-07-05 16:38:07 +0000 | [diff] [blame] | 213 | if let Some(memory_mib) = config.memory_mib { |
| 214 | command.arg("--mem").arg(memory_mib.to_string()); |
| 215 | } |
| 216 | |
Andrew Walbran | d3a8418 | 2021-09-07 14:48:52 +0000 | [diff] [blame] | 217 | if let Some(log_fd) = config.log_fd { |
Andrew Walbran | a89fc13 | 2021-03-17 17:08:36 +0000 | [diff] [blame] | 218 | command.stdout(log_fd); |
| 219 | } else { |
| 220 | // Ignore console output. |
| 221 | command.arg("--serial=type=sink"); |
| 222 | } |
Andrew Walbran | 3a5a921 | 2021-05-04 17:09:08 +0000 | [diff] [blame] | 223 | |
| 224 | // Keep track of what file descriptors should be mapped to the crosvm process. |
Andrew Walbran | d3a8418 | 2021-09-07 14:48:52 +0000 | [diff] [blame] | 225 | let mut preserved_fds = config.indirect_files.iter().map(|file| file.as_raw_fd()).collect(); |
Andrew Walbran | 3a5a921 | 2021-05-04 17:09:08 +0000 | [diff] [blame] | 226 | |
Andrew Walbran | d6dce6f | 2021-03-05 16:39:08 +0000 | [diff] [blame] | 227 | if let Some(bootloader) = &config.bootloader { |
Andrew Walbran | 02b8ec0 | 2021-06-22 13:07:02 +0000 | [diff] [blame] | 228 | command.arg("--bios").arg(add_preserved_fd(&mut preserved_fds, bootloader)); |
Andrew Walbran | d6dce6f | 2021-03-05 16:39:08 +0000 | [diff] [blame] | 229 | } |
Andrew Walbran | 3a5a921 | 2021-05-04 17:09:08 +0000 | [diff] [blame] | 230 | |
Andrew Walbran | d6dce6f | 2021-03-05 16:39:08 +0000 | [diff] [blame] | 231 | if let Some(initrd) = &config.initrd { |
Andrew Walbran | 02b8ec0 | 2021-06-22 13:07:02 +0000 | [diff] [blame] | 232 | command.arg("--initrd").arg(add_preserved_fd(&mut preserved_fds, initrd)); |
Andrew Walbran | d6dce6f | 2021-03-05 16:39:08 +0000 | [diff] [blame] | 233 | } |
Andrew Walbran | 3a5a921 | 2021-05-04 17:09:08 +0000 | [diff] [blame] | 234 | |
Andrew Walbran | d6dce6f | 2021-03-05 16:39:08 +0000 | [diff] [blame] | 235 | if let Some(params) = &config.params { |
| 236 | command.arg("--params").arg(params); |
| 237 | } |
Andrew Walbran | 3a5a921 | 2021-05-04 17:09:08 +0000 | [diff] [blame] | 238 | |
Andrew Walbran | d6dce6f | 2021-03-05 16:39:08 +0000 | [diff] [blame] | 239 | for disk in &config.disks { |
Andrew Walbran | f5fbb7d | 2021-05-12 17:15:48 +0000 | [diff] [blame] | 240 | command |
| 241 | .arg(if disk.writable { "--rwdisk" } else { "--disk" }) |
Andrew Walbran | 02b8ec0 | 2021-06-22 13:07:02 +0000 | [diff] [blame] | 242 | .arg(add_preserved_fd(&mut preserved_fds, &disk.image)); |
Andrew Walbran | d6dce6f | 2021-03-05 16:39:08 +0000 | [diff] [blame] | 243 | } |
Andrew Walbran | 3a5a921 | 2021-05-04 17:09:08 +0000 | [diff] [blame] | 244 | |
Andrew Walbran | d6dce6f | 2021-03-05 16:39:08 +0000 | [diff] [blame] | 245 | if let Some(kernel) = &config.kernel { |
Andrew Walbran | 02b8ec0 | 2021-06-22 13:07:02 +0000 | [diff] [blame] | 246 | command.arg(add_preserved_fd(&mut preserved_fds, kernel)); |
Andrew Walbran | d6dce6f | 2021-03-05 16:39:08 +0000 | [diff] [blame] | 247 | } |
Andrew Walbran | 3a5a921 | 2021-05-04 17:09:08 +0000 | [diff] [blame] | 248 | |
Andrew Walbran | 02b8ec0 | 2021-06-22 13:07:02 +0000 | [diff] [blame] | 249 | debug!("Preserving FDs {:?}", preserved_fds); |
| 250 | command.preserved_fds(preserved_fds); |
Andrew Walbran | 3a5a921 | 2021-05-04 17:09:08 +0000 | [diff] [blame] | 251 | |
Andrew Walbran | d6dce6f | 2021-03-05 16:39:08 +0000 | [diff] [blame] | 252 | info!("Running {:?}", command); |
Andrew Walbran | 3a5a921 | 2021-05-04 17:09:08 +0000 | [diff] [blame] | 253 | let result = SharedChild::spawn(&mut command)?; |
| 254 | Ok(result) |
| 255 | } |
| 256 | |
| 257 | /// Ensure that the configuration has a valid combination of fields set, or return an error if not. |
Andrew Walbran | f5fbb7d | 2021-05-12 17:15:48 +0000 | [diff] [blame] | 258 | fn validate_config(config: &CrosvmConfig) -> Result<(), Error> { |
Andrew Walbran | 3a5a921 | 2021-05-04 17:09:08 +0000 | [diff] [blame] | 259 | if config.bootloader.is_none() && config.kernel.is_none() { |
| 260 | bail!("VM must have either a bootloader or a kernel image."); |
| 261 | } |
| 262 | if config.bootloader.is_some() && (config.kernel.is_some() || config.initrd.is_some()) { |
| 263 | bail!("Can't have both bootloader and kernel/initrd image."); |
| 264 | } |
| 265 | Ok(()) |
| 266 | } |
| 267 | |
Andrew Walbran | 02b8ec0 | 2021-06-22 13:07:02 +0000 | [diff] [blame] | 268 | /// Adds the file descriptor for `file` to `preserved_fds`, and returns a string of the form |
| 269 | /// "/proc/self/fd/N" where N is the file descriptor. |
| 270 | fn add_preserved_fd(preserved_fds: &mut Vec<RawFd>, file: &File) -> String { |
Andrew Walbran | 3a5a921 | 2021-05-04 17:09:08 +0000 | [diff] [blame] | 271 | let fd = file.as_raw_fd(); |
Andrew Walbran | 02b8ec0 | 2021-06-22 13:07:02 +0000 | [diff] [blame] | 272 | preserved_fds.push(fd); |
Andrew Walbran | 3a5a921 | 2021-05-04 17:09:08 +0000 | [diff] [blame] | 273 | format!("/proc/self/fd/{}", fd) |
Andrew Walbran | d6dce6f | 2021-03-05 16:39:08 +0000 | [diff] [blame] | 274 | } |