kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* KASAN: vmalloc-out-of-bounds Write in kvm_dev_ioctl_get_cpuid
@ 2019-12-04  4:15 syzbot
  2019-12-04  9:26 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: syzbot @ 2019-12-04  4:15 UTC (permalink / raw)
  To: bp, hpa, jmattson, joro, kvm, linux-kernel, mingo, pbonzini,
	rkrcmar, sean.j.christopherson, syzkaller-bugs, tglx, vkuznets,
	wanpengli, x86

Hello,

syzbot found the following crash on:

HEAD commit:    596cf45c Merge branch 'akpm' (patches from Andrew)
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=103acb7ae00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=8eb54eee6e6ca4a7
dashboard link: https://syzkaller.appspot.com/bug?extid=e3f4897236c4eeb8af4f
compiler:       gcc (GCC) 9.0.0 20181231 (experimental)
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=15b87c82e00000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=11250f36e00000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+e3f4897236c4eeb8af4f@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: vmalloc-out-of-bounds in __do_cpuid_func_emulated  
arch/x86/kvm/cpuid.c:323 [inline]
BUG: KASAN: vmalloc-out-of-bounds in do_cpuid_func arch/x86/kvm/cpuid.c:814  
[inline]
BUG: KASAN: vmalloc-out-of-bounds in do_cpuid_func arch/x86/kvm/cpuid.c:810  
[inline]
BUG: KASAN: vmalloc-out-of-bounds in kvm_dev_ioctl_get_cpuid+0xad7/0xb0b  
arch/x86/kvm/cpuid.c:891
Write of size 4 at addr ffffc90000d36050 by task syz-executor490/9767

CPU: 1 PID: 9767 Comm: syz-executor490 Not tainted 5.4.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
Call Trace:
  __dump_stack lib/dump_stack.c:77 [inline]
  dump_stack+0x197/0x210 lib/dump_stack.c:118
  print_address_description.constprop.0.cold+0x5/0x30b mm/kasan/report.c:374
  __kasan_report.cold+0x1b/0x41 mm/kasan/report.c:506
  kasan_report+0x12/0x20 mm/kasan/common.c:638
  __asan_report_store4_noabort+0x17/0x20 mm/kasan/generic_report.c:139
  __do_cpuid_func_emulated arch/x86/kvm/cpuid.c:323 [inline]
  do_cpuid_func arch/x86/kvm/cpuid.c:814 [inline]
  do_cpuid_func arch/x86/kvm/cpuid.c:810 [inline]
  kvm_dev_ioctl_get_cpuid+0xad7/0xb0b arch/x86/kvm/cpuid.c:891
  kvm_arch_dev_ioctl+0x300/0x4b0 arch/x86/kvm/x86.c:3387
  kvm_dev_ioctl+0x127/0x17d0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3593
  vfs_ioctl fs/ioctl.c:47 [inline]
  file_ioctl fs/ioctl.c:539 [inline]
  do_vfs_ioctl+0xdb6/0x13e0 fs/ioctl.c:726
  ksys_ioctl+0xab/0xd0 fs/ioctl.c:743
  __do_sys_ioctl fs/ioctl.c:750 [inline]
  __se_sys_ioctl fs/ioctl.c:748 [inline]
  __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:748
  do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
  entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x440159
Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 48 89 f8 48 89 f7  
48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff  
ff 0f 83 fb 13 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffd106332c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 0000000000440159
RDX: 0000000020000080 RSI: 00000000c008ae09 RDI: 0000000000000003
RBP: 00000000006ca018 R08: 0000000000000000 R09: 00000000004002c8
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000004019e0
R13: 0000000000401a70 R14: 0000000000000000 R15: 0000000000000000


Memory state around the buggy address:
  ffffc90000d35f00: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
  ffffc90000d35f80: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
> ffffc90000d36000: 00 00 00 00 00 00 00 00 00 00 f9 f9 f9 f9 f9 f9
                                                  ^
  ffffc90000d36080: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
  ffffc90000d36100: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
==================================================================


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: KASAN: vmalloc-out-of-bounds Write in kvm_dev_ioctl_get_cpuid
  2019-12-04  4:15 KASAN: vmalloc-out-of-bounds Write in kvm_dev_ioctl_get_cpuid syzbot
@ 2019-12-04  9:26 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2019-12-04  9:26 UTC (permalink / raw)
  To: syzbot, bp, hpa, jmattson, joro, kvm, linux-kernel, mingo,
	rkrcmar, sean.j.christopherson, syzkaller-bugs, tglx, vkuznets,
	wanpengli, x86

