Re: kvm: WARNING in __x86_set_memory_region

From: Dmitry Vyukov
Date: Fri Jan 15 2016 - 12:13:56 EST


On Fri, Jan 8, 2016 at 4:55 PM, Dmitry Vyukov <dvyukov@xxxxxxxxxx> wrote:
> Hello,
>
> The following program triggers WARNING in __x86_set_memory_region:
>
> // autogenerated by syzkaller (http://github.com/google/syzkaller)
> #include <unistd.h>
> #include <sys/syscall.h>
> #include <string.h>
> #include <stdint.h>
>
> long r[8];
>
> int main()
> {
> memset(r, -1, sizeof(r));
> r[0] = syscall(SYS_mmap, 0x20000000ul, 0x1000ul, 0x3ul,
> 0x32ul, 0xfffffffffffffffful, 0x0ul);
> memcpy((void*)0x20000000, "\x2f\x64\x65\x76\x2f\x6b\x76\x6d", 8);
> r[2] = syscall(SYS_open, 0x20000000ul, 0x200ul, 0x0ul, 0, 0, 0);
> r[3] = syscall(SYS_ioctl, r[2], 0xae01ul, 0x0ul, 0, 0, 0);
> *(uint64_t*)0x20000000 = (uint64_t)0x440;
> r[5] = syscall(SYS_ioctl, r[3], 0xae47ul, 0x20000000ul, 0, 0, 0);
> *(uint64_t*)0x20000000 = (uint64_t)0x1;
> r[7] = syscall(SYS_ioctl, r[3], 0xae47ul, 0x20000000ul, 0, 0, 0);
> return 0;
> }
>
> ------------[ cut here ]------------
> WARNING: CPU: 3 PID: 7265 at arch/x86/kvm/x86.c:7703
> __x86_set_memory_region+0x4b9/0x500()
> Modules linked in:
> CPU: 3 PID: 7265 Comm: syz-executor Tainted: G W 4.4.0-rc8+ #211
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
> 00000000ffffffff ffff8800351d7720 ffffffff82907ccd 0000000000000000
> ffff880033f81780 ffffffff85ed4540 ffff8800351d7760 ffffffff8133f979
> ffffffff8103d8a9 ffffffff85ed4540 0000000000001e17 00000000000001fd
> Call Trace:
> [< inline >] __dump_stack lib/dump_stack.c:15
> [<ffffffff82907ccd>] dump_stack+0x6f/0xa2 lib/dump_stack.c:50
> [<ffffffff8133f979>] warn_slowpath_common+0xd9/0x140 kernel/panic.c:460
> [<ffffffff8133fba9>] warn_slowpath_null+0x29/0x30 kernel/panic.c:493
> [<ffffffff8103d8a9>] __x86_set_memory_region+0x4b9/0x500
> arch/x86/kvm/x86.c:7703
> [<ffffffff8103d92e>] x86_set_memory_region+0x3e/0x60 arch/x86/kvm/x86.c:7749
> [<ffffffff810fc0f9>] vmx_set_tss_addr+0x79/0x2a0 arch/x86/kvm/vmx.c:5101
> [< inline >] kvm_vm_ioctl_set_tss_addr arch/x86/kvm/x86.c:3477
> [<ffffffff8105a90b>] kvm_arch_vm_ioctl+0xecb/0x1db0 arch/x86/kvm/x86.c:3744
> [<ffffffff8101ff4c>] kvm_vm_ioctl+0x17c/0xf30
> arch/x86/kvm/../../../virt/kvm/kvm_main.c:2902
> [< inline >] vfs_ioctl fs/ioctl.c:43
> [<ffffffff817b66f1>] do_vfs_ioctl+0x681/0xe40 fs/ioctl.c:607
> [< inline >] SYSC_ioctl fs/ioctl.c:622
> [<ffffffff817b6f3f>] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:613
> [<ffffffff85e77af6>] entry_SYSCALL_64_fastpath+0x16/0x7a
> arch/x86/entry/entry_64.S:185
> ---[ end trace 6d1cb7e02f836554 ]---
>
> On commit b06f3a168cdcd80026276898fd1fee443ef25743 (Jan 6).

+ more kvm people