binder: 18859:18861 got reply transaction with bad transaction stack, transaction 1126 has target 18859:0 binder: BINDER_SET_CONTEXT_MGR already set binder: 18859:18866 ioctl 40046207 0 returned -16 ================================================================== BUG: KASAN: use-after-free in atomic_dec_and_test include/asm-generic/atomic-instrumented.h:259 [inline] BUG: KASAN: use-after-free in put_task_struct include/linux/sched/task.h:97 [inline] BUG: KASAN: use-after-free in _free_event+0x475/0x15d0 kernel/events/core.c:4452 Write of size 4 at addr ffff888090be60e0 by task syz-executor0/18855 CPU: 0 PID: 18855 Comm: syz-executor0 Not tainted 5.0.0-rc3+ #42 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: binder_alloc: 18859: binder_alloc_buf, no vma __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1db/0x2d0 lib/dump_stack.c:113 print_address_description.cold+0x7c/0x20d mm/kasan/report.c:187 kasan_report.cold+0x1b/0x40 mm/kasan/report.c:317 check_memory_region_inline mm/kasan/generic.c:185 [inline] check_memory_region+0x123/0x190 mm/kasan/generic.c:191 kasan_check_write+0x14/0x20 mm/kasan/common.c:106 atomic_dec_and_test include/asm-generic/atomic-instrumented.h:259 [inline] put_task_struct include/linux/sched/task.h:97 [inline] _free_event+0x475/0x15d0 kernel/events/core.c:4452 binder: 18859:18861 got reply transaction with no transaction stack free_event+0xb5/0x1a0 kernel/events/core.c:4473 perf_event_release_kernel+0x794/0xf70 kernel/events/core.c:4634 binder: release 18859:18861 transaction 1126 out, still active perf_release+0x37/0x50 kernel/events/core.c:4648 __fput+0x3c5/0xb10 fs/file_table.c:278 binder: undelivered TRANSACTION_COMPLETE ____fput+0x16/0x20 fs/file_table.c:309 task_work_run+0x1f4/0x2b0 kernel/task_work.c:113 get_signal+0x168d/0x19b0 kernel/signal.c:2347 binder: send failed reply for transaction 1126, target dead do_signal+0x91/0x1ea0 arch/x86/kernel/signal.c:816 exit_to_usermode_loop+0x2f7/0x3b0 arch/x86/entry/common.c:162 prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline] syscall_return_slowpath arch/x86/entry/common.c:268 [inline] do_syscall_64+0x696/0x800 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x458099 Code: 6d b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 3b b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f0e14dcdc78 EFLAGS: 00000246 ORIG_RAX: 0000000000000038 RAX: fffffffffffffffc RBX: 0000000000000005 RCX: 0000000000458099 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 000000000073c040 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f0e14dce6d4 R13: 00000000004be480 R14: 00000000004cea40 R15: 00000000ffffffff Allocated by task 18850: save_stack+0x45/0xd0 mm/kasan/common.c:73 set_track mm/kasan/common.c:85 [inline] __kasan_kmalloc mm/kasan/common.c:496 [inline] __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:469 kasan_kmalloc mm/kasan/common.c:504 [inline] kasan_slab_alloc+0xf/0x20 mm/kasan/common.c:411 kmem_cache_alloc_node+0x144/0x710 mm/slab.c:3633 alloc_task_struct_node kernel/fork.c:158 [inline] dup_task_struct kernel/fork.c:845 [inline] copy_process+0x405b/0x8710 kernel/fork.c:1753 _do_fork+0x1a9/0x1170 kernel/fork.c:2227 __do_sys_clone kernel/fork.c:2334 [inline] __se_sys_clone kernel/fork.c:2328 [inline] __x64_sys_clone+0xbf/0x150 kernel/fork.c:2328 do_syscall_64+0x1a3/0x800 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 18850: save_stack+0x45/0xd0 mm/kasan/common.c:73 set_track mm/kasan/common.c:85 [inline] __kasan_slab_free+0x102/0x150 mm/kasan/common.c:458 kasan_slab_free+0xe/0x10 mm/kasan/common.c:466 __cache_free mm/slab.c:3487 [inline] kmem_cache_free+0x86/0x260 mm/slab.c:3749 free_task_struct kernel/fork.c:163 [inline] free_task+0x170/0x1f0 kernel/fork.c:458 copy_process+0x10c8/0x8710 kernel/fork.c:2159 _do_fork+0x1a9/0x1170 kernel/fork.c:2227 __do_sys_clone kernel/fork.c:2334 [inline] __se_sys_clone kernel/fork.c:2328 [inline] __x64_sys_clone+0xbf/0x150 kernel/fork.c:2328 do_syscall_64+0x1a3/0x800 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff888090be60c0 which belongs to the cache task_struct(17:syz0) of size 6080 The buggy address is located 32 bytes inside of 6080-byte region [ffff888090be60c0, ffff888090be7880) The buggy address belongs to the page: page:ffffea000242f980 count:1 mapcount:0 mapping:ffff8880a9231d80 index:0x0 compound_mapcount: 0 flags: 0x1fffc0000010200(slab|head) raw: 01fffc0000010200 ffffea0000354788 ffffea00003c2c88 ffff8880a9231d80 raw: 0000000000000000 ffff888090be60c0 0000000100000001 ffff88805ab341c0 page dumped because: kasan: bad access detected page->mem_cgroup:ffff88805ab341c0 Memory state around the buggy address: ffff888090be5f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888090be6000: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888090be6080: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb ^ ffff888090be6100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888090be6180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================