syzbot


KASAN: use-after-free Write in preempt_notifier_register

Status: closed as dup on 2017/12/21 01:28
Subsystems: kvm
[Documentation on labels]
Reported-by: syzbot+a6eecfdc2db5a950f2d665c4526f7f1f3e114b95@syzkaller.appspotmail.com
First crash: 2558d, last: 2556d
Duplicate of
Title Repro Cause bisect Fix bisect Count Last Reported
KASAN: use-after-free Read in __schedule kvm C 145 2556d 2558d
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 (2) kvm C error 3 2283d 2323d 0/28 auto-obsoleted due to no activity on 2022/08/31 03:00

Sample crash report:
Can not set IPV6_FL_F_REFLECT if flowlabel_consistency sysctl is enable
==================================================================
BUG: KASAN: use-after-free in hlist_add_head include/linux/list.h:674 [inline]
BUG: KASAN: use-after-free in preempt_notifier_register+0x1e2/0x210 kernel/sched/core.c:2513
Write of size 8 at addr ffff8801cb7405d0 by task syz-executor3/5719

CPU: 1 PID: 5719 Comm: syz-executor3 Not tainted 4.15.0-rc4-mm1+ #47
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:256
 kasan_report_error mm/kasan/report.c:355 [inline]
 kasan_report+0x23b/0x360 mm/kasan/report.c:413
 __asan_report_store8_noabort+0x17/0x20 mm/kasan/report.c:439
 hlist_add_head include/linux/list.h:674 [inline]
 preempt_notifier_register+0x1e2/0x210 kernel/sched/core.c:2513
 vcpu_load+0x27/0x40 arch/x86/kvm/../../../virt/kvm/kvm_main.c:157
 vmx_free_vcpu_nested arch/x86/kvm/vmx.c:9795 [inline]
 vmx_free_vcpu+0x11b/0x260 arch/x86/kvm/vmx.c:9809
 kvm_arch_vcpu_free arch/x86/kvm/x86.c:7870 [inline]
 kvm_free_vcpus arch/x86/kvm/x86.c:8317 [inline]
 kvm_arch_destroy_vm+0x4a2/0x980 arch/x86/kvm/x86.c:8416
 kvm_destroy_vm arch/x86/kvm/../../../virt/kvm/kvm_main.c:729 [inline]
 kvm_put_kvm+0x695/0xde0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:750
 kvm_vm_release+0x42/0x50 arch/x86/kvm/../../../virt/kvm/kvm_main.c:761
 __fput+0x327/0x7e0 fs/file_table.c:209
 ____fput+0x15/0x20 fs/file_table.c:243
 task_work_run+0x199/0x270 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x9bb/0x1ad0 kernel/exit.c:869
 do_group_exit+0x149/0x400 kernel/exit.c:972
 get_signal+0x73f/0x16c0 kernel/signal.c:2337
 do_signal+0x94/0x1ee0 arch/x86/kernel/signal.c:809
 exit_to_usermode_loop+0x258/0x2f0 arch/x86/entry/common.c:161
 prepare_exit_to_usermode arch/x86/entry/common.c:195 [inline]
 syscall_return_slowpath+0x490/0x550 arch/x86/entry/common.c:264
 entry_SYSCALL_64_fastpath+0x94/0x96
RIP: 0033:0x452a09
RSP: 002b:00007fb399aa7ce8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 000000000071bf80 RCX: 0000000000452a09
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 000000000071bf80
RBP: 000000000071bf80 R08: 0000000000000200 R09: 000000000071bf58
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000a2f7ff R14: 00007fb399aa89c0 R15: 0000000000000002

