syzbot


KASAN: use-after-free Read in binder_release_work

Status: fixed on 2018/05/22 16:58
Fix commit: c4048b20ffc5 UPSTREAM: ANDROID: binder: prevent transactions into own process.
First crash: 2203d, last: 2190d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-44 KASAN: use-after-free Read in binder_release_work C 5 2190d 1839d 0/2 public: reported C repro on 2019/04/11 08:44
upstream KASAN: use-after-free Read in binder_release_work kernel C 6 2190d 2211d 5/26 fixed on 2018/05/08 18:30

Sample crash report:
binder: undelivered TRANSACTION_COMPLETE
binder: release 3771:3773 transaction 4 in, still active
binder: send failed reply for transaction 4 to 3771:3773
==================================================================
binder: 3774:3775 ERROR: BC_REGISTER_LOOPER called without request
BUG: KASAN: use-after-free in __list_del_entry+0x1a9/0x1c0 lib/list_debug.c:60
Read of size 8 at addr ffff8801cfec7c10 by task kworker/0:1/25
binder: release 3774:3775 transaction 7 out, still active
binder: release 3774:3775 transaction 6 in, still active
binder: undelivered TRANSACTION_COMPLETE

CPU: 0 PID: 25 Comm: kworker/0:1 Not tainted 4.9.93-gcb02358 #2
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events binder_deferred_func
 ffff8801d9527a58 ffffffff81d9c249 ffffea00073fb1c0 ffff8801cfec7c10
 0000000000000000 ffff8801cfec7c10 ffffed00395d1f79 ffff8801d9527a90
 ffffffff8156533b ffff8801cfec7c10 0000000000000008 0000000000000000
Call Trace:
 [<ffffffff81d9c249>] __dump_stack lib/dump_stack.c:15 [inline]
 [<ffffffff81d9c249>] dump_stack+0xc1/0x128 lib/dump_stack.c:51
 [<ffffffff8156533b>] print_address_description+0x6c/0x234 mm/kasan/report.c:256
 [<ffffffff815655af>] kasan_report_error mm/kasan/report.c:355 [inline]
 [<ffffffff815655af>] kasan_report.cold.6+0xac/0x2f5 mm/kasan/report.c:412
 [<ffffffff815393c4>] __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
 [<ffffffff81e04129>] __list_del_entry+0x1a9/0x1c0 lib/list_debug.c:60
 [<ffffffff82d3986f>] list_del_init include/linux/list.h:145 [inline]
 [<ffffffff82d3986f>] binder_dequeue_work_head_ilocked drivers/android/binder.c:913 [inline]
 [<ffffffff82d3986f>] binder_dequeue_work_head drivers/android/binder.c:933 [inline]
 [<ffffffff82d3986f>] binder_release_work+0x6f/0x1d0 drivers/android/binder.c:4361
 [<ffffffff82d39df5>] binder_thread_release+0x425/0x520 drivers/android/binder.c:4569
 [<ffffffff82d3a33d>] binder_deferred_release drivers/android/binder.c:5110 [inline]
 [<ffffffff82d3a33d>] binder_deferred_func+0x44d/0xc30 drivers/android/binder.c:5182
 [<ffffffff8118ac91>] process_one_work+0x7e1/0x1500 kernel/workqueue.c:2092
 [<ffffffff8118ba86>] worker_thread+0xd6/0x10a0 kernel/workqueue.c:2226
 [<ffffffff8119ab4d>] kthread+0x26d/0x300 kernel/kthread.c:211
 [<ffffffff838d5b1c>] ret_from_fork+0x5c/0x70 arch/x86/entry/entry_64.S:373

