syzbot


KASAN: use-after-free Write in pipe_release

Status: upstream: reported syz repro on 2020/08/29 04:12
Reported-by: syzbot+04754da9d40778c6dfb3@syzkaller.appspotmail.com
First crash: 830d, last: 830d
Patch testing requests:
Created Duration User Patch Repo Result
2022/08/27 13:27 0m retest repro https://android.googlesource.com/kernel/common android-5.4 error

Sample crash report:
BUG: KASAN: use-after-free in atomic64_try_cmpxchg include/asm-generic/atomic-instrumented.h:1503 [inline]
BUG: KASAN: use-after-free in atomic_long_try_cmpxchg_acquire include/asm-generic/atomic-long.h:442 [inline]
BUG: KASAN: use-after-free in __mutex_trylock_fast kernel/locking/mutex.c:173 [inline]
BUG: KASAN: use-after-free in mutex_lock+0x99/0x110 kernel/locking/mutex.c:285
Write of size 8 at addr ffff8881c53c7100 by task syz-executor.0/2306

CPU: 1 PID: 2306 Comm: syz-executor.0 Not tainted 5.4.61-syzkaller-00823-g34364883b1f7 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x14a/0x1ce lib/dump_stack.c:118
 print_address_description+0x93/0x620 mm/kasan/report.c:374
 __kasan_report+0x16d/0x1e0 mm/kasan/report.c:506
 kasan_report+0x36/0x60 mm/kasan/common.c:634
 check_memory_region_inline mm/kasan/generic.c:181 [inline]
 check_memory_region+0x2b5/0x2f0 mm/kasan/generic.c:191
 atomic64_try_cmpxchg include/asm-generic/atomic-instrumented.h:1503 [inline]
 atomic_long_try_cmpxchg_acquire include/asm-generic/atomic-long.h:442 [inline]
 __mutex_trylock_fast kernel/locking/mutex.c:173 [inline]
 mutex_lock+0x99/0x110 kernel/locking/mutex.c:285
 __pipe_lock fs/pipe.c:84 [inline]
 pipe_release+0x47/0x300 fs/pipe.c:590
 __fput+0x27d/0x6c0 fs/file_table.c:280
 task_work_run+0x176/0x1a0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_usermode_loop arch/x86/entry/common.c:163 [inline]
 prepare_exit_to_usermode+0x286/0x2e0 arch/x86/entry/common.c:194
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x416f01
Code: 75 14 b8 03 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 04 1b 00 00 c3 48 83 ec 08 e8 0a fc ff ff 48 89 04 24 b8 03 00 00 00 0f 05 <48> 8b 3c 24 48 89 c2 e8 53 fc ff ff 48 89 d0 48 83 c4 08 48 3d 01
RSP: 002b:00007ffe566e09a0 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000005 RCX: 0000000000416f01
RDX: 0000000000000000 RSI: 0000000000000081 RDI: 0000000000000004
RBP: 0000000000000000 R08: 0000000001190408 R09: 0000000000000000
R10: 00007ffe566e0a80 R11: 0000000000000293 R12: 0000000001190410
R13: 0000000000000000 R14: ffffffffffffffff R15: 000000000118cf4c

Allocated by task 2307:
 save_stack mm/kasan/common.c:69 [inline]
 set_track mm/kasan/common.c:77 [inline]
 __kasan_kmalloc+0x12c/0x1c0 mm/kasan/common.c:510
 kmem_cache_alloc_trace+0xc3/0x280 mm/slub.c:2820
 kmalloc include/linux/slab.h:556 [inline]
 kzalloc include/linux/slab.h:690 [inline]
 alloc_pipe_info+0xa1/0x3a0 fs/pipe.c:659
 get_pipe_inode fs/pipe.c:738 [inline]
 create_pipe_files+0x85/0x620 fs/pipe.c:770
 __do_pipe_flags+0x46/0x200 fs/pipe.c:807
 do_pipe2+0xee/0x350 fs/pipe.c:855
 __do_sys_pipe2 fs/pipe.c:873 [inline]
 __se_sys_pipe2 fs/pipe.c:871 [inline]
 __x64_sys_pipe2+0x56/0x60 fs/pipe.c:871
 do_syscall_64+0xcb/0x150 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 2307:
 save_stack mm/kasan/common.c:69 [inline]
 set_track mm/kasan/common.c:77 [inline]
 kasan_set_free_info mm/kasan/common.c:332 [inline]
 __kasan_slab_free+0x181/0x230 mm/kasan/common.c:471
 slab_free_hook mm/slub.c:1443 [inline]
 slab_free_freelist_hook+0xd0/0x150 mm/slub.c:1476
 slab_free mm/slub.c:3041 [inline]
 kfree+0x12b/0x600 mm/slub.c:4002
 put_pipe_info fs/pipe.c:582 [inline]
 pipe_release+0x216/0x300 fs/pipe.c:603
 __fput+0x27d/0x6c0 fs/file_table.c:280
 task_work_run+0x176/0x1a0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_usermode_loop arch/x86/entry/common.c:163 [inline]
 prepare_exit_to_usermode+0x286/0x2e0 arch/x86/entry/common.c:194
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

The buggy address belongs to the object at ffff8881c53c7100
 which belongs to the cache kmalloc-192 of size 192
The buggy address is located 0 bytes inside of
 192-byte region [ffff8881c53c7100, ffff8881c53c71c0)
The buggy address belongs to the page:
page:ffffea000714f1c0 refcount:1 mapcount:0 mapping:ffff8881da802a00 index:0xffff8881c53c7500
flags: 0x8000000000000200(slab)
raw: 8000000000000200 ffffea0007130940 0000000c0000000c ffff8881da802a00
raw: ffff8881c53c7500 000000008010000c 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8881c53c7000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8881c53c7080: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc
>ffff8881c53c7100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff8881c53c7180: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8881c53c7200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (1):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-android-5-4-kasan 2020/08/29 04:12 https://android.googlesource.com/kernel/common android-5.4 34364883b1f7 d5a3ae1f .config log report syz
* Struck through repros no longer work on HEAD.