KASAN: use-after-free Write in preempt_notifier_register

25 views
Skip to first unread message

syzbot

unread,
Dec 20, 2017, 11:03:04 AM12/20/17
to k...@vger.kernel.org, linux-...@vger.kernel.org, pbon...@redhat.com, rkr...@redhat.com, syzkall...@googlegroups.com
Hello,

syzkaller hit the following crash on
7dc9f647127d6955ffacaf51cb6a627b31dceec2
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/master
compiler: gcc (GCC) 7.1.1 20170620
.config is attached
Raw console output is attached.

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


binder: 7432:7451 BC_CLEAR_DEATH_NOTIFICATION invalid ref 0
==================================================================
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 ffff8801bddf0d50 by task syz-executor2/7427

CPU: 1 PID: 7427 Comm: syz-executor2 Not tainted 4.15.0-rc4-next-20171220+
#77
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:252
kasan_report_error mm/kasan/report.c:351 [inline]
kasan_report+0x25b/0x340 mm/kasan/report.c:409
__asan_report_store8_noabort+0x17/0x20 mm/kasan/report.c:435
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:728 [inline]
kvm_put_kvm+0x695/0xde0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:749
kvm_vm_release+0x42/0x50 arch/x86/kvm/../../../virt/kvm/kvm_main.c:760
__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:00007f067fe32ce8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: 0000000000000000 RBX: 000000000071bec8 RCX: 0000000000452a09
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 000000000071bec8
RBP: 000000000071bec8 R08: 00000000000003bb R09: 000000000071bea0
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000a2f7ff R14: 00007f067fe339c0 R15: 0000000000000000

Allocated by task 7447:
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:3545
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:2445
[inline]
kvm_vm_ioctl+0x48b/0x1c60 arch/x86/kvm/../../../virt/kvm/kvm_main.c:2943
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 7427:
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:3489 [inline]
kmem_cache_free+0x83/0x2a0 mm/slab.c:3747
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:728 [inline]
kvm_put_kvm+0x695/0xde0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:749
kvm_vm_release+0x42/0x50 arch/x86/kvm/../../../virt/kvm/kvm_main.c:760
__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 ffff8801bddf0d40
which belongs to the cache kvm_vcpu of size 23872
The buggy address is located 16 bytes inside of
23872-byte region [ffff8801bddf0d40, ffff8801bddf6a80)
The buggy address belongs to the page:
page:00000000f0bc3fc9 count:1 mapcount:0 mapping:00000000732c9161 index:0x0
compound_mapcount: 0
flags: 0x2fffc0000008100(slab|head)
raw: 02fffc0000008100 ffff8801bddf0d40 0000000000000000 0000000100000001
raw: ffffea0006f53420 ffffea0006ee5020 ffff8801d8be03c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8801bddf0c00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8801bddf0c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
> ffff8801bddf0d00: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
^
ffff8801bddf0d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8801bddf0e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
This bug is generated by a dumb bot. It may contain errors.
See https://goo.gl/tpsmEJ for details.
Direct all questions to syzk...@googlegroups.com.
Please credit me with: Reported-by: syzbot <syzk...@googlegroups.com>

syzbot will keep track of this bug report.
Once a fix for this bug is merged into any tree, reply to this email with:
#syz fix: exact-commit-title
To mark this as a duplicate of another syzbot report, please reply with:
#syz dup: exact-subject-of-another-report
If it's a one-off invalid bug report, please reply with:
#syz invalid
Note: if the crash happens again, it will cause creation of a new bug
report.
Note: all commands must start from beginning of the line in the email body.
config.txt
raw.log

Eric Biggers

unread,
Dec 20, 2017, 8:28:47 PM12/20/17
to syzbot, k...@vger.kernel.org, linux-...@vger.kernel.org, pbon...@redhat.com, rkr...@redhat.com, syzkall...@googlegroups.com
Probably a duplicate of the kvm_arch_vcpu_ioctl_set_sregs() bug:

#syz dup: KASAN: use-after-free Read in __schedule
Reply all
Reply to author
Forward
0 new messages