syzbot


KASAN: use-after-free Write in preempt_notifier_register (2)

Status: upstream: reported C repro on 2018/08/11 19:09
Reported-by: syzbot+d5d3b529a776503b24a2@syzkaller.appspotmail.com
First crash: 1425d, last: 1380d

Cause bisection: failed (bisect log)
similar bugs (1):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Write in preempt_notifier_register 7 1654d 1655d 0/22 closed as dup on 2017/12/21 01:28

Sample crash report:
random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
==================================================================
BUG: KASAN: use-after-free in hlist_add_head include/linux/list.h:704 [inline]
BUG: KASAN: use-after-free in preempt_notifier_register+0x1ec/0x200 kernel/sched/core.c:2460
Write of size 8 at addr ffff8801ac490050 by task syz-executor201/4333

CPU: 0 PID: 4333 Comm: syz-executor201 Not tainted 4.18.0-rc8-next-20180807+ #33
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+0x1c9/0x2b4 lib/dump_stack.c:113
 print_address_description+0x6c/0x20b mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.7+0x242/0x30d mm/kasan/report.c:412
 __asan_report_store8_noabort+0x17/0x20 mm/kasan/report.c:438
 hlist_add_head include/linux/list.h:704 [inline]
 preempt_notifier_register+0x1ec/0x200 kernel/sched/core.c:2460
 vcpu_load+0x27/0x40 arch/x86/kvm/../../../virt/kvm/kvm_main.c:163
 vmx_free_vcpu_nested arch/x86/kvm/vmx.c:10658 [inline]
 vmx_free_vcpu+0x194/0x300 arch/x86/kvm/vmx.c:10672
 kvm_arch_vcpu_free arch/x86/kvm/x86.c:8387 [inline]
 kvm_free_vcpus arch/x86/kvm/x86.c:8836 [inline]
 kvm_arch_destroy_vm+0x365/0x7c0 arch/x86/kvm/x86.c:8933
 kvm_destroy_vm arch/x86/kvm/../../../virt/kvm/kvm_main.c:752 [inline]
 kvm_put_kvm+0x73f/0x1060 arch/x86/kvm/../../../virt/kvm/kvm_main.c:773
 kvm_vm_release+0x42/0x50 arch/x86/kvm/../../../virt/kvm/kvm_main.c:784
 __fput+0x376/0x8a0 fs/file_table.c:279
 ____fput+0x15/0x20 fs/file_table.c:312
 task_work_run+0x1e8/0x2a0 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x1b25/0x2760 kernel/exit.c:869
 do_group_exit+0x177/0x440 kernel/exit.c:972
 __do_sys_exit_group kernel/exit.c:983 [inline]
 __se_sys_exit_group kernel/exit.c:981 [inline]
 __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:981
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x43ece8
Code: Bad RIP value.
RSP: 002b:00007ffd3f933c78 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 000000000043ece8
RDX: 0000000000000000 RSI: 000000000000003c RDI: 0000000000000000
RBP: 00000000004be5a8 R08: 00000000000000e7 R09: ffffffffffffffd0
R10: 00000000004002c8 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000006d0180 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 4333:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc4/0xe0 mm/kasan/kasan.c:553
 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:490
 kmem_cache_alloc+0x12e/0x760 mm/slab.c:3554
 kmem_cache_zalloc include/linux/slab.h:697 [inline]
 vmx_create_vcpu+0xcf/0x28b0 arch/x86/kvm/vmx.c:10682
 kvm_arch_vcpu_create+0xe5/0x220 arch/x86/kvm/x86.c:8401
 kvm_vm_ioctl_create_vcpu arch/x86/kvm/../../../virt/kvm/kvm_main.c:2476 [inline]
 kvm_vm_ioctl+0x488/0x1d80 arch/x86/kvm/../../../virt/kvm/kvm_main.c:2977
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:501 [inline]
 do_vfs_ioctl+0x1de/0x1720 fs/ioctl.c:685
 ksys_ioctl+0xa9/0xd0 fs/ioctl.c:702
 __do_sys_ioctl fs/ioctl.c:709 [inline]
 __se_sys_ioctl fs/ioctl.c:707 [inline]
 __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:707
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 4333:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kmem_cache_free+0x86/0x2d0 mm/slab.c:3756
 vmx_free_vcpu+0x26b/0x300 arch/x86/kvm/vmx.c:10676
 kvm_arch_vcpu_free arch/x86/kvm/x86.c:8387 [inline]
 kvm_free_vcpus arch/x86/kvm/x86.c:8836 [inline]
 kvm_arch_destroy_vm+0x365/0x7c0 arch/x86/kvm/x86.c:8933
 kvm_destroy_vm arch/x86/kvm/../../../virt/kvm/kvm_main.c:752 [inline]
 kvm_put_kvm+0x73f/0x1060 arch/x86/kvm/../../../virt/kvm/kvm_main.c:773
 kvm_vm_release+0x42/0x50 arch/x86/kvm/../../../virt/kvm/kvm_main.c:784
 __fput+0x376/0x8a0 fs/file_table.c:279
 ____fput+0x15/0x20 fs/file_table.c:312
 task_work_run+0x1e8/0x2a0 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x1b25/0x2760 kernel/exit.c:869
 do_group_exit+0x177/0x440 kernel/exit.c:972
 __do_sys_exit_group kernel/exit.c:983 [inline]
 __se_sys_exit_group kernel/exit.c:981 [inline]
 __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:981
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8801ac490040
 which belongs to the cache kvm_vcpu of size 23808
The buggy address is located 16 bytes inside of
 23808-byte region [ffff8801ac490040, ffff8801ac495d40)
The buggy address belongs to the page:
page:ffffea0006b12400 count:1 mapcount:0 mapping:ffff8801d5297a80 index:0x0 compound_mapcount: 0
flags: 0x2fffc0000008100(slab|head)
raw: 02fffc0000008100 ffff8801d528f448 ffffea0006b2aa08 ffff8801d5297a80
raw: 0000000000000000 ffff8801ac490040 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801ac48ff00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff8801ac48ff80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff8801ac490000: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
                                                 ^
 ffff8801ac490080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801ac490100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (3):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-linux-next-kasan-gce-root 2018/08/07 18:05 linux-next 2b769bb85b48 1beb8136 .config log report syz C
ci-upstream-kasan-gce-386 2018/09/18 13:40 upstream 5211da9ca526 7f125108 .config log report
ci-upstream-linux-next-kasan-gce-root 2018/09/21 10:25 linux-next 46c163a036b4 37079712 .config log report