Re: kvm: WARNING in nested_vmx_merge_msr_bitmap

From: Jim Mattson
Date: Tue Feb 28 2017 - 16:09:12 EST


I believe this happens when the VMCS12 MSR bitmap address is valid,
but no device is configured to respond to the bus request. I agree
that the warning should be removed. However, in this case, the VMCS12
MSR bitmap should read as all 1s. The same is true everywhere that
nested_get_page returns NULL. Reads should return all 1s and writes
should be ignored.

On Tue, Feb 28, 2017 at 11:06 AM, Dmitry Vyukov <dvyukov@xxxxxxxxxx> wrote:
> Hello,
>
> I've got the following WARNING while running syzkaller fuzzer:
>
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 7832 at arch/x86/kvm/vmx.c:9709
> nested_vmx_merge_msr_bitmap arch/x86/kvm/vmx.c:9709 [inline]
> WARNING: CPU: 0 PID: 7832 at arch/x86/kvm/vmx.c:9709
> nested_get_vmcs12_pages+0xfb6/0x15c0 arch/x86/kvm/vmx.c:9640
> Kernel panic - not syncing: panic_on_warn set ...
> CPU: 0 PID: 7832 Comm: syz-executor1 Not tainted 4.10.0+ #229
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
> Call Trace:
> __dump_stack lib/dump_stack.c:15 [inline]
> dump_stack+0x2ee/0x3ef lib/dump_stack.c:51
> panic+0x1fb/0x412 kernel/panic.c:179
> __warn+0x1c4/0x1e0 kernel/panic.c:540
> warn_slowpath_null+0x2c/0x40 kernel/panic.c:583
> nested_vmx_merge_msr_bitmap arch/x86/kvm/vmx.c:9709 [inline]
> nested_get_vmcs12_pages+0xfb6/0x15c0 arch/x86/kvm/vmx.c:9640
> enter_vmx_non_root_mode arch/x86/kvm/vmx.c:10471 [inline]
> nested_vmx_run+0x6186/0xaab0 arch/x86/kvm/vmx.c:10561
> handle_vmlaunch+0x1a/0x20 arch/x86/kvm/vmx.c:7312
> vmx_handle_exit+0xfc0/0x3f00 arch/x86/kvm/vmx.c:8526
> vcpu_enter_guest arch/x86/kvm/x86.c:6982 [inline]
> vcpu_run arch/x86/kvm/x86.c:7044 [inline]
> kvm_arch_vcpu_ioctl_run+0x1418/0x4840 arch/x86/kvm/x86.c:7205
> kvm_vcpu_ioctl+0x673/0x1120 arch/x86/kvm/../../../virt/kvm/kvm_main.c:2570
> sctp: [Deprecated]: syz-executor2 (pid 7865) Use of int in max_burst
> socket option.
> Use struct sctp_assoc_value instead
> vfs_ioctl fs/ioctl.c:43 [inline]
> do_vfs_ioctl+0x1bf/0x1790 fs/ioctl.c:683
> SYSC_ioctl fs/ioctl.c:698 [inline]
> SyS_ioctl+0x8f/0xc0 fs/ioctl.c:689
> entry_SYSCALL_64_fastpath+0x1f/0xc2
> 9pnet_virtio: no channels available for device ./bus
> RIP: 0033:0x4458d9
> RSP: 002b:00007f248b1abb58 EFLAGS: 00000286 ORIG_RAX: 0000000000000010
> RAX: ffffffffffffffda RBX: 000000000000001b RCX: 00000000004458d9
> RDX: 0000000000000000 RSI: 000000000000ae80 RDI: 000000000000001b
> RBP: 00000000006dfcd0 R08: 0000000000000000 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000286 R12: 00000000007080a8
> R13: 000000000000001a R14: 000000000000001b R15: 00000000201b3000
>
>
> If I am reading this correctly, failure to map msr bitmap is trivially
> trigger-able by guest (specify an invalid address?) and thus should
> not be a warning. The case is already handled by disabling
> acceleration. So can we remove the warning? or replace with pr_err?