Re: [syzbot] [kvm?] WARNING in kvm_tdp_mmu_invalidate_all_roots

Sean Christopherson
2023-04-24T15:36:56Z

On Mon, Apr 24, 2023, Dmitry Vyukov wrote:
> On Fri, 21 Apr 2023 at 23:52, 'Sean Christopherson' via syzkaller-bugs
> <syzkaller-bugs@googlegroups.com> wrote:
> >
> > On Fri, Apr 21, 2023, syzbot wrote:
> > > Hello,
> > >
> > > syzbot found the following issue on:
> > >
> > > HEAD commit: d3e1ee0e67e7 Add linux-next specific files for 20230421
> > > git tree: linux-next
> > > console output: https://syzkaller.appspot.com/x/log.txt?x=16ac3de0280000
> > > kernel config: https://syzkaller.appspot.com/x/.config?x=53c789efbcc06cf6
> > > dashboard link: https://syzkaller.appspot.com/bug?extid=094a74444165dbcd3a54
> > > compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
> > >
> > > Unfortunately, I don't have any reproducer for this issue yet.
> > >
> > > Downloadable assets:
> > > disk image: https://storage.googleapis.com/syzbot-assets/c558a9e1fe6a/disk-d3e1ee0e.raw.xz
> > > vmlinux: https://storage.googleapis.com/syzbot-assets/2ec100a34c4c/vmlinux-d3e1ee0e.xz
> > > kernel image: https://storage.googleapis.com/syzbot-assets/1afcd9936dc1/bzImage-d3e1ee0e.xz
> > >
> > > IMPORTANT: if you fix the issue, please add the following tag to the commit:
> > > Reported-by: syzbot+094a74444165dbcd3a54@syzkaller.appspotmail.com
> > >
> > > ------------[ cut here ]------------
> > > WARNING: CPU: 0 PID: 12623 at arch/x86/kvm/mmu/tdp_mmu.c:943 kvm_tdp_mmu_invalidate_all_roots+0x2bd/0x370 arch/x86/kvm/mmu/tdp_mmu.c:943
> > > Modules linked in:
> > > CPU: 0 PID: 12623 Comm: syz-executor.3 Not tainted 6.3.0-rc7-next-20230421-syzkaller #0
> > > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/30/2023
> > > RIP: 0010:kvm_tdp_mmu_invalidate_all_roots+0x2bd/0x370 arch/x86/kvm/mmu/tdp_mmu.c:943
> > > Call Trace:
> > > <TASK>
> > > kvm_mmu_uninit_tdp_mmu+0x16/0x100 arch/x86/kvm/mmu/tdp_mmu.c:48
> > > kvm_mmu_uninit_vm+0x6a/0x70 arch/x86/kvm/mmu/mmu.c:6239
> > > kvm_arch_destroy_vm+0x369/0x490 arch/x86/kvm/x86.c:12465
> > > kvm_create_vm arch/x86/kvm/../../../virt/kvm/kvm_main.c:1245 [inline]
> > > kvm_dev_ioctl_create_vm arch/x86/kvm/../../../virt/kvm/kvm_main.c:5017 [inline]
> > > kvm_dev_ioctl+0x11be/0x1bb0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:5059
> > > vfs_ioctl fs/ioctl.c:51 [inline]
> > > __do_sys_ioctl fs/ioctl.c:870 [inline]
> > > __se_sys_ioctl fs/ioctl.c:856 [inline]
> > > __x64_sys_ioctl+0x197/0x210 fs/ioctl.c:856
> > > do_syscall_x64 arch/x86/entry/common.c:50 [inline]
> > > do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
> > > entry_SYSCALL_64_after_hwframe+0x63/0xcd
> >
> > Gah, kvm->users_count is elevated when the VM is destroyed if creation fails,
> > but mmu_lock isn't held in that case, and lockdep yells. This particular bug is
> > effectively a false positive, nothing else holds a reference to the VM.
> >
> > However, syzbot found another bug that _is_ a real problem (hasn't been reported
> > upstream yet for whatever reason).
>
> It was staged in the moderation queue for manual moderation:
> https://github.com/google/syzkaller/blob/master/docs/syzbot.md#moderation-queue
>
> here:
> https://groups.google.com/g/syzkaller-upstream-moderation/c/pTGA87FeSIE
>
> I've pushed it upstream since you say it's worth fixing.

Ah, thanks! For future reference, does "#syz upstream" also work from our internal
bug tracker, or do I have to wait for the report to hit the moderation queue first?