public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Farman <farman@linux.ibm.com>
To: Christoph Schlameuss <schlameuss@linux.ibm.com>,
	Christian Borntraeger	 <borntraeger@linux.ibm.com>,
	Janosch Frank <frankja@linux.ibm.com>,
	Claudio Imbrenda <imbrenda@linux.ibm.com>,
	David Hildenbrand <david@redhat.com>
Cc: kvm@vger.kernel.org, linux-s390@vger.kernel.org
Subject: Re: [PATCH] KVM: s390: vsie: Check alignment of BSCA header
Date: Tue, 11 Nov 2025 10:36:04 -0500	[thread overview]
Message-ID: <cbb6ffbc3946b6f4da6bef9c6c876cdc68b608cf.camel@linux.ibm.com> (raw)
In-Reply-To: <DE5QK1RDMQR7.3OEIS68GLQHK5@linux.ibm.com>

On Tue, 2025-11-11 at 09:51 +0100, Christoph Schlameuss wrote:
> On Fri Nov 7, 2025 at 3:49 AM CET, Eric Farman wrote:
> > The VSIE code currently checks that the BSCA struct fits within
> > a page, and returns a validity exception 0x003b if it doesn't.
> > The BSCA is pinned in memory rather than shadowed (see block
> > comment at end of kvm_s390_cpu_feat_init()), so enforcing the
> > CPU entries to be on the same pinned page makes sense.
> > 
> > Except those entries aren't going to be used below the guest,
> > and according to the definition of that validity exception only
> > the header of the BSCA (everything but the CPU entries) needs to
> > be within a page. Adjust the alignment check to account for that.
> > 
> > Signed-off-by: Eric Farman <farman@linux.ibm.com>
> > ---
> >  arch/s390/kvm/vsie.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c
> > index 347268f89f2f..d23ab5120888 100644
> > --- a/arch/s390/kvm/vsie.c
> > +++ b/arch/s390/kvm/vsie.c
> > @@ -782,7 +782,7 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
> >  		else if ((gpa & ~0x1fffUL) == kvm_s390_get_prefix(vcpu))
> >  			rc = set_validity_icpt(scb_s, 0x0011U);
> >  		else if ((gpa & PAGE_MASK) !=
> > -			 ((gpa + sizeof(struct bsca_block) - 1) & PAGE_MASK))
> > +			 ((gpa + offsetof(struct bsca_block, cpu[0]) - 1) & PAGE_MASK))
> 
> Did you test if this works with an esca, where the header is bigger than this?
> Previously the esca header was covered by the whole bsca struct.

I had originally coded up an offset like you did in your vsie sigpif series [*] for just this point,
but since we don't surface KVM_S390_VM_CPU_FEAT_SIGPIF to the guest (that comes later in your
series), I was having to force my way into driving that path and for minimal benefit. Now that I'm
remembering your RFC, having a conditional length is certainly correct but this is a good first
step.

[*] https://lore.kernel.org/linux-s390/20251110-vsieie-v2-3-9e53a3618c8c@linux.ibm.com/

> 
> >  			rc = set_validity_icpt(scb_s, 0x003bU);
> >  		if (!rc) {
> >  			rc = pin_guest_page(vcpu->kvm, gpa, &hpa);

  reply	other threads:[~2025-11-11 15:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-07  2:49 [PATCH] KVM: s390: vsie: Check alignment of BSCA header Eric Farman
2025-11-07  6:47 ` Christian Borntraeger
2025-11-11  8:51 ` Christoph Schlameuss
2025-11-11 15:36   ` Eric Farman [this message]
2025-11-11 16:24     ` Christoph Schlameuss

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cbb6ffbc3946b6f4da6bef9c6c876cdc68b608cf.camel@linux.ibm.com \
    --to=farman@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=david@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=schlameuss@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox