Include requester UID and SID in VM debug info.
Bug: 184131756
Test: Ran a vm manually with `vm` tool.
Change-Id: Ia0267231592dc964be0a3459bd9d6aa9dff001ca
diff --git a/virtmanager/src/crosvm.rs b/virtmanager/src/crosvm.rs
index c865357..bef9982 100644
--- a/virtmanager/src/crosvm.rs
+++ b/virtmanager/src/crosvm.rs
@@ -30,19 +30,39 @@
child: Child,
/// The CID assigned to the VM for vsock communication.
pub cid: Cid,
+ /// The UID of the process which requested the VM.
+ pub requester_uid: u32,
+ /// The SID of the process which requested the VM.
+ pub requester_sid: Option<String>,
+ /// The PID of the process which requested the VM. Note that this process may no longer exist
+ /// and the PID may have been reused for a different process, so this should not be trusted.
+ pub requester_pid: i32,
}
impl VmInstance {
/// Create a new `VmInstance` for the given process.
- fn new(child: Child, cid: Cid) -> VmInstance {
- VmInstance { child, cid }
+ fn new(
+ child: Child,
+ cid: Cid,
+ requester_uid: u32,
+ requester_sid: Option<String>,
+ requester_pid: i32,
+ ) -> VmInstance {
+ VmInstance { child, cid, requester_uid, requester_sid, requester_pid }
}
/// Start an instance of `crosvm` to manage a new VM. The `crosvm` instance will be killed when
/// the `VmInstance` is dropped.
- pub fn start(config: &VmConfig, cid: Cid, log_fd: Option<File>) -> Result<VmInstance, Error> {
+ pub fn start(
+ config: &VmConfig,
+ cid: Cid,
+ log_fd: Option<File>,
+ requester_uid: u32,
+ requester_sid: Option<String>,
+ requester_pid: i32,
+ ) -> Result<VmInstance, Error> {
let child = run_vm(config, cid, log_fd)?;
- Ok(VmInstance::new(child, cid))
+ Ok(VmInstance::new(child, cid, requester_uid, requester_sid, requester_pid))
}
}