[syzbot] KASAN: vmalloc-out-of-bounds Read in kvm_put_kvm

21 views
Skip to first unread message

syzbot

unread,
Aug 20, 2022, 11:58:34 AM8/20/22
to k...@vger.kernel.org, linux-...@vger.kernel.org, pbon...@redhat.com, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 7ebfc85e2cd7 Merge tag 'net-6.0-rc1' of git://git.kernel.o..
git tree: upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=124e1715080000
kernel config: https://syzkaller.appspot.com/x/.config?x=924833c12349a8c0
dashboard link: https://syzkaller.appspot.com/bug?extid=ee478a0237db20ef61f1
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1403627b080000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1672d823080000

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

L1TF CPU bug present and SMT on, data leak possible. See CVE-2018-3646 and https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/l1tf.html for details.
==================================================================
BUG: KASAN: vmalloc-out-of-bounds in __list_del_entry_valid+0xf2/0x110 lib/list_debug.c:59
Read of size 8 at addr ffffc900039da340 by task syz-executor260/3614

CPU: 0 PID: 3614 Comm: syz-executor260 Not tainted 5.19.0-syzkaller-13930-g7ebfc85e2cd7 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:317 [inline]
print_report.cold+0x59/0x719 mm/kasan/report.c:433
kasan_report+0xb1/0x1e0 mm/kasan/report.c:495
__list_del_entry_valid+0xf2/0x110 lib/list_debug.c:59
__list_del_entry include/linux/list.h:134 [inline]
list_del include/linux/list.h:148 [inline]
kvm_destroy_vm arch/x86/kvm/../../../virt/kvm/kvm_main.c:1290 [inline]
kvm_put_kvm+0x130/0xb70 arch/x86/kvm/../../../virt/kvm/kvm_main.c:1352
kvm_vm_release+0x3f/0x50 arch/x86/kvm/../../../virt/kvm/kvm_main.c:1375
__fput+0x277/0x9d0 fs/file_table.c:320
task_work_run+0xdd/0x1a0 kernel/task_work.c:177
exit_task_work include/linux/task_work.h:38 [inline]
do_exit+0xad5/0x29b0 kernel/exit.c:795
do_group_exit+0xd2/0x2f0 kernel/exit.c:925
__do_sys_exit_group kernel/exit.c:936 [inline]
__se_sys_exit_group kernel/exit.c:934 [inline]
__x64_sys_exit_group+0x3a/0x50 kernel/exit.c:934
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fd7dbdc3d39
Code: Unable to access opcode bytes at RIP 0x7fd7dbdc3d0f.
RSP: 002b:00007ffce9fd1d88 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 00007fd7dbe383f0 RCX: 00007fd7dbdc3d39
RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000000
RBP: 0000000000000000 R08: ffffffffffffffc0 R09: 0000000000000001
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fd7dbe383f0
R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000001
</TASK>

Memory state around the buggy address:
ffffc900039da200: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
ffffc900039da280: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
>ffffc900039da300: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
^
ffffc900039da380: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
ffffc900039da400: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
==================================================================


---
This report 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 issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

Hillf Danton

unread,
Aug 20, 2022, 9:33:47 PM8/20/22
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Date: Sat, 20 Aug 2022 08:58:33 -0700
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 7ebfc85e2cd7 Merge tag 'net-6.0-rc1' of git://git.kernel.o..
> git tree: upstream
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=124e1715080000
> kernel config: https://syzkaller.appspot.com/x/.config?x=924833c12349a8c0
> dashboard link: https://syzkaller.appspot.com/bug?extid=ee478a0237db20ef61f1
> compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1403627b080000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1672d823080000

Delete kvm->vm_list in err rollback.

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 7ebfc85e2cd7

--- x/virt/kvm/kvm_main.c
+++ k/virt/kvm/kvm_main.c
@@ -1245,6 +1245,9 @@ out_err_mmu_notifier:
if (kvm->mmu_notifier.ops)
mmu_notifier_unregister(&kvm->mmu_notifier, current->mm);
#endif
+ mutex_lock(&kvm_lock);
+ list_del(&kvm->vm_list);
+ mutex_unlock(&kvm_lock);
out_err_no_mmu_notifier:
hardware_disable_all();
out_err_no_disable:
--

syzbot

unread,
Aug 21, 2022, 5:53:12 AM8/21/22
to hda...@sina.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
KASAN: vmalloc-out-of-bounds Read in notifier_chain_register

==================================================================
BUG: KASAN: vmalloc-out-of-bounds in notifier_chain_register+0x1bd/0x210 kernel/notifier.c:32
Read of size 4 at addr ffffc90004f73bf0 by task syz-executor.0/4102

