android-4.4 boot error: KASAN: use-after-free Write in ion_heap_deferred_free

16 views
Skip to first unread message

syzbot

unread,
May 23, 2019, 4:31:05 AM5/23/19
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 6dc3fb0b fs: sdcardfs: Add missing option to show_options
git tree: android-4.4
console output: https://syzkaller.appspot.com/x/log.txt?x=12086530a00000
kernel config: https://syzkaller.appspot.com/x/.config?x=3b0bea98991137bf
dashboard link: https://syzkaller.appspot.com/bug?extid=95c250f662218250f74e
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
userspace arch: i386

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

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

usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
ion_heap_create: Heap type is disabled: 1
kasan: CONFIG_KASAN_INLINE enabled
==================================================================
BUG: KASAN: use-after-free in register_lock_class
kernel/locking/lockdep.c:832 [inline]
BUG: KASAN: use-after-free in __lock_acquire+0x424f/0x4f50
kernel/locking/lockdep.c:3101
Write of size 8 at addr ffff8801d808b250 by task system/344

CPU: 0 PID: 344 Comm: system Not tainted 4.4.180+ #7
0000000000000000 f01af48d6df20e11 ffff8801d7f079f0 ffffffff81ab7731
0000000000000001 ffffea0007602280 ffff8801d808b250 0000000000000008
0000000000000000 ffff8801d7f07a28 ffffffff814937b0 0000000000000001
Call Trace:
[<ffffffff81ab7731>] __dump_stack lib/dump_stack.c:15 [inline]
[<ffffffff81ab7731>] dump_stack+0xc1/0x120 lib/dump_stack.c:51
[<ffffffff814937b0>] print_address_description+0x6f/0x21b
mm/kasan/report.c:252
[<ffffffff814939e8>] kasan_report_error mm/kasan/report.c:351 [inline]
[<ffffffff814939e8>] kasan_report mm/kasan/report.c:408 [inline]
[<ffffffff814939e8>] kasan_report.cold+0x8c/0x2be mm/kasan/report.c:393
[<ffffffff81488607>] __asan_report_store8_noabort+0x17/0x20
mm/kasan/report.c:434
[<ffffffff8120694f>] register_lock_class kernel/locking/lockdep.c:832
[inline]
[<ffffffff8120694f>] __lock_acquire+0x424f/0x4f50
kernel/locking/lockdep.c:3101
[<ffffffff812090be>] lock_acquire+0x15e/0x450 kernel/locking/lockdep.c:3592
[<ffffffff82725e68>] __raw_spin_lock include/linux/spinlock_api_smp.h:144
[inline]
[<ffffffff82725e68>] _raw_spin_lock+0x38/0x50 kernel/locking/spinlock.c:151
[<ffffffff8211d260>] spin_lock include/linux/spinlock.h:302 [inline]
[<ffffffff8211d260>] ion_heap_freelist_size
drivers/staging/android/ion/ion_heap.c:176 [inline]
[<ffffffff8211d260>] ion_heap_deferred_free+0x100/0x500
drivers/staging/android/ion/ion_heap.c:232
[<ffffffff811370d3>] kthread+0x273/0x310 kernel/kthread.c:211
[<ffffffff82727185>] ret_from_fork+0x55/0x80 arch/x86/entry/entry_64.S:537

Allocated by task 1:
[<ffffffff8102f926>] save_stack_trace+0x26/0x50
arch/x86/kernel/stacktrace.c:63
[<ffffffff814875b2>] save_stack mm/kasan/kasan.c:512 [inline]
[<ffffffff814875b2>] set_track mm/kasan/kasan.c:524 [inline]
[<ffffffff814875b2>] kasan_kmalloc.part.0+0x62/0xf0 mm/kasan/kasan.c:616
[<ffffffff81487827>] kasan_kmalloc+0xb7/0xd0 mm/kasan/kasan.c:601
[<ffffffff81483833>] kmem_cache_alloc_trace+0x123/0x2d0 mm/slub.c:2642
[<ffffffff82120d4b>] kmalloc include/linux/slab.h:476 [inline]
[<ffffffff82120d4b>] kzalloc include/linux/slab.h:620 [inline]
[<ffffffff82120d4b>] ion_system_heap_create+0x4b/0x2c0
drivers/staging/android/ion/ion_system_heap.c:283
[<ffffffff8211d7b6>] ion_heap_create+0x156/0x1b0
drivers/staging/android/ion/ion_heap.c:328
[<ffffffff83251af8>] ion_dummy_init+0x1e5/0x36d
drivers/staging/android/ion/ion_dummy_driver.c:106
[<ffffffff810003fb>] do_one_initcall+0x13b/0x260 init/main.c:793
[<ffffffff831d9bce>] do_initcall_level init/main.c:858 [inline]
[<ffffffff831d9bce>] do_initcalls init/main.c:866 [inline]
[<ffffffff831d9bce>] do_basic_setup init/main.c:884 [inline]
[<ffffffff831d9bce>] kernel_init_freeable+0x2fa/0x3c3 init/main.c:1029
[<ffffffff827138d4>] kernel_init+0x12/0x15e init/main.c:957
[<ffffffff82727185>] ret_from_fork+0x55/0x80 arch/x86/entry/entry_64.S:537

