[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c78b345b9b59197cad89a661095f5f3d1e0d0718.camel@linux.ibm.com>
Date: Mon, 06 Nov 2023 14:06:22 +0100
From: Nina Schoetterl-Glausch <nsg@...ux.ibm.com>
To: David Hildenbrand <david@...hat.com>,
Alexander Gordeev <agordeev@...ux.ibm.com>,
Claudio Imbrenda <imbrenda@...ux.ibm.com>,
Christian Borntraeger <borntraeger@...ux.ibm.com>,
Vasily Gorbik <gor@...ux.ibm.com>,
Heiko Carstens <hca@...ux.ibm.com>,
Janosch Frank <frankja@...ux.ibm.com>,
David Hildenbrand <dahi@...ux.vnet.ibm.com>
Cc: Cornelia Huck <cornelia.huck@...ibm.com>,
linux-s390@...r.kernel.org, Sven Schnelle <svens@...ux.ibm.com>,
kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
Michael Mueller <mimu@...ux.vnet.ibm.com>
Subject: Re: [PATCH 2/4] KVM: s390: vsie: Fix length of facility list
shadowed
On Fri, 2023-11-03 at 19:34 +0100, David Hildenbrand wrote:
> On 03.11.23 18:30, Nina Schoetterl-Glausch wrote:
> > The length of the facility list accessed when interpretively executing
> > STFLE is the same as the hosts facility list (in case of format-0)
> > When shadowing, copy only those bytes.
> > The memory following the facility list need not be accessible, in which
> > case we'd wrongly inject a validity intercept.
> >
> > Fixes: 66b630d5b7f2 ("KVM: s390: vsie: support STFLE interpretation")
> > Signed-off-by: Nina Schoetterl-Glausch <nsg@...ux.ibm.com>
> > ---
> > arch/s390/include/asm/facility.h | 6 ++++++
> > arch/s390/kernel/Makefile | 2 +-
> > arch/s390/kernel/facility.c | 18 ++++++++++++++++++
> > arch/s390/kvm/vsie.c | 12 +++++++++++-
> > 4 files changed, 36 insertions(+), 2 deletions(-)
> > create mode 100644 arch/s390/kernel/facility.c
[...]
> > diff --git a/arch/s390/kernel/facility.c b/arch/s390/kernel/facility.c
[...]
> > +#include <asm/facility.h>
> > +
> > +unsigned int stfle_size(void)
> > +{
> > + static unsigned int size = 0;
> > + u64 dummy;
> > +
> > + if (!size) {
> > + size = __stfle_asm(&dummy, 1) + 1;
> > + }
> > + return size;
> > +}
> > +EXPORT_SYMBOL(stfle_size);
>
> Possible races? Should have to use an atomic?
Good point. Calling __stfle_asm multiple times is fine
and AFAIK torn reads/writes aren't possible. I don't see a way
for the compiler to break things either.
But it might indeed be nicer to use an atomic, without
any downsides.
>
> No access to documentation, but sounds plausible.
>
> Acked-by: David Hildenbrand <david@...hat.com>
Thanks!
Powered by blists - more mailing lists