Subject: Re: [syzbot] INFO: task hung in synchronize_rcu (3)

From: Sean Christopherson <[email-masked]>
Date: Tue, 10 May 2022 13:56:51 +0000

On Tue, May 10, 2022, Paolo Bonzini wrote:
> On 5/10/22 15:45, Sean Christopherson wrote:
> > > 
> > >      KVM: x86: Don't re-acquire SRCU lock in complete_emulated_io()
> > > 
> > > bisection log:https://syzkaller.appspot.com/x/bisect.txt?x=16dc2e49f00000
> > > start commit:   ea4424be1688 Merge tag 'mtd/fixes-for-5.17-rc8' of git://g..
> > > git tree:       upstream
> > > kernel config:https://syzkaller.appspot.com/x/.config?x=442f8ac61e60a75e
> > > dashboard link:https://syzkaller.appspot.com/bug?extid=0c6da80218456f1edc36
> > > syz repro:https://syzkaller.appspot.com/x/repro.syz?x=1685af9e700000
> > > C reproducer:https://syzkaller.appspot.com/x/repro.c?x=11b09df1700000
> > > 
> > > If the result looks correct, please mark the issue as fixed by replying with:
> > > 
> > > #syz fix: KVM: x86: Don't re-acquire SRCU lock in complete_emulated_io()
> > > 
> > > For information about bisection process see:https://goo.gl/tpsmEJ#bisection
> > #syz fix: KVM: x86: Don't re-acquire SRCU lock in complete_emulated_io()
> > 
> 
> Are you sure? The hang is in synchronize_*rcu* and the testcase is unrelated
> to KVM.  It seems like the testcase is not 100% reproducible.

Ugh, syzbot seems to have bundled multiple unrelated errors together.  The splat
that comes up first on the dashboard is definitely the KVM bug:

  INFO: task syz-executor500:19706 blocked for more than 143 seconds.
        Not tainted 5.17.0-rc7-syzkaller-00020-gea4424be1688 #0
  "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
  task:syz-executor500 state:D stack:27048 pid:19706 ppid:  3644 flags:0x00000004
  Call Trace:
   <TASK>
   context_switch kernel/sched/core.c:4995 [inline]
   __schedule+0xa94/0x4910 kernel/sched/core.c:6304
   schedule+0xd2/0x260 kernel/sched/core.c:6377
   schedule_timeout+0x1db/0x2a0 kernel/time/timer.c:1857
   do_wait_for_common kernel/sched/completion.c:85 [inline]
   __wait_for_common+0x2af/0x360 kernel/sched/completion.c:106
   __synchronize_srcu+0x1f2/0x290 kernel/rcu/srcutree.c:930
   kvm_swap_active_memslots+0x410/0x800 arch/x86/kvm/../../../virt/kvm/kvm_main.c:1473
   kvm_activate_memslot arch/x86/kvm/../../../virt/kvm/kvm_main.c:1595 [inline]
   kvm_create_memslot arch/x86/kvm/../../../virt/kvm/kvm_main.c:1660 [inline]
   kvm_set_memslot+0xa67/0x1010 arch/x86/kvm/../../../virt/kvm/kvm_main.c:1772
   __kvm_set_memory_region+0xf02/0x11f0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:1914
   kvm_set_memory_region arch/x86/kvm/../../../virt/kvm/kvm_main.c:1927 [inline]
   kvm_vm_ioctl_set_memory_region arch/x86/kvm/../../../virt/kvm/kvm_main.c:1939 [inline]
   kvm_vm_ioctl+0x51a/0x22c0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:4492
   vfs_ioctl fs/ioctl.c:51 [inline]
   __do_sys_ioctl fs/ioctl.c:874 [inline]
   __se_sys_ioctl fs/ioctl.c:860 [inline]
   __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:860
   do_syscall_x64 arch/x86/entry/common.c:50 [inline]
   do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
   entry_SYSCALL_64_after_hwframe+0x44/0xae

But there are multiple other errors that are indeed not the KVM bug.