Hello,
The following program triggers WARNING in __x86_set_memory_region if
run in a loop:
https://gist.githubusercontent.com/dvyukov/efadb6b001717a896b0c281f85880988/raw/17dda56adba33020d8f3b89bd91363b60f49be24/gistfile1.txt
On commit 015ed9433be2b476ec7e2e6a9a411a56e3b5b035 (Nov 11).
WARNING: CPU: 3 PID: 11295 at arch/x86/kvm/x86.c:7910
__x86_set_memory_region+0x43e/0x4e0
Kernel panic - not syncing: panic_on_warn set ...
CPU: 3 PID: 11295 Comm: syz-executor Not tainted 4.9.0-rc4+ #41
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
ffff88006753fb10 ffffffff81c2f79b ffffffff83271fc0 ffff88006753fbe8
ffffffff8321a100 ffffffff81094c2e ffff88006753fbd8 ffffffff81548463
0000000041b58ab3 ffffffff837cd50d ffffffff815482ac ffffffff815490e9
Call Trace:
[< inline >] __dump_stack lib/dump_stack.c:15
[<ffffffff81c2f79b>] dump_stack+0xb3/0x118 lib/dump_stack.c:51
[<ffffffff81548463>] panic+0x1b7/0x3a3 kernel/panic.c:179
[<ffffffff81240014>] __warn+0x1c4/0x1e0 kernel/panic.c:542
[<ffffffff812401fc>] warn_slowpath_null+0x2c/0x40 kernel/panic.c:585
[<ffffffff81094c2e>] __x86_set_memory_region+0x43e/0x4e0
arch/x86/kvm/x86.c:7910
[<ffffffff81094d0e>] x86_set_memory_region+0x3e/0x60 arch/x86/kvm/x86.c:7922
[<ffffffff810b6a93>] kvm_arch_destroy_vm+0x523/0x620 arch/x86/kvm/x86.c:7939
[< inline >] kvm_destroy_vm
arch/x86/kvm/../../../virt/kvm/kvm_main.c:731
[<ffffffff810587ae>] kvm_put_kvm+0x40e/0x790
arch/x86/kvm/../../../virt/kvm/kvm_main.c:752
[<ffffffff81058c82>] kvm_vm_release+0x42/0x50
arch/x86/kvm/../../../virt/kvm/kvm_main.c:763
[<ffffffff81679239>] __fput+0x289/0x6f0 fs/file_table.c:208
[<ffffffff81679725>] ____fput+0x15/0x20 fs/file_table.c:244
[<ffffffff812a2999>] task_work_run+0xf9/0x170 kernel/task_work.c:116
[< inline >] tracehook_notify_resume include/linux/tracehook.h:191
[<ffffffff81003a26>] exit_to_usermode_loop+0x126/0x150
arch/x86/entry/common.c:160
[< inline >] prepare_exit_to_usermode arch/x86/entry/common.c:190
[<ffffffff81006060>] syscall_return_slowpath+0x1a0/0x1e0
arch/x86/entry/common.c:259
[<ffffffff831ebda2>] entry_SYSCALL_64_fastpath+0xc0/0xc2
Dumping ftrace buffer:
(ftrace buffer empty)
Kernel Offset: disabled
reboot: cpu_has_vmx: ecx=80a02021 1