syzbot


KASAN: use-after-free Write in locks_delete_block

Status: auto-closed as invalid on 2020/07/17 21:16
Reported-by: syzbot+49556d59de02d931f4a2@syzkaller.appspotmail.com
First crash: 1774d, last: 1709d

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in atomic_try_cmpxchg include/asm-generic/atomic-instrumented.h:693 [inline]
BUG: KASAN: use-after-free in queued_spin_lock include/asm-generic/qspinlock.h:78 [inline]
BUG: KASAN: use-after-free in do_raw_spin_lock_flags include/linux/spinlock.h:193 [inline]
BUG: KASAN: use-after-free in __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:119 [inline]
BUG: KASAN: use-after-free in _raw_spin_lock_irqsave+0xcd/0x1c0 kernel/locking/spinlock.c:159
Write of size 4 at addr ffff8881d70cc808 by task syz-executor.3/27075

CPU: 1 PID: 27075 Comm: syz-executor.3 Not tainted 5.4.26-syzkaller-00556-gfe54c238b38a #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
 check_memory_region_inline mm/kasan/generic.c:182 [inline]
 check_memory_region+0x2c6/0x300 mm/kasan/generic.c:192
 __kasan_check_write+0x14/0x20 mm/kasan/common.c:98
 atomic_try_cmpxchg include/asm-generic/atomic-instrumented.h:693 [inline]
 queued_spin_lock include/asm-generic/qspinlock.h:78 [inline]
 do_raw_spin_lock_flags include/linux/spinlock.h:193 [inline]
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:119 [inline]
 _raw_spin_lock_irqsave+0xcd/0x1c0 kernel/locking/spinlock.c:159
 __wake_up_common_lock kernel/sched/wait.c:122 [inline]
 __wake_up+0x128/0x210 kernel/sched/wait.c:142
 __locks_wake_up_blocks fs/locks.c:742 [inline]
 locks_delete_block+0x30d/0x560 fs/locks.c:773
 locks_lock_inode_wait+0x364/0x3f0 fs/locks.c:2140
 locks_lock_file_wait include/linux/fs.h:1328 [inline]
 __do_sys_flock fs/locks.c:2225 [inline]
 __se_sys_flock+0x45b/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
RIP: 0033:0x45c849
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:00007fea27fecc78 EFLAGS: 00000246 ORIG_RAX: 0000000000000049
RAX: ffffffffffffffda RBX: 00007fea27fed6d4 RCX: 000000000045c849
RDX: 0000000000000000 RSI: 0000000000000002 RDI: 0000000000000006
RBP: 000000000076bf00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 00000000000000ca R14: 00000000004c355b R15: 000000000076bf0c

Allocated by task 27082:
 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 27082:
 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 ffff8881d70cc7a8
 which belongs to the cache file_lock_cache of size 216
The buggy address is located 96 bytes inside of
 216-byte region [ffff8881d70cc7a8, ffff8881d70cc880)
The buggy address belongs to the page:
page:ffffea00075c3300 refcount:1 mapcount:0 mapping:ffff8881da8e7800 index:0x0
flags: 0x8000000000000200(slab)
raw: 8000000000000200 ffffea00069829c0 0000000800000008 ffff8881da8e7800
raw: 0000000000000000 00000000800e000e 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8881d70cc700: fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc
 ffff8881d70cc780: fc fc fc fc fc fb fb fb fb fb fb fb fb fb fb fb
>ffff8881d70cc800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                      ^
 ffff8881d70cc880: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
 ffff8881d70cc900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/03/19 21:16 https://android.googlesource.com/kernel/common android-5.4 fe54c238b38a 2c31c529 .config console log report ci2-android-5-4-kasan
2020/01/15 10:47 https://android.googlesource.com/kernel/common android-5.4 4eb8e72c3538 fa12bd3c .config console log report ci2-android-5-4-kasan
* Struck through repros no longer work on HEAD.