Subject: CVE-2023-52639: KVM: s390: vsie: fix race during shadow creation

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

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

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

KVM: s390: vsie: fix race during shadow creation

Right now it is possible to see gmap->private being zero in
kvm_s390_vsie_gmap_notifier resulting in a crash.  This is due to the
fact that we add gmap->private == kvm after creation:

static int acquire_gmap_shadow(struct kvm_vcpu *vcpu,
                               struct vsie_page *vsie_page)
{
[...]
        gmap = gmap_shadow(vcpu->arch.gmap, asce, edat);
        if (IS_ERR(gmap))
                return PTR_ERR(gmap);
        gmap->private = vcpu->kvm;

Let children inherit the private field of the parent.

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

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

	Issue introduced in 4.8 with commit a3508fbe9dc6 and fixed in 6.1.82 with commit 5df3b81a567e
	Issue introduced in 4.8 with commit a3508fbe9dc6 and fixed in 6.6.22 with commit f5572c0323cf
	Issue introduced in 4.8 with commit a3508fbe9dc6 and fixed in 6.7.6 with commit 28bb27824f25
	Issue introduced in 4.8 with commit a3508fbe9dc6 and fixed in 6.8 with commit fe752331d4b3

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-2023-52639
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/s390/kvm/vsie.c
	arch/s390/mm/gmap.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/5df3b81a567eb565029563f26f374ae3803a1dfc
	https://git.kernel.org/stable/c/f5572c0323cf8b4f1f0618178648a25b8fb8a380
	https://git.kernel.org/stable/c/28bb27824f25f36e5f80229a358d66ee09244082
	https://git.kernel.org/stable/c/fe752331d4b361d43cfd0b89534b4b2176057c32