[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YLA5Egyhy5uKDSxq@google.com>
Date: Fri, 28 May 2021 00:28:02 +0000
From: Sean Christopherson <seanjc@...gle.com>
To: Wanpeng Li <kernellwp@...il.com>
Cc: linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
Paolo Bonzini <pbonzini@...hat.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>
Subject: Re: [PATCH v4 1/2] KVM: X86: Fix warning caused by stale emulation
context
On Thu, May 27, 2021, Wanpeng Li wrote:
> From: Wanpeng Li <wanpengli@...cent.com>
>
> Reported by syzkaller:
>
> WARNING: CPU: 7 PID: 10526 at linux/arch/x86/kvm//x86.c:7621 x86_emulate_instruction+0x41b/0x510 [kvm]
> RIP: 0010:x86_emulate_instruction+0x41b/0x510 [kvm]
> Call Trace:
> kvm_mmu_page_fault+0x126/0x8f0 [kvm]
> vmx_handle_exit+0x11e/0x680 [kvm_intel]
> vcpu_enter_guest+0xd95/0x1b40 [kvm]
> kvm_arch_vcpu_ioctl_run+0x377/0x6a0 [kvm]
> kvm_vcpu_ioctl+0x389/0x630 [kvm]
> __x64_sys_ioctl+0x8e/0xd0
> do_syscall_64+0x3c/0xb0
> entry_SYSCALL_64_after_hwframe+0x44/0xae
>
> Commit 4a1e10d5b5d8 ("KVM: x86: handle hardware breakpoints during emulation())
> adds hardware breakpoints check before emulation the instruction and parts of
> emulation context initialization, actually we don't have the EMULTYPE_NO_DECODE flag
> here and the emulation context will not be reused. Commit c8848cee74ff ("KVM: x86:
> set ctxt->have_exception in x86_decode_insn()) triggers the warning because it
> catches the stale emulation context has #UD, however, it is not during instruction
> decoding which should result in EMULATION_FAILED. This patch fixes it by moving
> the second part emulation context initialization into init_emulate_ctxt() and
> before hardware breakpoints check. The ctxt->ud will be dropped by a follow-up
> patch.
>
> syzkaller source: https://syzkaller.appspot.com/x/repro.c?x=134683fdd00000
>
> Reported-by: syzbot+71271244f206d17f6441@...kaller.appspotmail.com
> Fixes: 4a1e10d5b5d8 (KVM: x86: handle hardware breakpoints during emulation)
> Signed-off-by: Wanpeng Li <wanpengli@...cent.com>
> ---
Reviewed-by: Sean Christopherson <seanjc@...gle.com>
Powered by blists - more mailing lists