From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794061769; b=L5xmX1s4xMRNhTzx1IP5feDfMFdLdt3MtNrxTV/YvzCGafGUxSU21jD3lMaCzGzV+qNx rXDkQbtQ8hCaQE8uXQsdQkEU6ei0CEdapZmKGwHQdR1ASUQFGjZRYKjPSP6lxETmczgTe 6gw0EPg/JXKcqwPqIdOFNKb0GDDMCVLyPbruWppLhM7/ZtS3L1pKStb0Xo28fJLJxBl/e M/p6blES52uww0VUSWgy4rJcchwbKAMHqNGfGh0BAAga+o5uXxbNq0OWDDc4F8J1bZsCU Uqk0bMbFPWWcKeU0WniYyD3r9OY4fWChiM80OXe9Efisb6TNqtQVRSP8XPtBvivDfnw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794061769; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=GGkyv4CpqGMhqWQDf7xMTU9+nH8GNdg6oBJrFko1eyA=; b=xwNxQh/HnXnKY98fzX+h+cHSKpCT+izBYJwkWiusQanqKmY62Rl0MgjHsndVLLNFT5pR q0wZwqrf7+ZrC4O3COTWd5LudLAlYajN5x40sYEYgfSamQK9b+6l/koMe5iHrEnLI3D6j ZYRW0tA6iH9vxVLllOyWTMK6iD7Hs1YOOO1zYiw9MP6NtGweWlUpg/580CgGyWVxWOlIo HJPUyon00+pay+JCCCNdZEOvrhytJR4A2PjegiFzHspViQbZ3+dqGEzuBzr/dswVmX+yX zDDgEPlODSEYYBRWQsEz8dEhsLRJTrtVxYjWP6ncFnBHRAOjgnS9VmBCMyV7wC7TDEA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=pnnTqUSV; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 289AA606A330; Sat, 7 Nov 2026 14:29:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=pnnTqUSV Received: by smtp.kernel.org (Postfix) with ESMTPSA id C50B31F008A1; Sat, 7 Nov 2026 14:29:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1794061769; bh=GGkyv4CpqGMhqWQDf7xMTU9+nH8GNdg6oBJrFko1eyA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=pnnTqUSVlXsvS/FO7aByM+fHiGxtuLaaDgKLNGVHGKic6cMZiIYkLArP/IvOXVGwB b6UL+FHquoSM1SfAI5zSRSvmRZgSRWCFk1MTVg4K2Q6r892M7tTIvm+kb2i/5AGSP8 TjKa8tVPoPAKXqC41rRol69DAz+JGp/EwxdMCy+E= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Stefan Teodorescu , Vitaly Kuznetsov , Sean Christopherson Subject: [PATCH 6.12 0803/1536] KVM: x86: Zero reserved synic flags when delivering message to avoid stack leak Date: Sat, 7 Nov 2026 08:46:59 -0500 Message-ID: <20261107135020.099559268@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261107134957.653319350@linuxfoundation.org> References: <20261107134957.653319350@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sean Christopherson commit 2616f497506a772db53e7bb1024cde50b4c165e0 upstream. Ensure all reserved flags are zeroed when setting the msg_pending flag as part of SynIC message delivery, as setting only msg_pending can leak seven bits of kernel stack data to the guest. E.g. gcc typically uses a bitwise-OR to set the msg_pending flag, without initializing the on-stack variable. Precisely zero the flags, e.g. as opposed to zeroing the entire structure, to make it somewhat more obvious that the flags *need* to be zeroed. E.g. it would be quite easy to misread the initial read of guest memory and think that zeroing the entire structure is completely superfluous. Fixes: 3a0e7731724f ("x86: kvm: hyperv: simplify SynIC message delivery") Cc: stable@vger.kernel.org Reported-by: Stefan Teodorescu Reviewed-by: Vitaly Kuznetsov Link: https://patch.msgid.link/20260826184449.814130-1-seanjc@google.com Signed-off-by: Sean Christopherson Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/hyperv.c | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/x86/kvm/hyperv.c +++ b/arch/x86/kvm/hyperv.c @@ -794,7 +794,9 @@ static int synic_deliver_msg(struct kvm_ if (no_retry) return 0; + hv_hdr.message_flags.asu8 = 0; hv_hdr.message_flags.msg_pending = 1; + r = kvm_vcpu_write_guest_page(vcpu, msg_page_gfn, &hv_hdr.message_flags, msg_off +