Merge "Remove getCid()"
diff --git a/authfs/fd_server/src/main.rs b/authfs/fd_server/src/main.rs
index 21d0e64..9d97423 100644
--- a/authfs/fd_server/src/main.rs
+++ b/authfs/fd_server/src/main.rs
@@ -37,7 +37,8 @@
use aidl::{FdConfig, FdService};
use authfs_fsverity_metadata::parse_fsverity_metadata;
-const RPC_SERVICE_PORT: u32 = 3264; // TODO: support dynamic port for multiple fd_server instances
+// TODO(b/259920193): support dynamic port for multiple fd_server instances
+const RPC_SERVICE_PORT: u32 = 3264;
fn is_fd_valid(fd: i32) -> bool {
// SAFETY: a query-only syscall
@@ -137,7 +138,8 @@
debug!("fd_server is starting as a rpc service.");
let service = FdService::new_binder(fd_pool).as_binder();
- let server = RpcServer::new_vsock(service, RPC_SERVICE_PORT)?;
+ // TODO(b/259920193): Only accept connections from the intended guest VM.
+ let server = RpcServer::new_vsock(service, libc::VMADDR_CID_ANY, RPC_SERVICE_PORT)?;
debug!("fd_server is ready");
// Close the ready-fd if we were given one to signal our readiness.
diff --git a/compos/common/lib.rs b/compos/common/lib.rs
index c9555d5..8d49ff0 100644
--- a/compos/common/lib.rs
+++ b/compos/common/lib.rs
@@ -21,9 +21,6 @@
pub mod odrefresh;
pub mod timeouts;
-/// Special CID indicating "any".
-pub const VMADDR_CID_ANY: u32 = -1i32 as u32;
-
/// VSock port that the CompOS server listens on for RPC binder connections. This should be out of
/// future port range (if happens) that microdroid may reserve for system components.
pub const COMPOS_VSOCK_PORT: u32 = 6432;
diff --git a/virtualizationservice/src/aidl.rs b/virtualizationservice/src/aidl.rs
index 3e4323d..072afec 100644
--- a/virtualizationservice/src/aidl.rs
+++ b/virtualizationservice/src/aidl.rs
@@ -463,9 +463,8 @@
let service = VirtualMachineService::new_binder(self.state.clone(), cid).as_binder();
// Start VM service listening for connections from the new CID on port=CID.
- // TODO(b/245727626): Only accept connections from the new VM.
let port = cid;
- match RpcServer::new_vsock(service, port) {
+ match RpcServer::new_vsock(service, cid, port) {
Ok(vm_server) => {
vm_server.start();
return Ok((VmContext::new(global_context, vm_server), cid));
diff --git a/vm_payload/src/api.rs b/vm_payload/src/api.rs
index 28b440e..66c8ef7 100644
--- a/vm_payload/src/api.rs
+++ b/vm_payload/src/api.rs
@@ -136,7 +136,7 @@
// safely be taken by new_spibinder.
let service = unsafe { new_spibinder(service) };
if let Some(service) = service {
- match RpcServer::new_vsock(service, port) {
+ match RpcServer::new_vsock(service, libc::VMADDR_CID_HOST, port) {
Ok(server) => {
if let Some(on_ready) = on_ready {
// SAFETY: We're calling the callback with the parameter specified within the