From nobody Thu Oct 9 02:17:45 2025 Received: from mailtransmit04.runbox.com (mailtransmit04.runbox.com [185.226.149.37]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ECE2E2264BB; Fri, 20 Jun 2025 19:53:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.226.149.37 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750449188; cv=none; b=fJKNvK8mGbYrOoXAMQGnTVy1AOM+fhumPKCyAJvVvpNJbE6jVLFdL98I6chnO0LaflYF+7Y7n2myPBf+fOv60f5rXLycVJSaPjNQQftqnc9/7sSsBBbFKkWg2BvMZEB0Sfl2abYoSs5G3LXcArSItMT8NwxHV8bME6w6Ihhg+zs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750449188; c=relaxed/simple; bh=s7vFseYvObhMUR9kiliY1dbgNdscojmG8Kzgtmg7lpg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WC3jz3FrQbbICTE5ofcMYWKNDQ4NPn86g3SgIEXy7vva5fCFvnD7g3bWhsQjT0XFvVS4DAWudaU1hidbfwQHMWpldlzh55JYU17FBA74afau1KuIB6KajcevcRLxFG9SgPWnH1rOWif4yyab3h1ZgJaExFl54wRD7N8SF5B5rWM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rbox.co; spf=pass smtp.mailfrom=rbox.co; dkim=pass (2048-bit key) header.d=rbox.co header.i=@rbox.co header.b=prcWwEEF; arc=none smtp.client-ip=185.226.149.37 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rbox.co Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rbox.co Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rbox.co header.i=@rbox.co header.b="prcWwEEF" Received: from mailtransmit02.runbox ([10.9.9.162] helo=aibo.runbox.com) by mailtransmit04.runbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1uShnN-000fBE-5q; Fri, 20 Jun 2025 21:53:05 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=rbox.co; s=selector2; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From; bh=xeaQq61+HXvHVxBxeioIeJobV1RnZZxSPJ0J8d4RGnI=; b=prcWwEEFZROMlp2ZRheYoFs+Nv ZBG9sv3T4wgxBT6e3xRy8b3uz6Iy5XiZBAssSV883z/2mdIUr/VMovVt8eNPVCcHt2QEKyGa9x+Ca 05xOo9bqJ92MjD9SEBC8mqxp9OlTeC/oS1Qo74RMfcaFlyElyyFC9VtPEWqOwDGzLqGPb+V6gq3yI Er0qlrPvee4H+aeXna88A+t6JIdzIIyzbq5ZwQXOpFYVyO/ihSt+TDqC5mQ+qa5APuMcYCsP6HdcY 2qMIPm50ilG9T/+GntEhLdKsKUJVCGrS0Xbjv7XieEzWEYO2ESXr2jYE7T3Y8Sep0i3bSBTbNJfmo su76ThjQ==; Received: from [10.9.9.73] (helo=submission02.runbox) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1uShnM-0008Ih-Qz; Fri, 20 Jun 2025 21:53:05 +0200 Received: by submission02.runbox with esmtpsa [Authenticated ID (604044)] (TLS1.2:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.93) id 1uShnC-00CRMQ-SE; Fri, 20 Jun 2025 21:52:54 +0200 From: Michal Luczaj Date: Fri, 20 Jun 2025 21:52:43 +0200 Subject: [PATCH RFC net v2 1/3] vsock: Fix transport_{g2h,h2g} TOCTOU Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250620-vsock-transports-toctou-v2-1-02ebd20b1d03@rbox.co> References: <20250620-vsock-transports-toctou-v2-0-02ebd20b1d03@rbox.co> In-Reply-To: <20250620-vsock-transports-toctou-v2-0-02ebd20b1d03@rbox.co> To: Stefano Garzarella , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Stefan Hajnoczi Cc: virtualization@lists.linux.dev, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Michal Luczaj X-Mailer: b4 0.14.2 vsock_find_cid() and vsock_dev_do_ioctl() may race with module unload. transport_{g2h,h2g} may become NULL after the NULL check. Introduce vsock_transport_local_cid() to protect from a potential null-ptr-deref. KASAN: null-ptr-deref in range [0x0000000000000118-0x000000000000011f] RIP: 0010:vsock_find_cid+0x47/0x90 Call Trace: __vsock_bind+0x4b2/0x720 vsock_bind+0x90/0xe0 __sys_bind+0x14d/0x1e0 __x64_sys_bind+0x6e/0xc0 do_syscall_64+0x92/0x1c0 entry_SYSCALL_64_after_hwframe+0x4b/0x53 KASAN: null-ptr-deref in range [0x0000000000000118-0x000000000000011f] RIP: 0010:vsock_dev_do_ioctl.isra.0+0x58/0xf0 Call Trace: __x64_sys_ioctl+0x12d/0x190 do_syscall_64+0x92/0x1c0 entry_SYSCALL_64_after_hwframe+0x4b/0x53 Fixes: c0cfa2d8a788 ("vsock: add multi-transports support") Suggested-by: Stefano Garzarella Signed-off-by: Michal Luczaj --- net/vmw_vsock/af_vsock.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c index 2e7a3034e965db30b6ee295370d866e6d8b1c341..63a920af5bfe6960306a3e5eeae= 0cbf30648985e 100644 --- a/net/vmw_vsock/af_vsock.c +++ b/net/vmw_vsock/af_vsock.c @@ -531,9 +531,21 @@ int vsock_assign_transport(struct vsock_sock *vsk, str= uct vsock_sock *psk) } EXPORT_SYMBOL_GPL(vsock_assign_transport); =20 +static u32 vsock_transport_local_cid(const struct vsock_transport **transp= ort) +{ + u32 cid =3D VMADDR_CID_ANY; + + mutex_lock(&vsock_register_mutex); + if (*transport) + cid =3D (*transport)->get_local_cid(); + mutex_unlock(&vsock_register_mutex); + + return cid; +} + bool vsock_find_cid(unsigned int cid) { - if (transport_g2h && cid =3D=3D transport_g2h->get_local_cid()) + if (cid =3D=3D vsock_transport_local_cid(&transport_g2h)) return true; =20 if (transport_h2g && cid =3D=3D VMADDR_CID_HOST) @@ -2536,18 +2548,17 @@ static long vsock_dev_do_ioctl(struct file *filp, unsigned int cmd, void __user *ptr) { u32 __user *p =3D ptr; - u32 cid =3D VMADDR_CID_ANY; int retval =3D 0; + u32 cid; =20 switch (cmd) { case IOCTL_VM_SOCKETS_GET_LOCAL_CID: /* To be compatible with the VMCI behavior, we prioritize the * guest CID instead of well-know host CID (VMADDR_CID_HOST). */ - if (transport_g2h) - cid =3D transport_g2h->get_local_cid(); - else if (transport_h2g) - cid =3D transport_h2g->get_local_cid(); + cid =3D vsock_transport_local_cid(&transport_g2h); + if (cid =3D=3D VMADDR_CID_ANY) + cid =3D vsock_transport_local_cid(&transport_h2g); =20 if (put_user(cid, p) !=3D 0) retval =3D -EFAULT; --=20 2.49.0 From nobody Thu Oct 9 02:17:45 2025 Received: from mailtransmit04.runbox.com (mailtransmit04.runbox.com [185.226.149.37]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6CA2222577C; Fri, 20 Jun 2025 19:53:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.226.149.37 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750449201; cv=none; b=jJyBYjGdPpawRzxwoGdhyEl7GNs4xjw2IFNxZK+19AtqxYbs7O2dek+5D3WCeQWLmmbzjyLWzI4m6qLegEMcaKHLxxW4mH0efcpxPFK93dSBA8xciEskM7KpO+G5MdhZcE5NFQ71ZIaSg2QYbLnsW8RglsT2xwyHPkykZ/E/FII= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750449201; c=relaxed/simple; bh=qXzQaYDyZ22wVOw3OB4twS41M4U5ybMKs8ALKHqH37A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jGiPjTjV0+ufDf7Hdncy2d1iJOrUnfzplRPqUUrx9C1PEh9BjKFxQROlgSAVFq7HdbykgFHEk/Iw8cpeiunAbQi3wbokzDAUOiiS8Q2rceZDjuPuMEgfGQU3kO9H7IoP+o9PMP/M7ZBpKUcKuSK2ATzURl/fQgHq1Q8u9OyewU8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rbox.co; spf=pass smtp.mailfrom=rbox.co; dkim=pass (2048-bit key) header.d=rbox.co header.i=@rbox.co header.b=vAM2/3RR; arc=none smtp.client-ip=185.226.149.37 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rbox.co Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rbox.co Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rbox.co header.i=@rbox.co header.b="vAM2/3RR" Received: from mailtransmit03.runbox ([10.9.9.163] helo=aibo.runbox.com) by mailtransmit04.runbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1uShnZ-000fBs-F7; Fri, 20 Jun 2025 21:53:17 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=rbox.co; s=selector2; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From; bh=lfAYRwZDSdZ+Y8WOrfpvUOazYa4OR/cUBrBuUO7BMjs=; b=vAM2/3RRZazC/b2aX7VWvbZ/df 4QEKIhNKUIQ4CCmnOSX2KWt4KJPDU0YxCf2idnRPKpGoezBi0+6Uhvf3FXrd9Ku3nyDMJBWiLkOAP nQK5MS2MLkpXuhIgGoZeZQTHSGaShh6K7ehSgsApavPlqK2J6Pbba8bhrJdZxbP/ha1d0xIpguEWE xORwdOxdXrr/PRui9kV7mbV7TocmPIC5VLL1k8XRRniUL+rARSufeMe0lM4sdGF3deHmAL8KL8l97 TvGBrmV8nEpPnNIWiVFB5F5uqHXqKDb+P7QiBskRYCca3kS/b37yT87BfzsjxDypXjZpAxt3NUQWr viPsLQqQ==; Received: from [10.9.9.73] (helo=submission02.runbox) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1uShnZ-0003iV-2s; Fri, 20 Jun 2025 21:53:17 +0200 Received: by submission02.runbox with esmtpsa [Authenticated ID (604044)] (TLS1.2:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.93) id 1uShnD-00CRMQ-En; Fri, 20 Jun 2025 21:52:55 +0200 From: Michal Luczaj Date: Fri, 20 Jun 2025 21:52:44 +0200 Subject: [PATCH RFC net v2 2/3] vsock: Fix transport_* TOCTOU Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250620-vsock-transports-toctou-v2-2-02ebd20b1d03@rbox.co> References: <20250620-vsock-transports-toctou-v2-0-02ebd20b1d03@rbox.co> In-Reply-To: <20250620-vsock-transports-toctou-v2-0-02ebd20b1d03@rbox.co> To: Stefano Garzarella , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Stefan Hajnoczi Cc: virtualization@lists.linux.dev, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Michal Luczaj X-Mailer: b4 0.14.2 Transport assignment may race with module unload. Protect new_transport from becoming a stale pointer. This also takes care of an insecure call in vsock_use_local_transport(); add a lockdep assert. BUG: unable to handle page fault for address: fffffbfff8056000 Oops: Oops: 0000 [#1] SMP KASAN RIP: 0010:vsock_assign_transport+0x366/0x600 Call Trace: vsock_connect+0x59c/0xc40 __sys_connect+0xe8/0x100 __x64_sys_connect+0x6e/0xc0 do_syscall_64+0x92/0x1c0 entry_SYSCALL_64_after_hwframe+0x4b/0x53 Fixes: c0cfa2d8a788 ("vsock: add multi-transports support") Signed-off-by: Michal Luczaj Reviewed-by: Stefano Garzarella --- net/vmw_vsock/af_vsock.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c index 63a920af5bfe6960306a3e5eeae0cbf30648985e..a1b1073a2c89f865fcdb58b38d8= e7feffcf1544f 100644 --- a/net/vmw_vsock/af_vsock.c +++ b/net/vmw_vsock/af_vsock.c @@ -407,6 +407,8 @@ EXPORT_SYMBOL_GPL(vsock_enqueue_accept); =20 static bool vsock_use_local_transport(unsigned int remote_cid) { + lockdep_assert_held(&vsock_register_mutex); + if (!transport_local) return false; =20 @@ -464,6 +466,8 @@ int vsock_assign_transport(struct vsock_sock *vsk, stru= ct vsock_sock *psk) =20 remote_flags =3D vsk->remote_addr.svm_flags; =20 + mutex_lock(&vsock_register_mutex); + switch (sk->sk_type) { case SOCK_DGRAM: new_transport =3D transport_dgram; @@ -479,12 +483,15 @@ int vsock_assign_transport(struct vsock_sock *vsk, st= ruct vsock_sock *psk) new_transport =3D transport_h2g; break; default: - return -ESOCKTNOSUPPORT; + ret =3D -ESOCKTNOSUPPORT; + goto err; } =20 if (vsk->transport) { - if (vsk->transport =3D=3D new_transport) - return 0; + if (vsk->transport =3D=3D new_transport) { + ret =3D 0; + goto err; + } =20 /* transport->release() must be called with sock lock acquired. * This path can only be taken during vsock_connect(), where we @@ -508,8 +515,16 @@ int vsock_assign_transport(struct vsock_sock *vsk, str= uct vsock_sock *psk) /* We increase the module refcnt to prevent the transport unloading * while there are open sockets assigned to it. */ - if (!new_transport || !try_module_get(new_transport->module)) - return -ENODEV; + if (!new_transport || !try_module_get(new_transport->module)) { + ret =3D -ENODEV; + goto err; + } + + /* It's safe to release the mutex after a successful try_module_get(). + * Whichever transport `new_transport` points at, it won't go await + * until the last module_put() below or in vsock_deassign_transport(). + */ + mutex_unlock(&vsock_register_mutex); =20 if (sk->sk_type =3D=3D SOCK_SEQPACKET) { if (!new_transport->seqpacket_allow || @@ -528,6 +543,9 @@ int vsock_assign_transport(struct vsock_sock *vsk, stru= ct vsock_sock *psk) vsk->transport =3D new_transport; =20 return 0; +err: + mutex_unlock(&vsock_register_mutex); + return ret; } EXPORT_SYMBOL_GPL(vsock_assign_transport); =20 --=20 2.49.0 From nobody Thu Oct 9 02:17:45 2025 Received: from mailtransmit04.runbox.com (mailtransmit04.runbox.com [185.226.149.37]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1805122689C for ; Fri, 20 Jun 2025 19:53:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.226.149.37 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750449187; cv=none; b=fnVCV4he/swG5JSJw5rexAvZ/Sa3+w6zNnuDgbVSU+5p3cMLiVEVL6k82eCflh1o0/nJ0bs/C+LiGSKEdOie/fyTwvw9CC6+FFmieniz4pZ0a8XtVZN1KajXCauUvUOQdogEXM3L9XuYfEaLdGBqs1RLff+P2grieTsrpIAN9Mk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750449187; c=relaxed/simple; bh=IA1v21XSYp9brpbYgXg7OcdfSvZaDksDvp3fz0pIJCk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eTXofoS6LIhceZkPcTfFeneUb1a5KSQwCeHnTFbzjaT4vYRpwcxswzRyprCWCixkVDgUmSsQ4Pb2F1IIw6MzV8n+1usvqOt1l4nIBt9C5RK2XmddtLwBAedXrEPIKjvgiGP8INMhBadSx5lZVhPSaCia2pEiBgxjPyhanlUHaa0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rbox.co; spf=pass smtp.mailfrom=rbox.co; dkim=pass (2048-bit key) header.d=rbox.co header.i=@rbox.co header.b=bzkagKWh; arc=none smtp.client-ip=185.226.149.37 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rbox.co Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rbox.co Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rbox.co header.i=@rbox.co header.b="bzkagKWh" Received: from mailtransmit03.runbox ([10.9.9.163] helo=aibo.runbox.com) by mailtransmit04.runbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1uShnG-000fAn-NK; Fri, 20 Jun 2025 21:52:58 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=rbox.co; s=selector2; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From; bh=mAQn+LsaZ4KxkSKkcYxJ2lCZQrMV5oD1Rbyyax4M+T8=; b=bzkagKWhCKg6SwbYBr+HbsdL8H +hkdE7XiDraQ/p0S53rgS3RwqyMqwDvROukZ10+0sLHHLG61K5Pe6UjkcoZmQ7k+KtsC9iIuU3w+s sgtyDCckEa5NVvGHaG0sy1aBQ5fYJrzG9YVakBaW52XYJuITr9cV0HS3svwKh3Tv5+5UogsPHLWQD TXJd+aiOIoiZjstmKoEeYzx8mHH7PHB7HPYuQgFXDlIFzs2B5hdvP75tvjtEWfx7tRM5VQoOD/skn cQpmwG3ulgo7TNnfjQsJG/lbyOwZLPa3Hu2aC4RjYdZQB2RIiGw4p1itsnV48kIEIx2jMmEpsaHnL LGU84okw==; Received: from [10.9.9.73] (helo=submission02.runbox) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1uShnF-0003hD-PD; Fri, 20 Jun 2025 21:52:57 +0200 Received: by submission02.runbox with esmtpsa [Authenticated ID (604044)] (TLS1.2:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.93) id 1uShnE-00CRMQ-10; Fri, 20 Jun 2025 21:52:56 +0200 From: Michal Luczaj Date: Fri, 20 Jun 2025 21:52:45 +0200 Subject: [PATCH RFC net v2 3/3] vsock: Fix IOCTL_VM_SOCKETS_GET_LOCAL_CID to check also `transport_local` Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250620-vsock-transports-toctou-v2-3-02ebd20b1d03@rbox.co> References: <20250620-vsock-transports-toctou-v2-0-02ebd20b1d03@rbox.co> In-Reply-To: <20250620-vsock-transports-toctou-v2-0-02ebd20b1d03@rbox.co> To: Stefano Garzarella , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Stefan Hajnoczi Cc: virtualization@lists.linux.dev, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Michal Luczaj X-Mailer: b4 0.14.2 Support returning VMADDR_CID_LOCAL in case no other vsock transport is available. Fixes: 0e12190578d0 ("vsock: add local transport support in the vsock core") Suggested-by: Stefano Garzarella Signed-off-by: Michal Luczaj --- man vsock(7) mentions IOCTL_VM_SOCKETS_GET_LOCAL_CID vs. VMADDR_CID_LOCAL: Ioctls ... IOCTL_VM_SOCKETS_GET_LOCAL_CID ... Consider using VMADDR_CID_ANY when binding instead of getting the local CID with IOCTL_VM_SOCKETS_GET_LOCAL_CID. Local communication .... The local CID obtained with IOCTL_VM_SOCKETS_GET_LOCAL_CID can be used for the same purpose, but it is preferable to use VMADDR_CID_LOCAL. I was wondering it that would need some rewriting, since we're adding VMADDR_CID_LOCAL as a possible ioctl's return value. --- net/vmw_vsock/af_vsock.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c index a1b1073a2c89f865fcdb58b38d8e7feffcf1544f..4bdb4016bd14d790f3d217d5063= be64a1553b194 100644 --- a/net/vmw_vsock/af_vsock.c +++ b/net/vmw_vsock/af_vsock.c @@ -2577,6 +2577,8 @@ static long vsock_dev_do_ioctl(struct file *filp, cid =3D vsock_transport_local_cid(&transport_g2h); if (cid =3D=3D VMADDR_CID_ANY) cid =3D vsock_transport_local_cid(&transport_h2g); + if (cid =3D=3D VMADDR_CID_ANY && transport_local) + cid =3D VMADDR_CID_LOCAL; =20 if (put_user(cid, p) !=3D 0) retval =3D -EFAULT; --=20 2.49.0