Subject: CVE-2021-47407: KVM: x86: Handle SRCU initialization failure during page track init

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

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

In the Linux kernel, the following vulnerability has been resolved:

KVM: x86: Handle SRCU initialization failure during page track init

Check the return of init_srcu_struct(), which can fail due to OOM, when
initializing the page track mechanism.  Lack of checking leads to a NULL
pointer deref found by a modified syzkaller.

[Move the call towards the beginning of kvm_arch_init_vm. - Paolo]

The Linux kernel CVE team has assigned CVE-2021-47407 to this issue.

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

	Fixed in 5.10.71 with commit deb294941767
	Fixed in 5.14.10 with commit 4664318f73e4
	Fixed in 5.15 with commit eb7511bf9182

Please see https://www.kernel.org for 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-2021-47407
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/include/asm/kvm_page_track.h
	arch/x86/kvm/mmu/page_track.c
	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/deb2949417677649e2413266d7ce8c2ff73952b4
	https://git.kernel.org/stable/c/4664318f73e496cd22c71b10888e75434a123e23
	https://git.kernel.org/stable/c/eb7511bf9182292ef1df1082d23039e856d1ddfb