On 04/12/19 05:15, syzbot wrote:
> Hello,
> 
> syzbot found the following crash on:
> 
> HEAD commit:    596cf45c Merge branch 'akpm' (patches from Andrew)
> git tree:       upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=103acb7ae00000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=8eb54eee6e6ca4a7
> dashboard link:
> https://syzkaller.appspot.com/bug?extid=e3f4897236c4eeb8af4f
> compiler:       gcc (GCC) 9.0.0 20181231 (experimental)
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=15b87c82e00000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=11250f36e00000
> 
> IMPORTANT: if you fix the bug, please add the following tag to the commit:
> Reported-by: syzbot+e3f4897236c4eeb8af4f@syzkaller.appspotmail.com
> 
> ==================================================================
> BUG: KASAN: vmalloc-out-of-bounds in __do_cpuid_func_emulated
> arch/x86/kvm/cpuid.c:323 [inline]
> BUG: KASAN: vmalloc-out-of-bounds in do_cpuid_func
> arch/x86/kvm/cpuid.c:814 [inline]
> BUG: KASAN: vmalloc-out-of-bounds in do_cpuid_func
> arch/x86/kvm/cpuid.c:810 [inline]
> BUG: KASAN: vmalloc-out-of-bounds in kvm_dev_ioctl_get_cpuid+0xad7/0xb0b
> arch/x86/kvm/cpuid.c:891
> Write of size 4 at addr ffffc90000d36050 by task syz-executor490/9767
> 
> CPU: 1 PID: 9767 Comm: syz-executor490 Not tainted 5.4.0-syzkaller #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 01/01/2011
> Call Trace:
>  __dump_stack lib/dump_stack.c:77 [inline]
>  dump_stack+0x197/0x210 lib/dump_stack.c:118
>  print_address_description.constprop.0.cold+0x5/0x30b mm/kasan/report.c:374
>  __kasan_report.cold+0x1b/0x41 mm/kasan/report.c:506
>  kasan_report+0x12/0x20 mm/kasan/common.c:638
>  __asan_report_store4_noabort+0x17/0x20 mm/kasan/generic_report.c:139
>  __do_cpuid_func_emulated arch/x86/kvm/cpuid.c:323 [inline]
>  do_cpuid_func arch/x86/kvm/cpuid.c:814 [inline]
>  do_cpuid_func arch/x86/kvm/cpuid.c:810 [inline]
>  kvm_dev_ioctl_get_cpuid+0xad7/0xb0b arch/x86/kvm/cpuid.c:891
>  kvm_arch_dev_ioctl+0x300/0x4b0 arch/x86/kvm/x86.c:3387
>  kvm_dev_ioctl+0x127/0x17d0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3593
>  vfs_ioctl fs/ioctl.c:47 [inline]
>  file_ioctl fs/ioctl.c:539 [inline]
>  do_vfs_ioctl+0xdb6/0x13e0 fs/ioctl.c:726
>  ksys_ioctl+0xab/0xd0 fs/ioctl.c:743
>  __do_sys_ioctl fs/ioctl.c:750 [inline]
>  __se_sys_ioctl fs/ioctl.c:748 [inline]
>  __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:748
>  do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
>  entry_SYSCALL_64_after_hwframe+0x49/0xbe
> RIP: 0033:0x440159
> Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 48 89 f8 48 89
> f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01
> f0 ff ff 0f 83 fb 13 fc ff c3 66 2e 0f 1f 84 00 00 00 00
> RSP: 002b:00007ffd106332c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
> RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 0000000000440159
> RDX: 0000000020000080 RSI: 00000000c008ae09 RDI: 0000000000000003
> RBP: 00000000006ca018 R08: 0000000000000000 R09: 00000000004002c8
> R10: 0000000000000000 R11: 0000000000000246 R12: 00000000004019e0
> R13: 0000000000401a70 R14: 0000000000000000 R15: 0000000000000000
> 
> 
> Memory state around the buggy address:
>  ffffc90000d35f00: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
>  ffffc90000d35f80: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
>> ffffc90000d36000: 00 00 00 00 00 00 00 00 00 00 f9 f9 f9 f9 f9 f9
>                                                  ^
>  ffffc90000d36080: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
>  ffffc90000d36100: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
> ==================================================================
> 
> 
> ---
> This bug is generated by a bot. It may contain errors.
> See https://goo.gl/tpsmEJ for more information about syzbot.
> syzbot engineers can be reached at syzkaller@googlegroups.com.
> 
> syzbot will keep track of this bug report. See:
> https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
> syzbot can test patches for this bug, for details see:
> https://goo.gl/tpsmEJ#testing-patches
> 

Ouch, this is bad.  Sending a patch now.

Paolo


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-04  9:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-04  4:15 KASAN: vmalloc-out-of-bounds Write in kvm_dev_ioctl_get_cpuid syzbot
2019-12-04  9:26 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).