general protection fault in kvm_coalesced_mmio_init

14 views
Skip to first unread message

syzbot

unread,
Nov 4, 2019, 1:41:09 AM11/4/19
to k...@vger.kernel.org, linux-...@vger.kernel.org, pbon...@redhat.com, rkr...@redhat.com, syzkall...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 9d234505 Merge tag 'hwmon-for-v5.4-rc6' of git://git.kerne..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1780f6a4e00000
kernel config: https://syzkaller.appspot.com/x/.config?x=cbbed3e8d4eb64bf
dashboard link: https://syzkaller.appspot.com/bug?extid=e27e7027eb2b80e44225
compiler: gcc (GCC) 9.0.0 20181231 (experimental)

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

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

kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] PREEMPT SMP KASAN
CPU: 0 PID: 19030 Comm: syz-executor.1 Not tainted 5.4.0-rc5+ #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
RIP: 0010:kvm_coalesced_mmio_init+0x67/0x120
arch/x86/kvm/../../../virt/kvm/coalesced_mmio.c:121
Code: 00 48 01 c3 48 89 fa 48 b8 00 00 00 00 80 88 ff ff 48 c1 fb 06 48 c1
ea 03 48 c1 e3 0c 48 01 c3 48 b8 00 00 00 00 00 fc ff df <80> 3c 02 00 0f
85 9a 00 00 00 49 89 9c 24 d8 96 00 00 48 c7 c2 60
RSP: 0018:ffff88808e5cfc08 EFLAGS: 00010286
RAX: dffffc0000000000 RBX: ffff88809a815000 RCX: ffffc90008156000
RDX: 00000000000012db RSI: ffffffff8108569c RDI: 00000000000096d8
RBP: ffff88808e5cfc18 R08: 0000000000000000 R09: ffffed1015d06b75
R10: ffffed1015d06b74 R11: ffff8880ae835ba3 R12: 0000000000000000
R13: dffffc0000000000 R14: ffffc90001921000 R15: ffff88805bf80000
FS: 00007f1e8b8a5700(0000) GS:ffff8880ae800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020800000 CR3: 0000000097aee000 CR4: 00000000001406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
kvm_dev_ioctl_create_vm arch/x86/kvm/../../../virt/kvm/kvm_main.c:3448
[inline]
kvm_dev_ioctl+0x81e/0x1610 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3496
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:509 [inline]
do_vfs_ioctl+0xdb6/0x13e0 fs/ioctl.c:696
ksys_ioctl+0xab/0xd0 fs/ioctl.c:713
__do_sys_ioctl fs/ioctl.c:720 [inline]
__se_sys_ioctl fs/ioctl.c:718 [inline]
__x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718
do_syscall_64+0xfa/0x760 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x459f49
Code: ad b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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 7b b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f1e8b8a4c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000459f49
RDX: 0000000000000000 RSI: 000000000000ae01 RDI: 0000000000000003
RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f1e8b8a56d4
R13: 00000000004c30a8 R14: 00000000004d7018 R15: 00000000ffffffff
Modules linked in:
---[ end trace bc86b75fc185a9a9 ]---
RIP: 0010:kvm_coalesced_mmio_init+0x67/0x120
arch/x86/kvm/../../../virt/kvm/coalesced_mmio.c:121
Code: 00 48 01 c3 48 89 fa 48 b8 00 00 00 00 80 88 ff ff 48 c1 fb 06 48 c1
ea 03 48 c1 e3 0c 48 01 c3 48 b8 00 00 00 00 00 fc ff df <80> 3c 02 00 0f
85 9a 00 00 00 49 89 9c 24 d8 96 00 00 48 c7 c2 60
RSP: 0018:ffff88808e5cfc08 EFLAGS: 00010286
RAX: dffffc0000000000 RBX: ffff88809a815000 RCX: ffffc90008156000
RDX: 00000000000012db RSI: ffffffff8108569c RDI: 00000000000096d8
RBP: ffff88808e5cfc18 R08: 0000000000000000 R09: ffffed1015d06b75
R10: ffffed1015d06b74 R11: ffff8880ae835ba3 R12: 0000000000000000
R13: dffffc0000000000 R14: ffffc90001921000 R15: ffff88805bf80000
FS: 00007f1e8b8a5700(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fbe165b8330 CR3: 0000000097aee000 CR4: 00000000001406e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400


---
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 syzk...@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
Nov 10, 2019, 8:56:09 AM11/10/19
to k...@vger.kernel.org, linux-...@vger.kernel.org, pbon...@redhat.com, rkr...@redhat.com, syzkall...@googlegroups.com
syzbot has found a reproducer for the following crash on:

HEAD commit: 00aff683 Merge tag 'for-5.4-rc6-tag' of git://git.kernel.o..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1777fb52e00000
kernel config: https://syzkaller.appspot.com/x/.config?x=896c87b73c6fcda6
dashboard link: https://syzkaller.appspot.com/bug?extid=e27e7027eb2b80e44225
compiler: clang version 9.0.0 (/home/glider/llvm/clang
80fee25776c2fb61e74c1ecb1a523375c2500b69)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17ed65aae00000

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

kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] PREEMPT SMP KASAN
CPU: 0 PID: 20263 Comm: syz-executor.2 Not tainted 5.4.0-rc6+ #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
RIP: 0010:kvm_coalesced_mmio_init+0x59/0xf0
arch/x86/kvm/../../../virt/kvm/coalesced_mmio.c:121
Code: 00 00 00 fc ff df e8 46 7d 6b 00 48 c1 e3 06 49 be 00 00 00 00 80 08
05 00 49 01 de 49 8d bf d8 96 00 00 48 89 f8 48 c1 e8 03 <42> 80 3c 20 00
74 05 e8 bb bb a4 00 4d 89 b7 d8 96 00 00 49 8d bf
RSP: 0018:ffff888091647d10 EFLAGS: 00010206
RAX: 00000000000012db RBX: fffa80009cb1b000 RCX: ffff8880a42d21c0
RDX: 0000000000000000 RSI: 00000000ffffffff RDI: 00000000000096d8
RBP: ffff888091647d30 R08: ffffffff83486eda R09: ffffed1015d46b05
R10: ffffed1015d46b05 R11: 0000000000000000 R12: dffffc0000000000
R13: 0000000000000000 R14: ffff88809cb1b000 R15: 0000000000000000
FS: 00007fb51eb61700(0000) GS:ffff8880aea00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fa986fb7000 CR3: 000000009c69d000 CR4: 00000000001426f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
kvm_dev_ioctl_create_vm arch/x86/kvm/../../../virt/kvm/kvm_main.c:3448
[inline]
kvm_dev_ioctl+0x18fa/0x1fd0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3496
do_vfs_ioctl+0x744/0x1730 fs/ioctl.c:46
ksys_ioctl fs/ioctl.c:713 [inline]
__do_sys_ioctl fs/ioctl.c:720 [inline]
__se_sys_ioctl fs/ioctl.c:718 [inline]
__x64_sys_ioctl+0xe3/0x120 fs/ioctl.c:718
do_syscall_64+0xf7/0x1c0 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x45a219
Code: ad b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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 7b b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fb51eb60c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 000000000045a219
RDX: 0000000000000000 RSI: 000000000000ae01 RDI: 0000000000000004
RBP: 000000000075bfc8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fb51eb616d4
R13: 00000000004c348b R14: 00000000004d7708 R15: 00000000ffffffff
Modules linked in:
---[ end trace 15ab0f35a80c9e5d ]---
RIP: 0010:kvm_coalesced_mmio_init+0x59/0xf0
arch/x86/kvm/../../../virt/kvm/coalesced_mmio.c:121
Code: 00 00 00 fc ff df e8 46 7d 6b 00 48 c1 e3 06 49 be 00 00 00 00 80 08
05 00 49 01 de 49 8d bf d8 96 00 00 48 89 f8 48 c1 e8 03 <42> 80 3c 20 00
74 05 e8 bb bb a4 00 4d 89 b7 d8 96 00 00 49 8d bf
RSP: 0018:ffff888091647d10 EFLAGS: 00010206
RAX: 00000000000012db RBX: fffa80009cb1b000 RCX: ffff8880a42d21c0
RDX: 0000000000000000 RSI: 00000000ffffffff RDI: 00000000000096d8
RBP: ffff888091647d30 R08: ffffffff83486eda R09: ffffed1015d46b05
R10: ffffed1015d46b05 R11: 0000000000000000 R12: dffffc0000000000
R13: 0000000000000000 R14: ffff88809cb1b000 R15: 0000000000000000
FS: 00007fb51eb61700(0000) GS:ffff8880aeb00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000625208 CR3: 000000009c69d000 CR4: 00000000001426e0