Allocated by task 3773:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
 save_stack+0x43/0xd0 mm/kasan/kasan.c:505
 set_track mm/kasan/kasan.c:517 [inline]
 kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:609
 kmem_cache_alloc_trace+0xfd/0x2b0 mm/slub.c:2742
 kmalloc include/linux/slab.h:490 [inline]
 kzalloc include/linux/slab.h:636 [inline]
 binder_transaction+0x8d5/0x6230 drivers/android/binder.c:3062
 binder_thread_write+0xa40/0x2170 drivers/android/binder.c:3685
 binder_ioctl_write_read.isra.46+0x1eb/0x810 drivers/android/binder.c:4624
 binder_ioctl+0x702/0x1160 drivers/android/binder.c:4763
 vfs_ioctl fs/ioctl.c:43 [inline]
 file_ioctl fs/ioctl.c:493 [inline]
 do_vfs_ioctl+0x1ac/0x1150 fs/ioctl.c:677
 SYSC_ioctl fs/ioctl.c:694 [inline]
 SyS_ioctl+0x8f/0xc0 fs/ioctl.c:685
 do_syscall_64+0x1a6/0x490 arch/x86/entry/common.c:282
 entry_SYSCALL_64_after_swapgs+0x5d/0xdb

Freed by task 25:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
 save_stack+0x43/0xd0 mm/kasan/kasan.c:505
 set_track mm/kasan/kasan.c:517 [inline]
 kasan_slab_free+0x72/0xc0 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
 binder_free_transaction+0x6a/0x90 drivers/android/binder.c:2122
 binder_send_failed_reply+0x1c3/0x230 drivers/android/binder.c:2161
 binder_thread_release+0x413/0x520 drivers/android/binder.c:4568
 binder_deferred_release drivers/android/binder.c:5110 [inline]
 binder_deferred_func+0x44d/0xc30 drivers/android/binder.c:5182
 process_one_work+0x7e1/0x1500 kernel/workqueue.c:2092
 worker_thread+0xd6/0x10a0 kernel/workqueue.c:2226
 kthread+0x26d/0x300 kernel/kthread.c:211
 ret_from_fork+0x5c/0x70 arch/x86/entry/entry_64.S:373

The buggy address belongs to the object at ffff8801cfec7c00
 which belongs to the cache kmalloc-192 of size 192
The buggy address is located 16 bytes inside of
 192-byte region [ffff8801cfec7c00, ffff8801cfec7cc0)
The buggy address belongs to the page:
page:ffffea00073fb1c0 count:1 mapcount:0 mapping:          (null) index:0xffff8801cfec7600
flags: 0x8000000000000080(slab)
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801cfec7b00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8801cfec7b80: 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8801cfec7c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                         ^
 ffff8801cfec7c80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8801cfec7d00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (132):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/04/13 18:34 https://android.googlesource.com/kernel/common android-4.9 cb023581bd03 0a0c5db6 .config console log report syz C ci-android-49-kasan-gce
