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

8 views
Skip to first unread message

syzbot

unread,
Apr 14, 2019, 5:28:26 AM4/14/19
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: aaf86316 BACKPORT: userfaultfd: shmem/hugetlbfs: only allo..
git tree: android-4.4
console output: https://syzkaller.appspot.com/x/log.txt?x=17127d74c00000
kernel config: https://syzkaller.appspot.com/x/.config?x=47bc4dd423780c4a
dashboard link: https://syzkaller.appspot.com/bug?extid=82c6c63348a16c48b997
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+82c6c6...@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[ 3.523064] sd 0:0:1:0: [sda] Attached
SCSI disk
==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x39b1/0x4f50
kernel/locking/lockdep.c:3092
Read of size 8 at addr ffff8800ba1265c8 by task system/344

CPU: 0 PID: 344 Comm: system Not tainted 4.4.174+ #31
0000000000000000 ed4cc9414e9067b9 ffff8800b9f379f0 ffffffff81aad1a1
0000000000000000 ffffea0002e84980 ffff8800ba1265c8 0000000000000008
0000000000000000 ffff8800b9f37a28 ffffffff81490120 0000000000000000
Call Trace:
[<ffffffff81aad1a1>] __dump_stack lib/dump_stack.c:15 [inline]
[<ffffffff81aad1a1>] dump_stack+0xc1/0x120 lib/dump_stack.c:51
[<ffffffff81490120>] print_address_description+0x6f/0x21b
mm/kasan/report.c:252
[<ffffffff81490358>] kasan_report_error mm/kasan/report.c:351 [inline]
[<ffffffff81490358>] kasan_report mm/kasan/report.c:408 [inline]
[<ffffffff81490358>] kasan_report.cold+0x8c/0x2be mm/kasan/report.c:393
[<ffffffff81484ed4>] __asan_report_load8_noabort+0x14/0x20
mm/kasan/report.c:429
[<ffffffff81202f61>] __lock_acquire+0x39b1/0x4f50
kernel/locking/lockdep.c:3092
[<ffffffff81205f6e>] lock_acquire+0x15e/0x450 kernel/locking/lockdep.c:3592
[<ffffffff82717ca8>] __raw_spin_lock include/linux/spinlock_api_smp.h:144
[inline]
[<ffffffff82717ca8>] _raw_spin_lock+0x38/0x50 kernel/locking/spinlock.c:151
[<ffffffff82112d10>] spin_lock include/linux/spinlock.h:302 [inline]
[<ffffffff82112d10>] ion_heap_freelist_size
drivers/staging/android/ion/ion_heap.c:176 [inline]
[<ffffffff82112d10>] ion_heap_deferred_free+0x100/0x500
drivers/staging/android/ion/ion_heap.c:232
[<ffffffff811342c3>] kthread+0x273/0x310 kernel/kthread.c:211
[<ffffffff82718fc5>] ret_from_fork+0x55/0x80 arch/x86/entry/entry_64.S:537

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

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

