KASAN: stack-out-of-bounds Read in write_mmio

18 views
Skip to first unread message

syzbot

unread,
Dec 1, 2017, 6:19:04ā€ÆAM12/1/17
to h...@zytor.com, k...@vger.kernel.org, linux-...@vger.kernel.org, mi...@redhat.com, pbon...@redhat.com, rkr...@redhat.com, syzkall...@googlegroups.com, tg...@linutronix.de, x...@kernel.org
Hello,

syzkaller hit the following crash on
4fbd8d194f06c8a3fd2af1ce560ddb31f7ec8323
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/master
compiler: gcc (GCC) 7.1.1 20170620
.config is attached
Raw console output is attached.

Unfortunately, I don't have any reproducer for this bug yet.


device lo entered promiscuous mode
==================================================================
BUG: KASAN: stack-out-of-bounds in write_mmio+0x560/0x600
arch/x86/kvm/x86.c:4654
Read of size 8 at addr ffff8801c609f220 by task syz-executor6/6596

CPU: 0 PID: 6596 Comm: syz-executor6 Not tainted 4.15.0-rc1+ #196
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
print_address_description+0x73/0x250 mm/kasan/report.c:252
kasan_report_error mm/kasan/report.c:351 [inline]
kasan_report+0x25b/0x340 mm/kasan/report.c:409
__asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430
write_mmio+0x560/0x600 arch/x86/kvm/x86.c:4654
emulator_read_write_onepage+0x45a/0xea0 arch/x86/kvm/x86.c:4724
emulator_read_write+0xe7/0x540 arch/x86/kvm/x86.c:4773
emulator_write_emulated arch/x86/kvm/x86.c:4810 [inline]
emulator_fix_hypercall+0x14d/0x1b0 arch/x86/kvm/x86.c:6345
em_hypercall+0x5d/0x120 arch/x86/kvm/emulate.c:3719
x86_emulate_insn+0x55d/0x3cf0 arch/x86/kvm/emulate.c:5495
x86_emulate_instruction+0x411/0x1ca0 arch/x86/kvm/x86.c:5752
emulate_instruction arch/x86/include/asm/kvm_host.h:1164 [inline]
handle_invalid_guest_state arch/x86/kvm/vmx.c:6605 [inline]
vmx_handle_exit+0x6e3/0x1ce0 arch/x86/kvm/vmx.c:8824
vcpu_enter_guest arch/x86/kvm/x86.c:7065 [inline]
vcpu_run arch/x86/kvm/x86.c:7127 [inline]
kvm_arch_vcpu_ioctl_run+0x1d53/0x5d20 arch/x86/kvm/x86.c:7297
kvm_vcpu_ioctl+0x64c/0x1010 arch/x86/kvm/../../../virt/kvm/kvm_main.c:2551
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:00007f0ad1504c58 EFLAGS: 00000212 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000758020 RCX: 00000000004529d9
RDX: 0000000000000000 RSI: 000000000000ae80 RDI: 0000000000000017
RBP: 0000000000000230 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000212 R12: 00000000006f0520
R13: 00000000ffffffff R14: 00007f0ad15056d4 R15: 0000000000000000

The buggy address belongs to the page:
page:ffffea00071827c0 count:0 mapcount:0 mapping: (null) index:0x0
flags: 0x2fffc0000000000()
raw: 02fffc0000000000 0000000000000000 0000000000000000 00000000ffffffff
raw: 0000000000000000 0000000100000001 0000000000000000 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8801c609f100: f2 f2 f2 f2 00 f2 f2 f2 f3 f3 f3 f3 00 00 00 00
ffff8801c609f180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> ffff8801c609f200: f1 f1 f1 f1 03 f2 f2 f2 f3 f3 f3 f3 00 00 00 00
^
ffff8801c609f280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8801c609f300: 00 f1 f1 f1 f1 02 f2 f2 f2 f2 f2 f2 f2 00 f2 f2
==================================================================


---
This bug is generated by a dumb bot. It may contain errors.
See https://goo.gl/tpsmEJ for details.
Direct all questions to syzk...@googlegroups.com.
Please credit me with: Reported-by: syzbot <syzk...@googlegroups.com>

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
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.
config.txt
raw.log

syzbot

unread,
Dec 9, 2017, 4:15:02ā€ÆAM12/9/17
to h...@zytor.com, k...@vger.kernel.org, linux-...@vger.kernel.org, mi...@redhat.com, pbon...@redhat.com, rkr...@redhat.com, syzkall...@googlegroups.com, tg...@linutronix.de, x...@kernel.org
syzkaller has found reproducer for the following crash on
ad4dac17f9d563b9e34aab78a34293b10993e9b5
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.
C reproducer is attached
syzkaller reproducer is attached. See https://goo.gl/kgGztJ
for information about syzkaller reproducers


kvm: KVM_SET_TSS_ADDR need to be called before entering vcpu
==================================================================
BUG: KASAN: stack-out-of-bounds in write_mmio+0x560/0x600
arch/x86/kvm/x86.c:4669
Read of size 8 at addr ffff8801c4587220 by task syzkaller601256/3159

