syzbot


android-4.9 boot error: KASAN: use-after-free Read in ion_heap_deferred_free

Status: auto-closed as invalid on 2019/09/16 00:57
Reported-by: syzbot+70ff0092b5efb0badcf9@syzkaller.appspotmail.com
First crash: 2104d, last: 2073d

Sample crash report:
usbhid: USB HID core driver
ion_heap_create: Heap type is disabled: 1
kasan: CONFIG_KASAN_INLINE enabled
sd 0:0:1:0: [sda] Attached SCSI disk
==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x2f1c/0x4350 kernel/locking/lockdep.c:3224
Read of size 8 at addr ffff8801d6210ac8 by task system/347

CPU: 1 PID: 347 Comm: system Not tainted 4.9.161+ #87
 ffff8801d5ca79e0 ffffffff81b482a1 0000000000000000 ffffea0007588400
 ffff8801d6210ac8 0000000000000008 ffffffff8120adbc ffff8801d5ca7a18
 ffffffff815032e5 0000000000000000 ffff8801d6210ac8 ffff8801d6210ac8
Call Trace:
 [<ffffffff81b482a1>] __dump_stack lib/dump_stack.c:15 [inline]
 [<ffffffff81b482a1>] dump_stack+0xc1/0x120 lib/dump_stack.c:51
 [<ffffffff815032e5>] print_address_description+0x6f/0x238 mm/kasan/report.c:256
 [<ffffffff8150353a>] kasan_report_error mm/kasan/report.c:355 [inline]
 [<ffffffff8150353a>] kasan_report mm/kasan/report.c:412 [inline]
 [<ffffffff8150353a>] kasan_report.cold+0x8c/0x2ba mm/kasan/report.c:397
 [<ffffffff814f5734>] __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
 [<ffffffff8120adbc>] __lock_acquire+0x2f1c/0x4350 kernel/locking/lockdep.c:3224
 [<ffffffff8120ccb3>] lock_acquire+0x133/0x3d0 kernel/locking/lockdep.c:3756
 [<ffffffff82805398>] __raw_spin_lock include/linux/spinlock_api_smp.h:144 [inline]
 [<ffffffff82805398>] _raw_spin_lock+0x38/0x50 kernel/locking/spinlock.c:151
 [<ffffffff821e6e39>] spin_lock include/linux/spinlock.h:302 [inline]
 [<ffffffff821e6e39>] ion_heap_freelist_size drivers/staging/android/ion/ion_heap.c:176 [inline]
 [<ffffffff821e6e39>] ion_heap_deferred_free+0xf9/0x560 drivers/staging/android/ion/ion_heap.c:232
 [<ffffffff81142848>] kthread+0x278/0x310 kernel/kthread.c:211
 [<ffffffff828061dc>] ret_from_fork+0x5c/0x70 arch/x86/entry/entry_64.S:373

Allocated by task 1:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
 save_stack mm/kasan/kasan.c:505 [inline]
 set_track mm/kasan/kasan.c:517 [inline]
 kasan_kmalloc.part.0+0x62/0xf0 mm/kasan/kasan.c:609
 kasan_kmalloc+0xb7/0xd0 mm/kasan/kasan.c:594
 kmem_cache_alloc_trace+0x115/0x2d0 mm/slub.c:2742
 kmalloc include/linux/slab.h:490 [inline]
 kzalloc include/linux/slab.h:636 [inline]
 ion_system_heap_create+0x42/0x1c0 drivers/staging/android/ion/ion_system_heap.c:334
 ion_heap_create+0x156/0x1b0 drivers/staging/android/ion/ion_heap.c:328
 ion_dummy_init+0x22e/0x3b6 drivers/staging/android/ion/ion_dummy_driver.c:108
 do_one_initcall+0xb1/0x1c0 init/main.c:780
 do_initcall_level init/main.c:846 [inline]
 do_initcalls init/main.c:854 [inline]
 do_basic_setup init/main.c:872 [inline]
 kernel_init_freeable+0x2ff/0x3c3 init/main.c:1018
 kernel_init+0x12/0x163 init/main.c:946
 ret_from_fork+0x5c/0x70 arch/x86/entry/entry_64.S:373

Freed by task 1:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
 save_stack mm/kasan/kasan.c:505 [inline]
 set_track mm/kasan/kasan.c:517 [inline]
 kasan_slab_free+0xb0/0x190 mm/kasan/kasan.c:582
 slab_free_hook mm/slub.c:1355 [inline]
 slab_free_freelist_hook mm/slub.c:1377 [inline]
 slab_free mm/slub.c:2958 [inline]
 kfree+0xfb/0x310 mm/slub.c:3878
 ion_system_heap_destroy+0x72/0x90 drivers/staging/android/ion/ion_system_heap.c:369
 ion_heap_destroy+0x6a/0xd0 drivers/staging/android/ion/ion_heap.c:369
 ion_dummy_init+0x30a/0x3b6 drivers/staging/android/ion/ion_dummy_driver.c:118
 do_one_initcall+0xb1/0x1c0 init/main.c:780
 do_initcall_level init/main.c:846 [inline]
 do_initcalls init/main.c:854 [inline]
 do_basic_setup init/main.c:872 [inline]
 kernel_init_freeable+0x2ff/0x3c3 init/main.c:1018
 kernel_init+0x12/0x163 init/main.c:946
 ret_from_fork+0x5c/0x70 arch/x86/entry/entry_64.S:373

The buggy address belongs to the object at ffff8801d6210a00
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 200 bytes inside of
 512-byte region [ffff8801d6210a00, ffff8801d6210c00)
The buggy address belongs to the page:
page:ffffea0007588400 count:1 mapcount:0 mapping:          (null) index:0x0 compound_mapcount: 0
flags: 0x4000000000004080(slab|head)
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801d6210980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8801d6210a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8801d6210a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                              ^
 ffff8801d6210b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801d6210b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (5):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/03/02 03:08 https://android.googlesource.com/kernel/common android-4.9 4aa6f012a2d4 68d9e495 .config console log report ci-android-49-kasan-gce
2019/02/17 15:30 https://android.googlesource.com/kernel/common android-4.9 3de7f8451928 3e98cc30 .config console log report ci-android-49-kasan-gce-root
2019/03/20 00:56 https://android.googlesource.com/kernel/common android-4.9 26fad52fa044 2458c1c6 .config console log report ci-android-49-kasan-gce-386
2019/03/07 09:18 https://android.googlesource.com/kernel/common android-4.9 2f0bc4bcd59e 8c085c5e .config console log report ci-android-49-kasan-gce-386
2019/02/23 20:03 https://android.googlesource.com/kernel/common android-4.9 fd5657a6c72d 7a06e792 .config console log report ci-android-49-kasan-gce-386
* Struck through repros no longer work on HEAD.