Freed by task 1:
[<ffffffff8102f926>] save_stack_trace+0x26/0x50
arch/x86/kernel/stacktrace.c:63
[<ffffffff81487eb0>] save_stack mm/kasan/kasan.c:512 [inline]
[<ffffffff81487eb0>] set_track mm/kasan/kasan.c:524 [inline]
[<ffffffff81487eb0>] kasan_slab_free+0xb0/0x190 mm/kasan/kasan.c:589
[<ffffffff814852d4>] slab_free_hook mm/slub.c:1383 [inline]
[<ffffffff814852d4>] slab_free_freelist_hook mm/slub.c:1405 [inline]
[<ffffffff814852d4>] slab_free mm/slub.c:2859 [inline]
[<ffffffff814852d4>] kfree+0xf4/0x310 mm/slub.c:3749
[<ffffffff8212105a>] ion_system_heap_destroy+0x9a/0xc0
drivers/staging/android/ion/ion_system_heap.c:323
[<ffffffff8211d87a>] ion_heap_destroy+0x6a/0xd0
drivers/staging/android/ion/ion_heap.c:369
[<ffffffff83251bd4>] ion_dummy_init+0x2c1/0x36d
drivers/staging/android/ion/ion_dummy_driver.c:116
[<ffffffff810003fb>] do_one_initcall+0x13b/0x260 init/main.c:793
[<ffffffff831d9bce>] do_initcall_level init/main.c:858 [inline]
[<ffffffff831d9bce>] do_initcalls init/main.c:866 [inline]
[<ffffffff831d9bce>] do_basic_setup init/main.c:884 [inline]
[<ffffffff831d9bce>] kernel_init_freeable+0x2fa/0x3c3 init/main.c:1029
[<ffffffff827138d4>] kernel_init+0x12/0x15e init/main.c:957
[<ffffffff82727185>] ret_from_fork+0x55/0x80 arch/x86/entry/entry_64.S:537

The buggy address belongs to the object at ffff8801d808b180
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 208 bytes inside of
512-byte region [ffff8801d808b180, ffff8801d808b380)
The buggy address belongs to the page:
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] PREEMPT SMP KASAN
Modules linked in:
CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.4.180+ #7
task: ffff8801da5f0000 task.stack: ffff8801da5f8000
RIP: 0010:[<ffffffff8211d842>] [<ffffffff8211d842>]
ion_heap_destroy+0x32/0xd0 drivers/staging/android/ion/ion_heap.c:363
RSP: 0000:ffff8801da5ffda8 EFLAGS: 00010206
RAX: dffffc0000000000 RBX: 0000000000000010 RCX: 0000000000000000
RDX: 0000000000000003 RSI: ffffffff8211d82c RDI: 000000000000001a
RBP: ffff8801da5ffdb8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffffffffffffffea
R13: ffff8801d7cc2428 R14: dffffc0000000000 R15: ffffffffffffffea
FS: 0000000000000000(0000) GS:ffff8801db700000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 0000000002e0a000 CR4: 00000000001606b0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Stack:
dffffc0000000000 ffffffffffffffea ffff8801da5ffdf0 ffffffff83251bd4
ffffffff82e11080 ffff8801d7cc3160 dffffc0000000000 ffffffff83251913
ffff8801da5ffeb0 ffff8801da5ffed8 ffffffff810003fb 0000000082ab3860
Call Trace:
[<ffffffff83251bd4>] ion_dummy_init+0x2c1/0x36d
drivers/staging/android/ion/ion_dummy_driver.c:116
[<ffffffff810003fb>] do_one_initcall+0x13b/0x260 init/main.c:793
[<ffffffff831d9bce>] do_initcall_level init/main.c:858 [inline]
[<ffffffff831d9bce>] do_initcalls init/main.c:866 [inline]
[<ffffffff831d9bce>] do_basic_setup init/main.c:884 [inline]
[<ffffffff831d9bce>] kernel_init_freeable+0x2fa/0x3c3 init/main.c:1029
[<ffffffff827138d4>] kernel_init+0x12/0x15e init/main.c:957
[<ffffffff82727185>] ret_from_fork+0x55/0x80 arch/x86/entry/entry_64.S:537
Code: 89 fc 48 83 ec 08 e8 1e f1 1e ff 4d 85 e4 74 53 e8 14 f1 1e ff 49 8d
7c 24 30 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 04 02
84 c0 74 08 3c 03 0f 8e 83 00 00 00 41 8b 54 24 30
RIP [<ffffffff8211d842>] ion_heap_destroy+0x32/0xd0
drivers/staging/android/ion/ion_heap.c:363
RSP <ffff8801da5ffda8>
---[ end trace 1e9b790032fd6364 ]---


---
This bug 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 bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
Dec 6, 2019, 3:51:05 AM12/6/19
to syzkaller-a...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages