linux-stable/arch/s390/kvm
Christian Borntraeger 28bb27824f KVM: s390: vsie: fix race during shadow creation
commit fe752331d4 upstream.

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.

Reported-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Fixes: a3508fbe9d ("KVM: s390: vsie: initial support for nested virtualization")
Cc: <stable@vger.kernel.org>
Cc: David Hildenbrand <david@redhat.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Link: https://lore.kernel.org/r/20231220125317.4258-1-borntraeger@linux.ibm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-23 09:51:53 +01:00
..
Kconfig kvm: Remove "select SRCU" 2023-04-05 13:47:42 +00:00
Makefile KVM: s390: pci: add basic kvm_zdev structure 2022-07-11 09:54:27 +02:00
diag.c KVM: s390/diag: fix racy access of physical cpu number in diag 9c handler 2023-06-16 11:08:09 +02:00
gaccess.c s390 updates for the 6.7 merge window 2023-11-03 10:17:22 -10:00
gaccess.h KVM: s390: Extend MEM_OP ioctl by storage key checked cmpxchg 2023-02-07 18:06:00 +01:00
guestdbg.c KVM: s390: Add memcg accounting to KVM allocations 2020-12-10 13:36:05 +01:00
intercept.c - PV crypto passthrough enablement (Tony, Steffen, Viktor, Janosch) 2023-08-31 13:21:27 -04:00
interrupt.c KVM: s390: fix gisa destroy operation might lead to cpu stalls 2023-09-25 08:31:47 +02:00
kvm-s390.c KVM: s390: fix setting of fpc register 2024-02-05 20:16:48 +00:00
kvm-s390.h KVM: s390: export kvm_s390_pv*_is_protected functions 2023-08-18 15:24:35 +02:00
pci.c s390: fix various typos 2023-07-03 11:19:42 +02:00
pci.h KVM: s390: Mark __kvm_s390_init() and its descendants as __init 2022-12-29 15:41:22 -05:00
priv.c s390: use control register bit defines 2023-09-19 13:26:57 +02:00
pv.c - PV crypto passthrough enablement (Tony, Steffen, Viktor, Janosch) 2023-08-31 13:21:27 -04:00
sigp.c s390: fix various typos 2023-07-03 11:19:42 +02:00
trace-s390.h KVM: s390: add tracepoint in gmap notifier 2023-10-16 14:54:29 +02:00
trace.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vsie.c KVM: s390: vsie: fix race during shadow creation 2024-02-23 09:51:53 +01:00