Re: WARNING: kmalloc bug in kvm_page_track_create_memslot
From: Sean Christopherson
Date: Tue Aug 23 2022 - 20:16:28 EST
On Mon, Aug 22, 2022, 王海弛 wrote:
> The full log crash log are as follows:(also in the attach, crash.report)
> -----------------------------------------
> WARNING: CPU: 1 PID: 19519 at mm/util.c:597 kvmalloc_node+0x111/0x120 mm/util.c:597
> Modules linked in:
> CPU: 1 PID: 19519 Comm: syz-executor.0 Not tainted 5.15.0-rc5+ #6
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014
> RIP: 0010:kvmalloc_node+0x111/0x120 mm/util.c:597
> Code: 01 00 00 00 4c 89 e7 e8 7d 58 0d 00 49 89 c5 e9 69 ff ff ff e8 40 c5 d0 ff 41 89 ed 41 81 cd 00 20 01 00 eb 95 e8 2f c5 d0 ff <0f> 0b e9 4c ff ff ff 0f 1f 84 00 00 00 00 00 55 48 89 fd 53 e8 16
> RSP: 0018:ffffc90003907830 EFLAGS: 00010216
> RAX: 0000000000031766 RBX: 0000000000000000 RCX: 0000000000040000
> RDX: ffffc90003941000 RSI: ffff88802b6c8000 RDI: 0000000000000002
> RBP: 0000000000400dc0 R08: ffffffff81a68e11 R09: 000000007fffffff
> R10: 0000000000000007 R11: ffffed1026b86541 R12: 00000000a0000000
> R13: 0000000000000000 R14: 00000000ffffffff R15: 0000000000000000
> FS: 00007f526e4c7700(0000) GS:ffff888135c00000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 00007f9614442020 CR3: 0000000021c3c000 CR4: 0000000000752ee0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> PKRU: 55555554
> Call Trace:
> kvmalloc include/linux/mm.h:805 [inline]
> kvmalloc_array include/linux/mm.h:823 [inline]
> kvcalloc include/linux/mm.h:828 [inline]
> kvm_page_track_create_memslot+0x50/0x110 arch/x86/kvm/mmu/page_track.c:39
> kvm_alloc_memslot_metadata arch/x86/kvm/x86.c:11501 [inline]
> kvm_arch_prepare_memory_region+0x339/0x600 arch/x86/kvm/x86.c:11538
> kvm_set_memslot+0x16e/0x19f0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:1592
> __kvm_set_memory_region+0xc30/0x13d0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:1755
> kvm_set_memory_region+0x29/0x40 arch/x86/kvm/../../../virt/kvm/kvm_main.c:1776
> kvm_vm_ioctl_set_memory_region arch/x86/kvm/../../../virt/kvm/kvm_main.c:1788 [inline]
> kvm_vm_ioctl+0x507/0x23a0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:4363
> 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
This was fixed back in v5.18 by commit 37b2a6510a48 ("KVM: use __vcalloc for very
large allocations").