linux/arch
Wanpeng Li da6d63a006 KVM: X86: hyper-v: Task srcu lock when accessing kvm_memslots()
WARNING: suspicious RCU usage
   5.13.0-rc1 #4 Not tainted
   -----------------------------
   ./include/linux/kvm_host.h:710 suspicious rcu_dereference_check() usage!

  other info that might help us debug this:

  rcu_scheduler_active = 2, debug_locks = 1
   1 lock held by hyperv_clock/8318:
    #0: ffffb6b8cb05a7d8 (&hv->hv_lock){+.+.}-{3:3}, at: kvm_hv_invalidate_tsc_page+0x3e/0xa0 [kvm]

  stack backtrace:
  CPU: 3 PID: 8318 Comm: hyperv_clock Not tainted 5.13.0-rc1 #4
  Call Trace:
   dump_stack+0x87/0xb7
   lockdep_rcu_suspicious+0xce/0xf0
   kvm_write_guest_page+0x1c1/0x1d0 [kvm]
   kvm_write_guest+0x50/0x90 [kvm]
   kvm_hv_invalidate_tsc_page+0x79/0xa0 [kvm]
   kvm_gen_update_masterclock+0x1d/0x110 [kvm]
   kvm_arch_vm_ioctl+0x2a7/0xc50 [kvm]
   kvm_vm_ioctl+0x123/0x11d0 [kvm]
   __x64_sys_ioctl+0x3ed/0x9d0
   do_syscall_64+0x3d/0x80
   entry_SYSCALL_64_after_hwframe+0x44/0xae

kvm_memslots() will be called by kvm_write_guest(), so we should take the srcu lock.

Fixes: e880c6ea5 (KVM: x86: hyper-v: Prevent using not-yet-updated TSC page by secondary CPUs)
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
Message-Id: <1621339235-11131-4-git-send-email-wanpengli@tencent.com>
Reviewed-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-05-27 07:45:53 -04:00
..
alpha Merge branch 'akpm' (patches from Andrew) 2021-05-07 00:34:51 -07:00
arc mm: drop redundant HAVE_ARCH_TRANSPARENT_HUGEPAGE 2021-05-05 11:27:25 -07:00
arm Kbuild updates for v5.13 (2nd) 2021-05-08 10:00:11 -07:00
arm64 KVM: arm64: Fix debug register indexing 2021-05-15 10:27:59 +01:00
csky arch/csky patches for 5.13-rc1 2021-05-03 12:58:31 -07:00
h8300 arch: rearrange headers inclusion order in asm/bitops for m68k, sh and h8300 2021-05-06 19:24:11 -07:00
hexagon Merge branch 'akpm' (patches from Andrew) 2021-05-07 00:34:51 -07:00
ia64 Merge branch 'akpm' (patches from Andrew) 2021-05-07 00:34:51 -07:00
m68k Kbuild updates for v5.13 (2nd) 2021-05-08 10:00:11 -07:00
microblaze tracing updates for 5.13 2021-05-03 11:19:54 -07:00
mips Kbuild updates for v5.13 (2nd) 2021-05-08 10:00:11 -07:00
nds32 tracing updates for 5.13 2021-05-03 11:19:54 -07:00
nios2 Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2021-05-02 09:14:01 -07:00
openrisc drivers/char: remove /dev/kmem for good 2021-05-07 00:26:34 -07:00
parisc Kbuild updates for v5.13 (2nd) 2021-05-08 10:00:11 -07:00
powerpc KVM: PPC: exit halt polling on need_resched() 2021-05-27 07:45:50 -04:00
riscv riscv: remove unused handle_exception symbol 2021-05-06 09:40:16 -07:00
s390 Merge branch 'akpm' (patches from Andrew) 2021-05-07 00:34:51 -07:00
sh Kbuild updates for v5.13 (2nd) 2021-05-08 10:00:11 -07:00
sparc Kbuild updates for v5.13 (2nd) 2021-05-08 10:00:11 -07:00
um Merge branch 'akpm' (patches from Andrew) 2021-05-07 00:34:51 -07:00
x86 KVM: X86: hyper-v: Task srcu lock when accessing kvm_memslots() 2021-05-27 07:45:53 -04:00
xtensa Kbuild updates for v5.13 (2nd) 2021-05-08 10:00:11 -07:00
.gitignore .gitignore: prefix local generated files with a slash 2021-05-02 00:43:35 +09:00
Kconfig Add Landlock, a new LSM from Mickaël Salaün <mic@linux.microsoft.com> 2021-05-01 18:50:44 -07:00