From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8A87A227EA8; Tue, 26 Aug 2025 13:41:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756215668; cv=none; b=Iz0QXNo5/0knJOqQlsFEyjCludtDNLa/tw4v5VLbWeOB998CwpvuPGfraVR1I0vqs3tFQQNxHZyQHjdtsUNYghNAQAOn0O0If2qkKTd7hqRt5EMkKCZfQ7jUvfUjkrrHvzgWC03ILsBcRhJaKLKWlBJ8L52q3yh7+wrDNHeqO4A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756215668; c=relaxed/simple; bh=+LPwhuexWKWggCosXfhE2BPYO5pOA2SJsSWtqAaU8qM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rSU/EYByjH/XurcU4nEW82NHxKEAmbZrOgoOvJapLUeVBwjIBNOhFI58ZNqj3Cbt7X5Yn1y7pZ+/DLJAsSodO/xnqhJNtw6qIkIKEuLsGDHr6b1dz1SPA21tfyAu4w1lvrJ9NZcCphmobTTfofzVlER1R4lF8jpUutkpGOCS/xA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=aUFh41cr; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="aUFh41cr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E230C113CF; Tue, 26 Aug 2025 13:41:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1756215668; bh=+LPwhuexWKWggCosXfhE2BPYO5pOA2SJsSWtqAaU8qM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aUFh41crpHSbgXzUVI1eoShwJUXgcx075YYEI+sc7yvEYaEzXt+xZPPhXpFmtEJ1N qdJuSnON9IGgNmZEEnHs+vPkVAv6KABBowSvZKxVvctluuQyTNCP4+d//Tvr0uKtb1 Ncemk+KHyBYnPVs3ICsgMlemaW+810beofv1dmLA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+9b9124ae9b12d5af5d95@syzkaller.appspotmail.com, Lizhi Xu , Sasha Levin Subject: [PATCH 5.15 120/644] vmci: Prevent the dispatching of uninitialized payloads Date: Tue, 26 Aug 2025 13:03:31 +0200 Message-ID: <20250826110949.494043929@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250826110946.507083938@linuxfoundation.org> References: <20250826110946.507083938@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Lizhi Xu [ Upstream commit bfb4cf9fb97e4063f0aa62e9e398025fb6625031 ] The reproducer executes the host's unlocked_ioctl call in two different tasks. When init_context fails, the struct vmci_event_ctx is not fully initialized when executing vmci_datagram_dispatch() to send events to all vm contexts. This affects the datagram taken from the datagram queue of its context by another task, because the datagram payload is not initialized according to the size payload_size, which causes the kernel data to leak to the user space. Before dispatching the datagram, and before setting the payload content, explicitly set the payload content to 0 to avoid data leakage caused by incomplete payload initialization. Fixes: 28d6692cd8fb ("VMCI: context implementation.") Reported-by: syzbot+9b9124ae9b12d5af5d95@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=9b9124ae9b12d5af5d95 Tested-by: syzbot+9b9124ae9b12d5af5d95@syzkaller.appspotmail.com Signed-off-by: Lizhi Xu Link: https://lore.kernel.org/r/20250627055214.2967129-1-lizhi.xu@windriver.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/misc/vmw_vmci/vmci_context.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/misc/vmw_vmci/vmci_context.c b/drivers/misc/vmw_vmci/vmci_context.c index c0b5e339d5a1..a8df60b9301c 100644 --- a/drivers/misc/vmw_vmci/vmci_context.c +++ b/drivers/misc/vmw_vmci/vmci_context.c @@ -251,6 +251,8 @@ static int ctx_fire_notification(u32 context_id, u32 priv_flags) ev.msg.hdr.src = vmci_make_handle(VMCI_HYPERVISOR_CONTEXT_ID, VMCI_CONTEXT_RESOURCE_ID); ev.msg.hdr.payload_size = sizeof(ev) - sizeof(ev.msg.hdr); + memset((char*)&ev.msg.hdr + sizeof(ev.msg.hdr), 0, + ev.msg.hdr.payload_size); ev.msg.event_data.event = VMCI_EVENT_CTX_REMOVED; ev.payload.context_id = context_id; -- 2.39.5