WARNING in free_loaded_vmcs (3)

Status: upstream: reported C repro on 2022/01/24 15:33
Fix commit: f7e570780efc KVM: x86: Forcibly leave nested virt when SMM state is toggled
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-arm64 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-fs ci2-upstream-kcsan-gce ci2-upstream-usb], missing on: [ci-qemu2-riscv64]
First crash: 379d, last: 379d

Cause bisection: the issue happens on the oldest tested release (bisect log)
Crash: WARNING in free_loaded_vmcs (log)
Repro: C syz .config
similar bugs (3):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream WARNING in free_loaded_vmcs (2) syz done 5 1617d 1638d 12/24 fixed on 2019/04/02 11:50
linux-4.19 WARNING in free_loaded_vmcs C error 2 380d 381d 0/1 upstream: reported C repro on 2022/01/22 18:03
upstream WARNING in free_loaded_vmcs C 170 1896d 1904d 4/24 fixed on 2018/01/25 08:31

Sample crash report:
------------[ cut here ]------------
WARNING: CPU: 0 PID: 3606 at arch/x86/kvm/vmx/vmx.c:2665 free_loaded_vmcs arch/x86/kvm/vmx/vmx.c:2665 [inline]
WARNING: CPU: 0 PID: 3606 at arch/x86/kvm/vmx/vmx.c:2665 free_loaded_vmcs+0x158/0x1a0 arch/x86/kvm/vmx/vmx.c:2656
Modules linked in:
CPU: 1 PID: 3606 Comm: syz-executor725 Not tainted 5.17.0-rc1-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:free_loaded_vmcs arch/x86/kvm/vmx/vmx.c:2665 [inline]
RIP: 0010:free_loaded_vmcs+0x158/0x1a0 arch/x86/kvm/vmx/vmx.c:2656
Code: 81 e8 bc 8c 4c 00 48 89 da 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 80 3c 02 00 75 49 48 8b 2b e9 25 ff ff ff e8 38 17 58 00 <0f> 0b eb b3 e8 8f 4d 9f 00 e9 f7 fe ff ff 48 89 df e8 92 4d 9f 00
RSP: 0018:ffffc90001d2f890 EFLAGS: 00010293
RAX: 0000000000000000 RBX: ffff888079c1a2e8 RCX: 0000000000000000
RDX: ffff888021b65700 RSI: ffffffff81204388 RDI: ffff888079c1a2f0
RBP: ffff88807594d000 R08: 0000000000000001 R09: 0000000000000001
R10: ffffffff817ea048 R11: 0000000000000001 R12: 0000000000000000
R13: ffff888079c18000 R14: 0000000000000003 R15: ffffc90001d2f918
FS:  0000000000000000(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fc975b8a328 CR3: 000000007f686000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 kvm_arch_vcpu_destroy+0x72/0x2f0 arch/x86/kvm/x86.c:11123
 kvm_vcpu_destroy arch/x86/kvm/../../../virt/kvm/kvm_main.c:441 [inline]
 kvm_destroy_vcpus+0x11f/0x290 arch/x86/kvm/../../../virt/kvm/kvm_main.c:460
 kvm_free_vcpus arch/x86/kvm/x86.c:11564 [inline]
 kvm_arch_destroy_vm+0x2e8/0x470 arch/x86/kvm/x86.c:11676
 kvm_destroy_vm arch/x86/kvm/../../../virt/kvm/kvm_main.c:1217 [inline]
 kvm_put_kvm+0x4fa/0xb00 arch/x86/kvm/../../../virt/kvm/kvm_main.c:1250
 kvm_vm_release+0x3f/0x50 arch/x86/kvm/../../../virt/kvm/kvm_main.c:1273
 __fput+0x286/0x9f0 fs/file_table.c:311
 task_work_run+0xdd/0x1a0 kernel/task_work.c:164
 exit_task_work include/linux/task_work.h:32 [inline]
 do_exit+0xb29/0x2a30 kernel/exit.c:806
 do_group_exit+0xd2/0x2f0 kernel/exit.c:935
 get_signal+0x4b0/0x28c0 kernel/signal.c:2862
 arch_do_signal_or_restart+0x2a9/0x1c40 arch/x86/kernel/signal.c:868
 handle_signal_work kernel/entry/common.c:148 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:172 [inline]
 exit_to_user_mode_prepare+0x17d/0x290 kernel/entry/common.c:207
 __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline]
 syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:300
 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86
RIP: 0033:0x7fc975b35729
Code: Unable to access opcode bytes at RIP 0x7fc975b356ff.
RSP: 002b:00007fc975ae5308 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 00007fc975bbe408 RCX: 00007fc975b35729
RDX: 0000000000000000 RSI: 0000000000000080 RDI: 00007fc975bbe408
RBP: 00007fc975bbe400 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fc975bbe40c
R13: 00007fc975b8b0b8 R14: 6d766b2f7665642f R15: 0000000000022000

Crashes (2):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci-upstream-kasan-gce 2022/01/24 07:57 upstream dd81e1c7d5fb 214351e1 .config console log report syz C WARNING in free_loaded_vmcs
ci-upstream-kasan-gce 2022/01/24 06:18 upstream dd81e1c7d5fb 214351e1 .config console log report syz C WARNING in free_loaded_vmcs
* Struck through repros no longer work on HEAD.