Re: WARNING in x86_emulate_insn

From: Wanpeng Li
Date: Thu Dec 07 2017 - 02:52:28 EST


2017-12-07 15:49 GMT+08:00 èåå <lantianyu1986@xxxxxxxxx>:
> Hi Dmitry:
> I tried to reproduce the issue via syz-execprog with attached
> reproducer on latest linux-next but it causes VM-entry failure due to
> invalid guest state...

Because rflags is 0 in his program. You can set ept=0 and retry.

Regards,
Wanpeng Li

>
> 2017-12-07 14:25 GMT+08:00 Dmitry Vyukov <dvyukov@xxxxxxxxxx>:
>> On Thu, Dec 7, 2017 at 1:44 AM, Wanpeng Li <kernellwp@xxxxxxxxx> wrote:
>>> 2017-12-06 4:07 GMT+08:00 syzbot
>>> <bot+75375385991b4f8c599704a10849863c586ea284@xxxxxxxxxxxxxxxxxxxxxxxxx>:
>>>> Hello,
>>>>
>>>> syzkaller hit the following crash on
>>>> fb20eb9d798d2f4c1a75b7fe981d72dfa8d7270d
>>>> git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/master
>>>> compiler: gcc (GCC) 7.1.1 20170620
>>>> .config is attached
>>>> Raw console output is attached.
>>>>
>>>> syzkaller reproducer is attached. See https://goo.gl/kgGztJ
>>>> for information about syzkaller reproducers
>>>>
>>>
>>> Is there a c program to reproduce?
>>
>> No, syzbot does not hide reproducers. See the referenced doc for
>> details: https://github.com/google/syzkaller/blob/master/docs/syzbot.md#syzkaller-reproducers
>>
>>
>>> Regards,
>>> Wanpeng Li
>>>
>>>>
>>>> kvm: KVM_SET_TSS_ADDR need to be called before entering vcpu
>>>> WARNING: CPU: 1 PID: 3526 at arch/x86/kvm/emulate.c:5654
>>>> x86_emulate_insn+0xd01/0x3cf0 arch/x86/kvm/emulate.c:5654
>>>> Kernel panic - not syncing: panic_on_warn set ...
>>>>
>>>> CPU: 1 PID: 3526 Comm: syz-executor4 Not tainted 4.15.0-rc1-next-20171201+
>>>> #57
>>>> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
>>>> Google 01/01/2011
>>>> Call Trace:
>>>> __dump_stack lib/dump_stack.c:17 [inline]
>>>> dump_stack+0x194/0x257 lib/dump_stack.c:53
>>>> panic+0x1e4/0x41c kernel/panic.c:183
>>>> __warn+0x1dc/0x200 kernel/panic.c:547
>>>> report_bug+0x211/0x2d0 lib/bug.c:184
>>>> fixup_bug.part.11+0x37/0x80 arch/x86/kernel/traps.c:177
>>>> fixup_bug arch/x86/kernel/traps.c:246 [inline]
>>>> do_error_trap+0x2d7/0x3e0 arch/x86/kernel/traps.c:295
>>>> do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:314
>>>> invalid_op+0x22/0x40 arch/x86/entry/entry_64.S:1066
>>>> RIP: 0010:x86_emulate_insn+0xd01/0x3cf0 arch/x86/kvm/emulate.c:5654
>>>> RSP: 0018:ffff8801d0fff3e8 EFLAGS: 00010293
>>>> RAX: ffff8801d17b60c0 RBX: 1ffff1003a1ffe86 RCX: ffffffff81154351
>>>> RDX: 0000000000000000 RSI: ffffffffffffffff RDI: ffff8801d0b5b5c8
>>>> RBP: ffff8801d0fff4f8 R08: ffff8801d0b58d80 R09: ffffffff85224da0
>>>> R10: 0000000000000001 R11: ffffed003a16b6d4 R12: 00000000000000ff
>>>> R13: ffff8801d0b5b5a0 R14: 0000000000000002 R15: ffff8801d0b5b6c3
>>>> x86_emulate_instruction+0x411/0x1ad0 arch/x86/kvm/x86.c:5771
>>>> emulate_instruction arch/x86/include/asm/kvm_host.h:1164 [inline]
>>>> complete_emulated_io arch/x86/kvm/x86.c:7190 [inline]
>>>> complete_emulated_pio+0xdd/0x1b0 arch/x86/kvm/x86.c:7201
>>>> kvm_arch_vcpu_ioctl_run+0x2db2/0x5c60 arch/x86/kvm/x86.c:7305
>>>> kvm_vcpu_ioctl+0x64c/0x1010 arch/x86/kvm/../../../virt/kvm/kvm_main.c:2574
>>>> vfs_ioctl fs/ioctl.c:46 [inline]
>>>> do_vfs_ioctl+0x1b1/0x1530 fs/ioctl.c:686
>>>> SYSC_ioctl fs/ioctl.c:701 [inline]
>>>> SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692
>>>> entry_SYSCALL_64_fastpath+0x1f/0x96
>>>> RIP: 0033:0x4529d9
>>>> RSP: 002b:00007f6b6b2d5c58 EFLAGS: 00000212 ORIG_RAX: 0000000000000010
>>>> RAX: ffffffffffffffda RBX: 0000000000758020 RCX: 00000000004529d9
>>>> RDX: 0000000000000000 RSI: 000000000000ae80 RDI: 0000000000000004
>>>> RBP: 000000000000039b R08: 0000000000000000 R09: 0000000000000000
>>>> R10: 0000000000000000 R11: 0000000000000212 R12: 00000000006f2728
>>>> R13: 00000000ffffffff R14: 00007f6b6b2d66d4 R15: 0000000000000000
>>>> Dumping ftrace buffer:
>>>> (ftrace buffer empty)
>>>> Kernel Offset: disabled
>>>> Rebooting in 86400 seconds..
>>>>
>>>>
>>>> ---
>>>> This bug is generated by a dumb bot. It may contain errors.
>>>> See https://goo.gl/tpsmEJ for details.
>>>> Direct all questions to syzkaller@xxxxxxxxxxxxxxxxx
>>>> Please credit me with: Reported-by: syzbot <syzkaller@xxxxxxxxxxxxxxxx>
>>>>
>>>> syzbot will keep track of this bug report.
>>>> Once a fix for this bug is committed, please reply to this email with:
>>>> #syz fix: exact-commit-title
>>>> If you want to test a patch for this bug, please reply with:
>>>> #syz test: git://repo/address.git branch
>>>> and provide the patch inline or as an attachment.
>>>> To mark this as a duplicate of another syzbot report, please reply with:
>>>> #syz dup: exact-subject-of-another-report
>>>> If it's a one-off invalid bug report, please reply with:
>>>> #syz invalid
>>>> Note: if the crash happens again, it will cause creation of a new bug
>>>> report.
>>>> Note: all commands must start from beginning of the line in the email body.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups "syzkaller-bugs" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an email to syzkaller-bugs+unsubscribe@xxxxxxxxxxxxxxxxx
>>> To view this discussion on the web visit https://groups.google.com/d/msgid/syzkaller-bugs/CANRm%2BCw6u-Tvq6M%2B8hFm9UmxyTWsqvrm5L9bzfoTAvEsaeC1-w%40mail.gmail.com.
>>> For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> Best regards
> Tianyu Lan