The buggy address belongs to the object at ffff8800ba126500
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 200 bytes inside of
512-byte region [ffff8800ba126500, ffff8800ba126700)
The buggy address belongs to the page:
kasan: GPF could be caused by NULL-ptr deref or user memory accessgeneral
protection fault: 0000 [#1] PREEMPT SMP KASAN
Modules linked in:
CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.4.174+ #31
task: ffff8801da5f0000 task.stack: ffff8801da5f8000
RIP: 0010:[<ffffffff821132f2>] [<ffffffff821132f2>]
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: ffffffff821132dc RDI: 000000000000001a
RBP: ffff8801da5ffdb8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffffffffffffffea
R13: ffff8801d809ca88 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 ffffffff8324cd6d
ffffffff82e11080 ffff8801d7e20560 dffffc0000000000 ffffffff8324caac
ffff8801da5ffeb0 ffff8801da5ffed8 ffffffff810003fb 0000000082ab1c60
Call Trace:
[<ffffffff8324cd6d>] ion_dummy_init+0x2c1/0x36d
drivers/staging/android/ion/ion_dummy_driver.c:116
[<ffffffff810003fb>] do_one_initcall+0x13b/0x260 init/main.c:793
[<ffffffff831d5bce>] do_initcall_level init/main.c:858 [inline]
[<ffffffff831d5bce>] do_initcalls init/main.c:866 [inline]
[<ffffffff831d5bce>] do_basic_setup init/main.c:884 [inline]
[<ffffffff831d5bce>] kernel_init_freeable+0x2fa/0x3c3 init/main.c:1029
[<ffffffff82705624>] kernel_init+0x12/0x15e init/main.c:957
[<ffffffff82718fc5>] ret_from_fork+0x55/0x80 arch/x86/entry/entry_64.S:537
Code: 89 fc 48 83 ec 08 e8 1e 63 1f ff 4d 85 e4 74 53 e8 14 63 1f 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 [<ffffffff821132f2>] ion_heap_destroy+0x32/0xd0
drivers/staging/android/ion/ion_heap.c:363
RSP <ffff8801da5ffda8>
BUG: unable to handle kernel paging request at fffffffd52b24f00
IP: [<ffffffff811f471e>] cpuacct_charge+0x14e/0x360
kernel/sched/cpuacct.c:247
PGD 2e0d067 PUD 0
Oops: 0000 [#2] PREEMPT SMP KASAN
Modules linked in:
CPU: 1 PID: 1 Comm: swapper/0 Tainted: G D 4.4.174+ #31
task: ffff8801da5f0000 task.stack: ffff8801da5f8000
RIP: 0010:[<ffffffff811f471e>] [<ffffffff811f471e>]
cpuacct_charge+0x14e/0x360 kernel/sched/cpuacct.c:247
RSP: 0000:ffff8801db707a38 EFLAGS: 00010046
RAX: 1ffffffff05d2a33 RBX: 00000000000181a8 RCX: fffffffd52b24f00
RDX: fffffbffaa5649e0 RSI: 0000000000000000 RDI: ffffffff82e95198
RBP: ffff8801db707a78 R08: 0000000000000000 R09: 0000000000000001
R10: ffffffff82836880 R11: ffffffff831a50b8 R12: ffffffff82e950c0
R13: dffffc0000000000 R14: 000000000d2fcf6a R15: ffffffffb9f30050
FS: 0000000000000000(0000) GS:ffff8801db700000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: fffffffd52b24f00 CR3: 0000000002e0a000 CR4: 00000000001606b0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Stack:
ffffffff811f4630 ffffffff811ff5b0 ffffffff812a2843 ffff8801d8042fe0
ffff8801d8042f80 000000000d2fcf6a ffff8801d8043030 0000000000000000
ffff8801db707ac0 ffffffff8117c4a3 0000000000000001 0000000000000000
Call Trace:
<IRQ>
[<ffffffff8117c4a3>] update_curr+0x2c3/0x6e0 kernel/sched/fair.c:882
[<ffffffff8119dedf>] enqueue_entity kernel/sched/fair.c:3512 [inline]
[<ffffffff8119dedf>] enqueue_task_fair+0x10f/0xb6c0
kernel/sched/fair.c:4711
[<ffffffff811638e4>] enqueue_task kernel/sched/core.c:858 [inline]
[<ffffffff811638e4>] activate_task+0x154/0x280 kernel/sched/core.c:874
[<ffffffff81164b5e>] ttwu_activate kernel/sched/core.c:1736 [inline]
[<ffffffff81164b5e>] ttwu_do_activate.constprop.0+0xbe/0x1e0
kernel/sched/core.c:1789
[<ffffffff81168041>] ttwu_queue kernel/sched/core.c:1934 [inline]
[<ffffffff81168041>] try_to_wake_up+0x6d1/0x1110 kernel/sched/core.c:2068
[<ffffffff81168c05>] default_wake_function+0x35/0x50
kernel/sched/core.c:3494
[<ffffffff811eac82>] autoremove_wake_function+0x12/0x40
kernel/sched/wait.c:293
[<ffffffff811e8d80>] __wake_up_common+0xc0/0x160 kernel/sched/wait.c:73
[<ffffffff811e8e54>] __wake_up+0x34/0x50 kernel/sched/wait.c:95
[<ffffffff81241785>] rcu_gp_kthread_wake kernel/rcu/tree.c:1626 [inline]
[<ffffffff81241785>] rcu_gp_kthread_wake+0x95/0xb0 kernel/rcu/tree.c:1620
[<ffffffff81241bff>] rcu_report_qs_rsp+0xef/0x150 kernel/rcu/tree.c:2245
[<ffffffff81241e4a>] rcu_report_qs_rnp+0x1ea/0x2a0 kernel/rcu/tree.c:2309
[<ffffffff812453f1>] rcu_report_qs_rdp kernel/rcu/tree.c:2400 [inline]
[<ffffffff812453f1>] rcu_check_quiescent_state kernel/rcu/tree.c:2438
[inline]
[<ffffffff812453f1>] __rcu_process_callbacks kernel/rcu/tree.c:2924
[inline]
[<ffffffff812453f1>] rcu_process_callbacks+0x3b1/0x14b0
kernel/rcu/tree.c:2957
[<ffffffff8271bb16>] __do_softirq+0x226/0xa3f kernel/softirq.c:273
[<ffffffff810e1a8a>] invoke_softirq kernel/softirq.c:350 [inline]
[<ffffffff810e1a8a>] irq_exit+0x10a/0x150 kernel/softirq.c:391
[<ffffffff8271b24e>] exiting_irq arch/x86/include/asm/apic.h:652 [inline]
[<ffffffff8271b24e>] smp_apic_timer_interrupt+0x7e/0xb0
arch/x86/kernel/apic/apic.c:926
[<ffffffff8271a59d>] apic_timer_interrupt+0x9d/0xb0
arch/x86/entry/entry_64.S:768
<EOI>
[<ffffffff810c2535>] die.cold+0x21/0x2b arch/x86/kernel/dumpstack.c:316
[<ffffffff8100ee42>] do_general_protection+0x222/0x2b0
arch/x86/kernel/traps.c:463
[<ffffffff82719dd5>] general_protection+0x25/0x30
arch/x86/entry/entry_64.S:1063
[<ffffffff8324cd6d>] ion_dummy_init+0x2c1/0x36d
drivers/staging/android/ion/ion_dummy_driver.c:116
[<ffffffff810003fb>] do_one_initcall+0x13b/0x260 init/main.c:793
[<ffffffff831d5bce>] do_initcall_level init/main.c:858 [inline]
[<ffffffff831d5bce>] do_initcalls init/main.c:866 [inline]
[<ffffffff831d5bce>] do_basic_setup init/main.c:884 [inline]
[<ffffffff831d5bce>] kernel_init_freeable+0x2fa/0x3c3 init/main.c:1029
[<ffffffff82705624>] kernel_init+0x12/0x15e init/main.c:957
[<ffffffff82718fc5>] ret_from_fork+0x55/0x80 arch/x86/entry/entry_64.S:537
Code: 49 8d bc 24 d8 00 00 00 48 89 f8 48 c1 e8 03 42 80 3c 28 00 0f 85 ba
01 00 00 49 8b 9c 24 d8 00 00 00 80 3a 00 0f 85 8c 01 00 00 <4a> 03 1c fd
80 4c 1a 83 48 89 d8 48 c1 e8 03 42 80 3c 28 00 0f
RIP [<ffffffff811f471e>] cpuacct_charge+0x14e/0x360
kernel/sched/cpuacct.c:247
RSP <ffff8801db707a38>
CR2: fffffffd52b24f00
---[ end trace 1cd55f4cf68a249a ]---


---
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,
Apr 2, 2020, 5:44:12 AM4/2/20
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