Subject: CVE-2023-21657: kvm: initialize all of the kvm_debugregs structure before sending it to userspace

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

kvm: initialize all of the kvm_debugregs structure before sending it to userspace

When calling the KVM_GET_DEBUGREGS ioctl, on some configurations, there
might be some unitialized portions of the kvm_debugregs structure that
could be copied to userspace.  Prevent this as is done in the other kvm
ioctls, by setting the whole structure to 0 before copying anything into
it.

Bonus is that this reduces the lines of code as the explicit flag
setting and reserved space zeroing out can be removed.

The Linux kernel CVE team has assigned CVE-2023-21657 to this issue.

Affected and fixed versions
===========================

	Fixed in 4.14.306 with commit 1d43de93b35d
	Fixed in 4.19.273 with commit 669c76e55de3
	Fixed in 5.4.232 with commit 9f95a161a7de
	Fixed in 5.10.169 with commit 6416c2108ba5
	Fixed in 5.15.95 with commit 35351e3060d6
	Fixed in 6.1.13 with commit 747ca7c8a0c7
	Fixed in 6.2 with commit 2c10b61421a2

Please see https://www.kernel.org or a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2023-21657
will be updated if fixes are backported, please check that for the most
up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
	arch/x86/kvm/x86.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/1d43de93b35d
	https://git.kernel.org/stable/c/669c76e55de3
	https://git.kernel.org/stable/c/9f95a161a7de
	https://git.kernel.org/stable/c/6416c2108ba5
	https://git.kernel.org/stable/c/35351e3060d6
	https://git.kernel.org/stable/c/747ca7c8a0c7
	https://git.kernel.org/stable/c/2c10b61421a2