syzbot

unread,
Nov 10, 2019, 1:22:01 PM11/10/19
to jmat...@google.com, jun...@google.com, k...@vger.kernel.org, linux-...@vger.kernel.org, pbon...@redhat.com, rkr...@redhat.com, syzkall...@googlegroups.com
syzbot has bisected this bug to:

commit 9121923c457d1d8667a6e3a67302c29e5c5add6b
Author: Jim Mattson <jmat...@google.com>
Date: Thu Oct 24 23:03:26 2019 +0000

kvm: Allocate memslots and buses before calling kvm_arch_init_vm

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=13eaf7ece00000
start commit: 00aff683 Merge tag 'for-5.4-rc6-tag' of git://git.kernel.o..
git tree: upstream
final crash: https://syzkaller.appspot.com/x/report.txt?x=101af7ece00000
console output: https://syzkaller.appspot.com/x/log.txt?x=17eaf7ece00000
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17ed65aae00000

Reported-by: syzbot+e27e70...@syzkaller.appspotmail.com
Fixes: 9121923c457d ("kvm: Allocate memslots and buses before calling
kvm_arch_init_vm")

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

Wayne Bai

unread,
Mar 22, 2024, 6:53:46 AMMar 22
to syzkaller-bugs
please test the following patch

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/ 00453419575d6b4f5ce0f370da9421cf5253f103

diff --git a/arch/x86/kvm/../../../virt/kvm/coalesced_mmio.c b/arch/x86/kvm/../../../virt/kvm/coalesced_mmio.c
index 765056d3b883c..24e8cb63f4976 100644
--- a/arch/x86/kvm/../../../virt/kvm/coalesced_mmio.c
+++ b/arch/x86/kvm/../../../virt/kvm/coalesced_mmio.c
@@ -118,16 +118,13 @@ int kvm_coalesced_mmio_init(struct kvm *kvm)
 
  ret = -ENOMEM;
  page = alloc_page(GFP_KERNEL | __GFP_ZERO);
+ if (!page)
+ return ret;
 
- if (!page)
- goto out_err;
-
  ret = 0;
  kvm->coalesced_mmio_ring = page_address(page);
 
  spin_lock_init(&kvm->ring_lock);
- INIT_LIST_HEAD(&kvm->coalesced_zones);
 
-out_err:
  return ret;
 }

Reply all
Reply to author
Forward
0 new messages