CPU: 1 PID: 4102 Comm: syz-executor.0 Not tainted 5.19.0-syzkaller-13930-g7ebfc85e2cd7-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:317 [inline]
print_report.cold+0x59/0x719 mm/kasan/report.c:433
kasan_report+0xb1/0x1e0 mm/kasan/report.c:495
notifier_chain_register+0x1bd/0x210 kernel/notifier.c:32
__blocking_notifier_chain_register kernel/notifier.c:266 [inline]
blocking_notifier_chain_register+0x6f/0xc0 kernel/notifier.c:284
kvm_init_pm_notifier arch/x86/kvm/../../../virt/kvm/kvm_main.c:938 [inline]
kvm_create_vm arch/x86/kvm/../../../virt/kvm/kvm_main.c:1223 [inline]
kvm_dev_ioctl_create_vm arch/x86/kvm/../../../virt/kvm/kvm_main.c:4913 [inline]
kvm_dev_ioctl+0x1060/0x1e80 arch/x86/kvm/../../../virt/kvm/kvm_main.c:4960
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:870 [inline]
__se_sys_ioctl fs/ioctl.c:856 [inline]
__x64_sys_ioctl+0x193/0x200 fs/ioctl.c:856
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fe58a889279
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fe58bac9168 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007fe58a99bf80 RCX: 00007fe58a889279
RDX: 0000000000000000 RSI: 000000000000ae01 RDI: 0000000000000003
RBP: 00007fe58a8e3189 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fffa66a9c1f R14: 00007fe58bac9300 R15: 0000000000022000
</TASK>

Memory state around the buggy address:
ffffc90004f73a80: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
ffffc90004f73b00: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
>ffffc90004f73b80: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
^
ffffc90004f73c00: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
ffffc90004f73c80: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
==================================================================


Tested on:

commit: 7ebfc85e Merge tag 'net-6.0-rc1' of git://git.kernel.o..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=1517a8b5080000
kernel config: https://syzkaller.appspot.com/x/.config?x=924833c12349a8c0
dashboard link: https://syzkaller.appspot.com/bug?extid=ee478a0237db20ef61f1
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
patch: https://syzkaller.appspot.com/x/patch.diff?x=12118e5b080000

Hillf Danton

unread,
Aug 21, 2022, 6:17:05 AM8/21/22
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Date: Sat, 20 Aug 2022 08:58:33 -0700
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 7ebfc85e2cd7 Merge tag 'net-6.0-rc1' of git://git.kernel.o..
> git tree: upstream
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=124e1715080000
> kernel config: https://syzkaller.appspot.com/x/.config?x=924833c12349a8c0
> dashboard link: https://syzkaller.appspot.com/bug?extid=ee478a0237db20ef61f1
> compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1403627b080000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1672d823080000

Delete kvm->vm_list in err rollback.

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 7ebfc85e2cd7

--- x/virt/kvm/kvm_main.c
+++ k/virt/kvm/kvm_main.c
@@ -1229,7 +1229,7 @@ static struct kvm *kvm_create_vm(unsigne
*/
if (!try_module_get(kvm_chardev_ops.owner)) {
r = -ENODEV;
- goto out_err_mmu_notifier;
+ goto out_err_pm_notifier;
}

r = kvm_create_vm_debugfs(kvm, fdname);
@@ -1240,6 +1240,11 @@ static struct kvm *kvm_create_vm(unsigne

out_err:
module_put(kvm_chardev_ops.owner);
+out_err_pm_notifier:
+ kvm_destroy_pm_notifier(kvm);
+ mutex_lock(&kvm_lock);
+ list_del(&kvm->vm_list);
+ mutex_unlock(&kvm_lock);
out_err_mmu_notifier:
#if defined(CONFIG_MMU_NOTIFIER) && defined(KVM_ARCH_WANT_MMU_NOTIFIER)
if (kvm->mmu_notifier.ops)
--

syzbot

unread,
Aug 21, 2022, 7:08:14 AM8/21/22
to hda...@sina.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+ee478a...@syzkaller.appspotmail.com

Tested on:

commit: 7ebfc85e Merge tag 'net-6.0-rc1' of git://git.kernel.o..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=12379b85080000
kernel config: https://syzkaller.appspot.com/x/.config?x=924833c12349a8c0
dashboard link: https://syzkaller.appspot.com/bug?extid=ee478a0237db20ef61f1
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
patch: https://syzkaller.appspot.com/x/patch.diff?x=13d2c57b080000

Note: testing is done by a robot and is best-effort only.

syzbot

unread,
Dec 14, 2022, 11:12:28 AM12/14/22
to syzkall...@googlegroups.com
Auto-closing this bug as obsolete.
No recent activity, existing reproducers are no longer triggering the issue.
Reply all
Reply to author
Forward
0 new messages