KASAN: use-after-free Write in locks_delete_block

8 views
Skip to first unread message

syzbot

unread,
Jan 15, 2020, 5:48:11 AM1/15/20
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 4eb8e72c GKI: enable CONFIG_NETFILTER_XT_MATCH_QUOTA2_LOG=y
git tree: android-5.4
console output: https://syzkaller.appspot.com/x/log.txt?x=1416f33ee00000
kernel config: https://syzkaller.appspot.com/x/.config?x=91d4c67cb1d9be4f
dashboard link: https://syzkaller.appspot.com/bug?extid=49556d59de02d931f4a2
compiler: Android (6032204 based on r370808) clang version 10.0.1
(https://android.googlesource.com/toolchain/llvm-project
6e765c10313d15c02ab29977a82938f66742c3a9)

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+49556d...@syzkaller.appspotmail.com

==================================================================
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 ffff8881ca070808 by task syz-executor.4/8534

CPU: 0 PID: 8534 Comm: syz-executor.4 Not tainted
5.4.11-syzkaller-00393-g4eb8e72c3538 #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:0x45af49
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:00007f3c1dcd9c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000049
RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 000000000045af49
RDX: 0000000000000000 RSI: 0000000000000002 RDI: 0000000000000007
RBP: 000000000075bfc8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f3c1dcda6d4
R13: 00000000004c1b59 R14: 00000000004d70f0 R15: 00000000ffffffff

Allocated by task 8549:
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 8549:
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 ffff8881ca0707a8
which belongs to the cache file_lock_cache of size 216
The buggy address is located 96 bytes inside of
216-byte region [ffff8881ca0707a8, ffff8881ca070880)
The buggy address belongs to the page:
page:ffffea0007281c00 refcount:1 mapcount:0 mapping:ffff8881da8ec400
index:0x0
raw: 8000000000000200 dead000000000100 dead000000000122 ffff8881da8ec400
raw: 0000000000000000 00000000800e000e 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8881ca070700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8881ca070780: fc fc fc fc fc fb fb fb fb fb fb fb fb fb fb fb
> ffff8881ca070800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8881ca070880: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00
ffff8881ca070900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
Jul 17, 2020, 5:16:15 PM7/17/20
to syzkaller-a...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages