From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: SimonP <simonp.git@mailbox.org>, kvm@vger.kernel.org
Subject: Re: [REGRESSION 7.2, BISECTED] KVM: x86: Starting Windows guest triggers UBSAN: array-index-out-of-bounds
Date: Wed, 7 Oct 2026 09:08:27 -0700 [thread overview]
Message-ID: <asZue2-WuiZZuNZR@google.com> (raw)
In-Reply-To: <asZdkvDI-zL_yZ-l@google.com>
On Wed, Oct 07, 2026, Sean Christopherson wrote:
> On Wed, Oct 07, 2026, Paolo Bonzini wrote:
> > On Tue, Oct 6, 2026 at 7:37 PM SimonP <simonp.git@mailbox.org> wrote:
> > > Hello,
> > >
> > > See subject. Happens in permission_fault() on line:
> > >
> > > fault = (mmu->permissions[index] >> pte_access) & 1;
> > >
> > > Some output from a printk I added, not spammed but keeps happening:
> > >
> > > kvm: permission_fault(): pfec = 70, index = 35, not_smap = 0
> >
> > Can you confirm you are using nested virtualization, and if so what is
> > the L1 hypervisor and L2 guest combination? Also what is the processor
> > model?
> >
> > The issue is weird; it is caused by the SS bit which is apparently set
> > in the #NPF exitcode; but it shouldn't be unless bit 4 is set in the
> > misc_ctl field, and KVM never sets it. Can you check if the attached
> > patch fixes it (modulo the fact that it shouldn't happen in the first
> > place)?
>
> ...
>
> > > kvm: permission_fault(): pfec = 70, index = 35, not_smap = 0
> > > kvm: permission_fault(): pfec = 70, index = 35, not_smap = 0
> > > kvm: permission_fault(): pfec = 70, index = 35, not_smap = 0
> > > kvm: permission_fault(): pfec = 68, index = 34, not_smap = 0
> > > kvm: permission_fault(): pfec = 68, index = 34, not_smap = 0
>
> It's not just SS, it's also PK (which shouldn't happen either) and RSVD, which
> *really* shouldn't happen. In the page fault path, KVM explicitly clears RSVD
> from error code that becomes @access and then pfec, so I'm completely baffled.
> Nothing in walk_addr_generic() writes to @access, so the only thing I can think
> of is that we're clobbering the stack?
>
> r = FNAME(walk_addr)(&walker, vcpu, fault->addr,
> fault->error_code & ~PFERR_RSVD_MASK);
Paolo pointed out offlist that the printks are in decimal, not hex. *sigh*
So yeah, 70 = 0x46 = SS | USER | WRITE. Which is way more sane than SS | PK | RSVD. :-D
While I'm here, the theory is that hardware is setting the SS bit because the
faulting access really was a userspace shadow stack access. Which was obviously
unexpected by us, but might be working as intended?
prev parent reply other threads:[~2026-10-07 16:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-06 17:29 [REGRESSION 7.2, BISECTED] KVM: x86: Starting Windows guest triggers UBSAN: array-index-out-of-bounds SimonP
2026-10-07 11:16 ` Paolo Bonzini
2026-10-07 11:18 ` Paolo Bonzini
2026-10-08 15:53 ` SimonP
2026-10-07 11:47 ` SimonP
2026-10-07 12:05 ` Paolo Bonzini
2026-10-07 12:11 ` SimonP
2026-10-07 14:56 ` Sean Christopherson
2026-10-07 16:08 ` Sean Christopherson [this message]
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=asZue2-WuiZZuNZR@google.com \
--to=seanjc@google.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=simonp.git@mailbox.org \
/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;
as well as URLs for NNTP newsgroup(s).