syzbot


KASAN: use-after-free Read in flock_lock_inode

Status: auto-closed as invalid on 2020/05/27 13:52
Reported-by: syzbot+f823d5b2f2147e22db6f@syzkaller.appspotmail.com
First crash: 1764d, last: 1764d

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __wake_up_common+0x6c/0x450 kernel/sched/wait.c:81
Read of size 8 at addr ffff8881cd36c5e0 by task syz-executor.2/16716

CPU: 0 PID: 16716 Comm: syz-executor.2 Not tainted 5.4.15-syzkaller-01128-gb2b96d09ef40 #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+0x1b0/0x228 lib/dump_stack.c:118
 print_address_description+0x96/0x5d0 mm/kasan/report.c:374
 __kasan_report+0x14b/0x1c0 mm/kasan/report.c:506
 kasan_report+0x26/0x50 mm/kasan/common.c:634
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:132
 __wake_up_common+0x6c/0x450 kernel/sched/wait.c:81
 __wake_up_common_lock kernel/sched/wait.c:123 [inline]
 __wake_up+0x145/0x210 kernel/sched/wait.c:142
 __locks_wake_up_blocks fs/locks.c:742 [inline]
 locks_wake_up_blocks fs/locks.c:850 [inline]
 locks_unlink_lock_ctx fs/locks.c:866 [inline]
 locks_delete_lock_ctx fs/locks.c:872 [inline]
 flock_lock_inode+0x1874/0x1c60 fs/locks.c:1069
 locks_remove_flock fs/locks.c:2715 [inline]
 locks_remove_file+0x3b5/0x10e0 fs/locks.c:2757
 __fput+0x1ea/0x710 fs/file_table.c:272
 ____fput+0x15/0x20 fs/file_table.c:313
 task_work_run+0x176/0x1a0 kernel/task_work.c:113
 get_signal+0x1e66/0x1ef0 kernel/signal.c:2528
 do_signal+0x83/0x5b0 arch/x86/kernel/signal.c:815
 exit_to_usermode_loop arch/x86/entry/common.c:159 [inline]
 prepare_exit_to_usermode+0x256/0x370 arch/x86/entry/common.c:194
 syscall_return_slowpath+0x6f/0x500 arch/x86/entry/common.c:274
 do_syscall_64+0xe8/0x100 arch/x86/entry/common.c:300
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x45b349
Code: ad b6 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 7b b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f5fcd292c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000049
RAX: 0000000000000000 RBX: 00007f5fcd2936d4 RCX: 000000000045b349
RDX: 0000000000000000 RSI: 0000000000000002 RDI: 0000000000000006
RBP: 000000000075c070 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 00000000000000c6 R14: 00000000004c201c R15: 000000000075c07c

Allocated by task 16711:
 save_stack mm/kasan/common.c:69 [inline]
 set_track mm/kasan/common.c:77 [inline]
 __kasan_kmalloc+0x117/0x1b0 mm/kasan/common.c:510
 kasan_slab_alloc+0xe/0x10 mm/kasan/common.c:518
 slab_post_alloc_hook mm/slab.h:584 [inline]
 slab_alloc_node mm/slub.c:2758 [inline]
 slab_alloc mm/slub.c:2766 [inline]
 kmem_cache_alloc+0x120/0x2b0 mm/slub.c:2771
 kmem_cache_zalloc include/linux/slab.h:680 [inline]
 locks_alloc_lock fs/locks.c:346 [inline]
 flock_make_lock fs/locks.c:487 [inline]
 __do_sys_flock fs/locks.c:2207 [inline]
 __se_sys_flock+0x156/0x560 fs/locks.c:2188
 __x64_sys_flock+0x5b/0x70 fs/locks.c:2188
 do_syscall_64+0xc0/0x100 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 16711:
 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+0x168/0x220 mm/kasan/common.c:471
 kasan_slab_free+0xe/0x10 mm/kasan/common.c:480
 slab_free_hook mm/slub.c:1424 [inline]
 slab_free_freelist_hook mm/slub.c:1457 [inline]
 slab_free mm/slub.c:3004 [inline]
 kmem_cache_free+0x181/0x7a0 mm/slub.c:3020
 locks_free_lock fs/locks.c:383 [inline]
 __do_sys_flock fs/locks.c:2228 [inline]
 __se_sys_flock+0x478/0x560 fs/locks.c:2188
 __x64_sys_flock+0x5b/0x70 fs/locks.c:2188
 do_syscall_64+0xc0/0x100 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

The buggy address belongs to the object at ffff8881cd36c578
 which belongs to the cache file_lock_cache of size 216
The buggy address is located 104 bytes inside of
 216-byte region [ffff8881cd36c578, ffff8881cd36c650)
The buggy address belongs to the page:
page:ffffea000734db00 refcount:1 mapcount:0 mapping:ffff8881da8ed200 index:0x0
raw: 8000000000000200 dead000000000100 dead000000000122 ffff8881da8ed200
raw: 0000000000000000 00000000000e000e 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8881cd36c480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881cd36c500: fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc fb
>ffff8881cd36c580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                       ^
 ffff8881cd36c600: fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc
 ffff8881cd36c680: fc fc fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/01/28 13:51 https://android.googlesource.com/kernel/common android-5.4 b2b96d09ef40 56cd6c9b .config console log report ci2-android-5-4-kasan
* Struck through repros no longer work on HEAD.