Allocated by task 5703:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:551
 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:489
 kmem_cache_alloc+0x12e/0x760 mm/slab.c:3541
 kmem_cache_zalloc include/linux/slab.h:695 [inline]
 vmx_create_vcpu+0xc4/0x2f20 arch/x86/kvm/vmx.c:9819
 kvm_arch_vcpu_create+0x12c/0x1a0 arch/x86/kvm/x86.c:7884
 kvm_vm_ioctl_create_vcpu arch/x86/kvm/../../../virt/kvm/kvm_main.c:2446 [inline]
 kvm_vm_ioctl+0x48b/0x1c60 arch/x86/kvm/../../../virt/kvm/kvm_main.c:2944
 vfs_ioctl fs/ioctl.c:46 [inline]
 do_vfs_ioctl+0x1b1/0x1520 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

Freed by task 5719:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0x71/0xc0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3485 [inline]
 kmem_cache_free+0x83/0x2a0 mm/slab.c:3743
 vmx_free_vcpu+0x1ee/0x260 arch/x86/kvm/vmx.c:9813
 kvm_arch_vcpu_free arch/x86/kvm/x86.c:7870 [inline]
 kvm_free_vcpus arch/x86/kvm/x86.c:8317 [inline]
 kvm_arch_destroy_vm+0x4a2/0x980 arch/x86/kvm/x86.c:8416
 kvm_destroy_vm arch/x86/kvm/../../../virt/kvm/kvm_main.c:729 [inline]
 kvm_put_kvm+0x695/0xde0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:750
 kvm_vm_release+0x42/0x50 arch/x86/kvm/../../../virt/kvm/kvm_main.c:761
 __fput+0x327/0x7e0 fs/file_table.c:209
 ____fput+0x15/0x20 fs/file_table.c:243
 task_work_run+0x199/0x270 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x9bb/0x1ad0 kernel/exit.c:869
 do_group_exit+0x149/0x400 kernel/exit.c:972
 get_signal+0x73f/0x16c0 kernel/signal.c:2337
 do_signal+0x94/0x1ee0 arch/x86/kernel/signal.c:809
 exit_to_usermode_loop+0x258/0x2f0 arch/x86/entry/common.c:161
 prepare_exit_to_usermode arch/x86/entry/common.c:195 [inline]
 syscall_return_slowpath+0x490/0x550 arch/x86/entry/common.c:264
 entry_SYSCALL_64_fastpath+0x94/0x96

The buggy address belongs to the object at ffff8801cb7405c0
 which belongs to the cache kvm_vcpu of size 23872
The buggy address is located 16 bytes inside of
 23872-byte region [ffff8801cb7405c0, ffff8801cb746300)
The buggy address belongs to the page:
page:ffffea00072dd000 count:1 mapcount:0 mapping:ffff8801cb7405c0 index:0x0 compound_mapcount: 0
flags: 0x2fffc0000008100(slab|head)
raw: 02fffc0000008100 ffff8801cb7405c0 0000000000000000 0000000100000001
raw: ffffea00073b3e20 ffffea0007443e20 ffff8801d6438240 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801cb740480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8801cb740500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8801cb740580: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
                                                 ^
 ffff8801cb740600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801cb740680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (7):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2017/12/21 23:44 mmots 75aa5540627f 81fe66b4 .config console log report ci-upstream-mmots-kasan-gce
2017/12/21 12:13 mmots 75aa5540627f eaadba98 .config console log report ci-upstream-mmots-kasan-gce
2017/12/20 22:21 linux-next 7dc9f647127d 90a46995 .config console log report ci-upstream-next-kasan-gce
2017/12/20 21:09 linux-next 7dc9f647127d 90a46995 .config console log report ci-upstream-next-kasan-gce
2017/12/20 19:30 linux-next 7dc9f647127d 90a46995 .config console log report ci-upstream-next-kasan-gce
2017/12/20 17:51 linux-next 7dc9f647127d 90a46995 .config console log report ci-upstream-next-kasan-gce
2017/12/20 15:39 linux-next 7dc9f647127d 90a46995 .config console log report ci-upstream-next-kasan-gce
* Struck through repros no longer work on HEAD.