Re: [PATCH] KVM: s390: fix sthyi error handling

From: Heiko Carstens
Date: Fri Jul 28 2023 - 06:19:10 EST


On Fri, Jul 28, 2023 at 09:28:58AM +0200, Christian Borntraeger wrote:
> Am 27.07.23 um 20:29 schrieb Heiko Carstens:
> > Commit 9fb6c9b3fea1 ("s390/sthyi: add cache to store hypervisor info")
> > added cache handling for store hypervisor info. This also changed the
> > possible return code for sthyi_fill().
> >
> > Instead of only returning a condition code like the sthyi instruction would
> > do, it can now also return a negative error value (-ENOMEM). handle_styhi()
> > was not changed accordingly. In case of an error, the negative error value
> > would incorrectly injected into the guest PSW.
> >
> > Add proper error handling to prevent this, and update the comment which
> > describes the possible return values of sthyi_fill().
>
> To me it looks like this can only happen if page allocation fails? This should
> not happen in normal cases (and return -ENOMEM would likely kill the guest as
> QEMU would stop).
> But if it happens we better stop.

Yes, no reason for any stable backports. But things might change in the
future, so we better have correct error handling in place.