mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Huang, Kai" <kai.huang@intel.com>
To: Sean Christopherson <seanjc@google.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Cc: <kvm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<syzbot+23786faffb695f17edaa@syzkaller.appspotmail.com>
Subject: Re: [PATCH] KVM: x86/mmu: Check that root is valid/loaded when pre-faulting SPTEs
Date: Tue, 23 Jul 2024 14:48:38 +1200	[thread overview]
Message-ID: <36021c91-44c6-48fc-9a63-7ff2301e200c@intel.com> (raw)
In-Reply-To: <20240723000211.3352304-1-seanjc@google.com>



On 23/07/2024 12:02 pm, Sean Christopherson wrote:
> Error out if kvm_mmu_reload() fails when pre-faulting memory, as trying to
> fault-in SPTEs will fail miserably due to root.hpa pointing at garbage.
> 
> Note, kvm_mmu_reload() can return -EIO and thus trigger the WARN on -EIO
> in kvm_vcpu_pre_fault_memory(), but all such paths also WARN, i.e. the
> WARN isn't user-triggerable and won't run afoul of warn-on-panic because
> the kernel would already be panicking.
> 
>    BUG: unable to handle page fault for address: 000029ffffffffe8
>    #PF: supervisor read access in kernel mode
>    #PF: error_code(0x0000) - not-present page
>    PGD 0 P4D 0
>    Oops: Oops: 0000 [#1] PREEMPT SMP
>    CPU: 22 PID: 1069 Comm: pre_fault_memor Not tainted 6.10.0-rc7-332d2c1d713e-next-vm #548
>    Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
>    RIP: 0010:is_page_fault_stale+0x3e/0xe0 [kvm]
>    RSP: 0018:ffffc9000114bd48 EFLAGS: 00010206
>    RAX: 00003fffffffffc0 RBX: ffff88810a07c080 RCX: ffffc9000114bd78
>    RDX: ffff88810a07c080 RSI: ffffea0000000000 RDI: ffff88810a07c080
>    RBP: ffffc9000114bd78 R08: 00007fa3c8c00000 R09: 8000000000000225
>    R10: ffffea00043d7d80 R11: 0000000000000000 R12: ffff88810a07c080
>    R13: 0000000100000000 R14: ffffc9000114be58 R15: 0000000000000000
>    FS:  00007fa3c9da0740(0000) GS:ffff888277d80000(0000) knlGS:0000000000000000
>    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
>    CR2: 000029ffffffffe8 CR3: 000000011d698000 CR4: 0000000000352eb0
>    Call Trace:
>     <TASK>
>     kvm_tdp_page_fault+0xcc/0x160 [kvm]
>     kvm_mmu_do_page_fault+0xfb/0x1f0 [kvm]
>     kvm_arch_vcpu_pre_fault_memory+0xd0/0x1a0 [kvm]
>     kvm_vcpu_ioctl+0x761/0x8c0 [kvm]
>     __x64_sys_ioctl+0x82/0xb0
>     do_syscall_64+0x5b/0x160
>     entry_SYSCALL_64_after_hwframe+0x4b/0x53
>     </TASK>
>    Modules linked in: kvm_intel kvm
>    CR2: 000029ffffffffe8
>    ---[ end trace 0000000000000000 ]---
> 
> Fixes: 6e01b7601dfe ("KVM: x86: Implement kvm_arch_vcpu_pre_fault_memory()")
> Reported-by: syzbot+23786faffb695f17edaa@syzkaller.appspotmail.com
> Closes: https://lore.kernel.org/all/0000000000002b84dc061dd73544@google.com
> Signed-off-by: Sean Christopherson <seanjc@google.com>
> ---

Reviewed-by: Kai Huang <kai.huang@intel.com>

  reply	other threads:[~2024-07-23  2:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-23  0:02 Sean Christopherson
2024-07-23  2:48 ` Huang, Kai [this message]
2024-08-23 23:47 ` Sean Christopherson

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=36021c91-44c6-48fc-9a63-7ff2301e200c@intel.com \
    --to=kai.huang@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=syzbot+23786faffb695f17edaa@syzkaller.appspotmail.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

all inboxes | Powered by JetHome®