KASAN: use-after-free Read in locks_delete_block

18 views
Skip to first unread message

syzbot

unread,
Jan 11, 2020, 7:44:13 AM1/11/20
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: f5f770e4 ANDROID: Kconfig.gki: Add QCOM_SCM to QCOM Hidden..
git tree: android-5.4
console output: https://syzkaller.appspot.com/x/log.txt?x=11505021e00000
kernel config: https://syzkaller.appspot.com/x/.config?x=91fe4507c5782603
dashboard link: https://syzkaller.appspot.com/bug?extid=df3080e48a69330f7ae3
compiler: Android (6032204 based on r370808) clang version 10.0.1
(https://android.googlesource.com/toolchain/llvm-project
6e765c10313d15c02ab29977a82938f66742c3a9)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=125223fee00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=130845c6e00000

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

==================================================================
BUG: KASAN: use-after-free in __wake_up_common+0x6c/0x450
kernel/sched/wait.c:81
Read of size 8 at addr ffff8881d42e1180 by task syz-executor332/22865

CPU: 0 PID: 22865 Comm: syz-executor332 Not tainted
5.4.10-syzkaller-00217-gf5f770e495ba #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_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:0x446e49
Code: e8 dc e6 ff ff 48 83 c4 18 c3 0f 1f 80 00 00 00 00 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 2b 06 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fa0afdf8db8 EFLAGS: 00000246 ORIG_RAX: 0000000000000049
RAX: ffffffffffffffda RBX: 00000000006dcc48 RCX: 0000000000446e49
RDX: 0000000000446e49 RSI: 0000000000000001 RDI: 0000000000000003
RBP: 00000000006dcc40 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006dcc4c
R13: 00007fffbbd8081f R14: 00007fa0afdf99c0 R15: 20c49ba5e353f7cf

Allocated by task 22870:
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 22870:
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 ffff8881d42e1118
which belongs to the cache file_lock_cache of size 216
The buggy address is located 104 bytes inside of
216-byte region [ffff8881d42e1118, ffff8881d42e11f0)
The buggy address belongs to the page:
page:ffffea000750b840 refcount:1 mapcount:0 mapping:ffff8881da8eca00
index:0x0
raw: 8000000000000200 0000000000000000 0000000c00000001 ffff8881da8eca00
raw: 0000000000000000 00000000000e000e 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8881d42e1080: fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc
ffff8881d42e1100: fc fc fc fb fb fb fb fb fb fb fb fb fb fb fb fb
> ffff8881d42e1180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc
^
ffff8881d42e1200: fc fc fc fc fc fc fb fb fb fb fb fb fb fb fb fb
ffff8881d42e1280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
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 can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches

Dmitry Vyukov

unread,
Mar 30, 2020, 6:23:37 AM3/30/20
to syzbot, syzkaller-a...@googlegroups.com
FTR, see https://bugzilla.kernel.org/show_bug.cgi?id=205705
> --
> You received this message because you are subscribed to the Google Groups "syzkaller-android-bugs" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to syzkaller-android...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/syzkaller-android-bugs/00000000000063185d059bdc994f%40google.com.
Reply all
Reply to author
Forward
0 new messages