CPU: 1 PID: 3159 Comm: syzkaller601256 Not tainted
4.15.0-rc2-next-20171208+ #63
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
print_address_description+0x73/0x250 mm/kasan/report.c:252
kasan_report_error mm/kasan/report.c:351 [inline]
kasan_report+0x25b/0x340 mm/kasan/report.c:409
__asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430
write_mmio+0x560/0x600 arch/x86/kvm/x86.c:4669
emulator_read_write_onepage+0x45a/0xea0 arch/x86/kvm/x86.c:4739
emulator_read_write+0xe7/0x540 arch/x86/kvm/x86.c:4788
emulator_write_emulated arch/x86/kvm/x86.c:4825 [inline]
emulator_fix_hypercall+0x14d/0x1b0 arch/x86/kvm/x86.c:6349
em_hypercall+0x5d/0x120 arch/x86/kvm/emulate.c:3705
x86_emulate_insn+0x55d/0x3c20 arch/x86/kvm/emulate.c:5498
x86_emulate_instruction+0x411/0x1ad0 arch/x86/kvm/x86.c:5756
emulate_instruction arch/x86/include/asm/kvm_host.h:1177 [inline]
handle_exception+0x3d5/0xa20 arch/x86/kvm/vmx.c:5921
vmx_handle_exit+0x25d/0x1ce0 arch/x86/kvm/vmx.c:8887
vcpu_enter_guest arch/x86/kvm/x86.c:7068 [inline]
vcpu_run arch/x86/kvm/x86.c:7130 [inline]
kvm_arch_vcpu_ioctl_run+0x1836/0x5be0 arch/x86/kvm/x86.c:7300
kvm_vcpu_ioctl+0x64c/0x1010 arch/x86/kvm/../../../virt/kvm/kvm_main.c:2555
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:0x4435c9
RSP: 002b:00007fffdf34ced8 EFLAGS: 00000202 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00000000205b3000 RCX: 00000000004435c9
RDX: 0000000000000000 RSI: 000000000000ae80 RDI: 0000000000000005
RBP: 000000000000000b R08: 0000000000000000 R09: 0000000000000002
R10: 0000000000000012 R11: 0000000000000202 R12: 00000000205b7e00
R13: 00000000205b6e00 R14: 00000000205b7a00 R15: 00000000205b3000

The buggy address belongs to the page:
page:000000002e827842 count:0 mapcount:0 mapping: (null) index:0x0
flags: 0x2fffc0000000000()
raw: 02fffc0000000000 0000000000000000 0000000000000000 00000000ffffffff
raw: 0000000000000000 0000000100000001 0000000000000000 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8801c4587100: f2 f2 f2 f2 00 f2 f2 f2 f3 f3 f3 f3 00 00 00 00
ffff8801c4587180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> ffff8801c4587200: f1 f1 f1 f1 03 f2 f2 f2 f3 f3 f3 f3 00 00 00 00
^
ffff8801c4587280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8801c4587300: 00 f1 f1 f1 f1 02 f2 f2 f2 f2 f2 f2 f2 00 f2 f2
==================================================================

config.txt
raw.log
repro.txt
repro.c

Tianyu Lan

unread,
Dec 9, 2017, 6:39:06ā€ÆAM12/9/17
to syzbot, H. Peter Anvin, kvm, linux-kernel@vger kernel org, Ingo Molnar, Paolo Bonzini, Radim Krcmar, syzkall...@googlegroups.com, Thomas Gleixner, the arch/x86 maintainers
2017-12-09 17:15 GMT+08:00 syzbot
<bot+b19026412c772c86fc...@syzkaller.appspotmail.com>:
This issue seems to be as same as previous pop issue. I will have a look.

--
Best regards
Tianyu Lan

Wanpeng Li

unread,
Dec 11, 2017, 6:00:04ā€ÆAM12/11/17
to Tianyu Lan, syzbot, H. Peter Anvin, kvm, linux-kernel@vger kernel org, Ingo Molnar, Paolo Bonzini, Radim Krcmar, syzkall...@googlegroups.com, Thomas Gleixner, the arch/x86 maintainers
It is the *(u64 *)val in trace_kvm_mmio() causes the
stack-out-of-bounds, I will cook a patch soon.

Regards,
Wanpeng Li

Eric Biggers

unread,
Jan 26, 2018, 8:36:23ā€ÆPM1/26/18
to Wanpeng Li, Tianyu Lan, syzbot, H. Peter Anvin, kvm, linux-kernel@vger kernel org, Ingo Molnar, Paolo Bonzini, Radim Krcmar, syzkall...@googlegroups.com, Thomas Gleixner, the arch/x86 maintainers
No longer occurring, presumably fixed by:

#syz fix: KVM: Fix stack-out-of-bounds read in write_mmio
Reply all
Reply to author
Forward
0 new messages