2018/04/11 15:50 https://android.googlesource.com/kernel/common android-4.9 f6bec4e8c771 8b8de427 .config console log report syz ci-android-49-kasan-gce
2018/04/11 12:32 https://android.googlesource.com/kernel/common android-4.9 f6bec4e8c771 8b8de427 .config console log report syz ci-android-49-kasan-gce
2018/04/13 18:51 https://android.googlesource.com/kernel/common android-4.9 cb023581bd03 0a0c5db6 .config console log report syz ci-android-49-kasan-gce-386
2018/04/11 21:52 https://android.googlesource.com/kernel/common android-4.9 f6bec4e8c771 9cd56d71 .config console log report syz ci-android-49-kasan-gce-386
2018/04/11 19:26 https://android.googlesource.com/kernel/common android-4.9 f6bec4e8c771 8b8de427 .config console log report syz ci-android-49-kasan-gce-386
2018/04/25 08:34 https://android.googlesource.com/kernel/common android-4.9 320d53a9d07c 73417389 .config console log report ci-android-49-kasan-gce
2018/04/25 02:49 https://android.googlesource.com/kernel/common android-4.9 320d53a9d07c 37e76fe2 .config console log report ci-android-49-kasan-gce
2018/04/21 00:43 https://android.googlesource.com/kernel/common android-4.9 13cc54013b24 ca03d688 .config console log report ci-android-49-kasan-gce
2018/04/20 18:26 https://android.googlesource.com/kernel/common android-4.9 13cc54013b24 cc402841 .config console log report ci-android-49-kasan-gce-root
2018/04/20 17:18 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 cc402841 .config console log report ci-android-49-kasan-gce
2018/04/20 16:16 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 cc402841 .config console log report ci-android-49-kasan-gce-root
2018/04/20 11:19 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 eae05cb0 .config console log report ci-android-49-kasan-gce
2018/04/20 09:31 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 eae05cb0 .config console log report ci-android-49-kasan-gce
2018/04/20 00:52 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 eae05cb0 .config console log report ci-android-49-kasan-gce-root
2018/04/19 22:17 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 3642839c .config console log report ci-android-49-kasan-gce-root
2018/04/19 18:46 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 3642839c .config console log report ci-android-49-kasan-gce
2018/04/19 12:49 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 3642839c .config console log report ci-android-49-kasan-gce
2018/04/19 06:15 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 829f0234 .config console log report ci-android-49-kasan-gce
2018/04/19 04:26 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 829f0234 .config console log report ci-android-49-kasan-gce
2018/04/18 20:37 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 829f0234 .config console log report ci-android-49-kasan-gce
2018/04/18 14:09 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 52643b44 .config console log report ci-android-49-kasan-gce
2018/04/18 12:55 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 52643b44 .config console log report ci-android-49-kasan-gce
2018/04/18 09:38 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 52643b44 .config console log report ci-android-49-kasan-gce
2018/04/18 06:24 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 b80fd3b5 .config console log report ci-android-49-kasan-gce
2018/04/18 04:45 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 b80fd3b5 .config console log report ci-android-49-kasan-gce
2018/04/17 21:17 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 b80fd3b5 .config console log report ci-android-49-kasan-gce
2018/04/17 20:12 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 b80fd3b5 .config console log report ci-android-49-kasan-gce
2018/04/17 17:49 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 b80fd3b5 .config console log report ci-android-49-kasan-gce
2018/04/17 13:48 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 b80fd3b5 .config console log report ci-android-49-kasan-gce
2018/04/17 12:11 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 b80fd3b5 .config console log report ci-android-49-kasan-gce
2018/04/17 10:49 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 b80fd3b5 .config console log report ci-android-49-kasan-gce
2018/04/17 06:28 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 b80fd3b5 .config console log report ci-android-49-kasan-gce
2018/04/17 03:12 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 b80fd3b5 .config console log report ci-android-49-kasan-gce
2018/04/16 23:41 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 b80fd3b5 .config console log report ci-android-49-kasan-gce
2018/04/16 22:21 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 b80fd3b5 .config console log report ci-android-49-kasan-gce
2018/04/16 20:54 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 802ac912 .config console log report ci-android-49-kasan-gce
2018/04/16 19:50 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 802ac912 .config console log report ci-android-49-kasan-gce
2018/04/16 17:41 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 802ac912 .config console log report ci-android-49-kasan-gce
2018/04/16 16:37 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 802ac912 .config console log report ci-android-49-kasan-gce
2018/04/16 15:24 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 802ac912 .config console log report ci-android-49-kasan-gce
2018/04/16 13:10 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 802ac912 .config console log report ci-android-49-kasan-gce
2018/04/16 09:42 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 7a67784c .config console log report ci-android-49-kasan-gce
2018/04/16 08:13 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 7a67784c .config console log report ci-android-49-kasan-gce
2018/04/16 08:03 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 7a67784c .config console log report ci-android-49-kasan-gce
2018/04/16 07:17 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 7a67784c .config console log report ci-android-49-kasan-gce
2018/04/16 03:28 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 7a67784c .config console log report ci-android-49-kasan-gce
2018/04/16 00:09 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 7a67784c .config console log report ci-android-49-kasan-gce
2018/04/13 21:18 https://android.googlesource.com/kernel/common android-4.9 cb023581bd03 7a67784c .config console log report ci-android-49-kasan-gce-386
* Struck through repros no longer work on HEAD.