syzbot


memory leak in kvm_set_memslot

Status: internal: reported C repro on 2022/05/17 02:40
Reported-by: syzbot+@syzkaller.appspotmail.com
Fix commit: c87661f855c3 KVM: Free new dirty bitmap if creating a new memslot fails
Patched on: [ci-qemu-upstream ci-qemu-upstream-386 ci-qemu2-arm32 ci-qemu2-arm64 ci-qemu2-arm64-compat ci-qemu2-arm64-mte ci-upstream-bpf-kasan-gce ci-upstream-bpf-next-kasan-gce ci-upstream-gce-leak ci-upstream-kasan-gce ci-upstream-kasan-gce-386 ci-upstream-kasan-gce-root ci-upstream-kasan-gce-selinux-root ci-upstream-kasan-gce-smack-root ci-upstream-kmsan-gce ci-upstream-kmsan-gce-386 ci-upstream-linux-next-kasan-gce-root ci-upstream-net-kasan-gce ci-upstream-net-this-kasan-gce ci2-upstream-kcsan-gce ci2-upstream-usb], missing on: [ci-qemu2-riscv64]
First crash: 41d, last: 41d

Sample crash report:
executing program
BUG: memory leak
unreferenced object 0xffffc900003f5000 (size 4096):
  comm "syz-executor410", pid 3597, jiffies 4294945449 (age 13.410s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<ffffffff81512060>] __vmalloc_node_range+0xb40/0xbd0 mm/vmalloc.c:3195
    [<ffffffff81512239>] __vmalloc_node mm/vmalloc.c:3232 [inline]
    [<ffffffff81512239>] __vmalloc+0x49/0x50 mm/vmalloc.c:3246
    [<ffffffff814ab1e9>] __vmalloc_array mm/util.c:671 [inline]
    [<ffffffff814ab1e9>] __vcalloc+0x49/0x70 mm/util.c:694
    [<ffffffff8103dfed>] kvm_alloc_dirty_bitmap arch/x86/kvm/../../../virt/kvm/kvm_main.c:1319 [inline]
    [<ffffffff8103dfed>] kvm_prepare_memory_region arch/x86/kvm/../../../virt/kvm/kvm_main.c:1551 [inline]
    [<ffffffff8103dfed>] kvm_set_memslot+0x1bd/0x690 arch/x86/kvm/../../../virt/kvm/kvm_main.c:1782
    [<ffffffff8103eb49>] __kvm_set_memory_region+0x689/0x750 arch/x86/kvm/../../../virt/kvm/kvm_main.c:1949
    [<ffffffff810452b7>] kvm_set_memory_region arch/x86/kvm/../../../virt/kvm/kvm_main.c:1962 [inline]
    [<ffffffff810452b7>] kvm_vm_ioctl_set_memory_region arch/x86/kvm/../../../virt/kvm/kvm_main.c:1974 [inline]
    [<ffffffff810452b7>] kvm_vm_ioctl+0x377/0x13a0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:4528
    [<ffffffff815e41fc>] vfs_ioctl fs/ioctl.c:51 [inline]
    [<ffffffff815e41fc>] __do_sys_ioctl fs/ioctl.c:870 [inline]
    [<ffffffff815e41fc>] __se_sys_ioctl fs/ioctl.c:856 [inline]
    [<ffffffff815e41fc>] __x64_sys_ioctl+0xfc/0x140 fs/ioctl.c:856
    [<ffffffff84565f25>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
    [<ffffffff84565f25>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
    [<ffffffff84600068>] entry_SYSCALL_64_after_hwframe+0x44/0xae


Crashes (1):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-gce-leak 2022/05/17 02:39 upstream 42226c989789 744a39e2 .config log report syz C memory leak in kvm_set_memslot