KASAN: use-after-free Read in chrdev_open

14 views
Skip to first unread message

syzbot

unread,
Feb 3, 2021, 3:18:15 AM2/3/21
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 2c8a3fce Linux 4.14.218
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=10dbbeacd00000
kernel config: https://syzkaller.appspot.com/x/.config?x=80e596b8b0902d96
dashboard link: https://syzkaller.appspot.com/bug?extid=c05684cca229196d876c
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=16107590d00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1664d88cd00000

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

==================================================================
BUG: KASAN: use-after-free in __list_add_valid+0x81/0xa0 lib/list_debug.c:23
Read of size 8 at addr ffff8880aae3da08 by task syz-executor452/7966

CPU: 0 PID: 7966 Comm: syz-executor452 Not tainted 4.14.218-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x1b2/0x281 lib/dump_stack.c:58
print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351
kasan_report mm/kasan/report.c:409 [inline]
__asan_report_load8_noabort+0x68/0x70 mm/kasan/report.c:430
__list_add_valid+0x81/0xa0 lib/list_debug.c:23
__list_add include/linux/list.h:60 [inline]
list_add include/linux/list.h:79 [inline]
chrdev_open+0x45c/0x6d0 fs/char_dev.c:405
do_dentry_open+0x44b/0xec0 fs/open.c:777
vfs_open+0x105/0x220 fs/open.c:888
do_last fs/namei.c:3428 [inline]
path_openat+0x628/0x2970 fs/namei.c:3569
do_filp_open+0x179/0x3c0 fs/namei.c:3603
do_sys_open+0x296/0x410 fs/open.c:1081
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x446849
RSP: 002b:00007fc385e522f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000055
RAX: ffffffffffffffda RBX: 00000000004d0530 RCX: 0000000000446849
RDX: 00007fc385e52700 RSI: 0000000000000000 RDI: 00000000200001c0
RBP: 00000000004a013c R08: 00007fc385e52700 R09: 0000000000000000
R10: 00007fc385e52700 R11: 0000000000000246 R12: 0030656c69662f2e
R13: 000000000049e138 R14: 2f30656c69662f2e R15: 00000000004d0538

Allocated by task 7957:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
kmem_cache_alloc+0x124/0x3c0 mm/slab.c:3552
fuse_alloc_inode+0x1d/0x3f0 fs/fuse/inode.c:87
alloc_inode+0x5d/0x170 fs/inode.c:210
iget5_locked+0x169/0x450 fs/inode.c:1050
fuse_iget+0x164/0x730 fs/fuse/inode.c:307
fuse_lookup_name+0x3bb/0x550 fs/fuse/dir.c:341
fuse_lookup+0xcd/0x390 fs/fuse/dir.c:368
fuse_atomic_open+0x1bb/0x2d0 fs/fuse/dir.c:508
atomic_open fs/namei.c:3075 [inline]
lookup_open+0xe0e/0x1750 fs/namei.c:3211
do_last fs/namei.c:3334 [inline]
path_openat+0xe08/0x2970 fs/namei.c:3569
do_filp_open+0x179/0x3c0 fs/namei.c:3603
do_sys_open+0x296/0x410 fs/open.c:1081
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 0:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kmem_cache_free+0x7c/0x2b0 mm/slab.c:3758
__rcu_reclaim kernel/rcu/rcu.h:195 [inline]
rcu_do_batch kernel/rcu/tree.c:2699 [inline]
invoke_rcu_callbacks kernel/rcu/tree.c:2962 [inline]
__rcu_process_callbacks kernel/rcu/tree.c:2929 [inline]
rcu_process_callbacks+0x780/0x1180 kernel/rcu/tree.c:2946
__do_softirq+0x24d/0x9ff kernel/softirq.c:288

The buggy address belongs to the object at ffff8880aae3d680
which belongs to the cache fuse_inode of size 1272
The buggy address is located 904 bytes inside of
1272-byte region [ffff8880aae3d680, ffff8880aae3db78)
The buggy address belongs to the page:
page:ffffea0002ab8f00 count:1 mapcount:0 mapping:ffff8880aae3c080 index:0xffff8880aae3dffb compound_mapcount: 0
flags: 0xfff00000008100(slab|head)
raw: 00fff00000008100 ffff8880aae3c080 ffff8880aae3dffb 0000000100000005
raw: ffffea000257b8a0 ffff8880b133a548 ffff8880b1326540 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880aae3d900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880aae3d980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880aae3da00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880aae3da80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880aae3db00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc
==================================================================


---
This report 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 issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

syzbot

unread,
Feb 10, 2021, 11:55:22 PM2/10/21
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 811218ec Linux 4.19.172
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=17f08088d00000
kernel config: https://syzkaller.appspot.com/x/.config?x=c1cb1d27398c8808
dashboard link: https://syzkaller.appspot.com/bug?extid=7c5ec771fa8a51b6c096
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=127b0338d00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1166ecd2d00000

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

==================================================================
BUG: KASAN: use-after-free in __list_add_valid+0x81/0xa0 syzkaller/managers/linux-4-19/kernel/lib/list_debug.c:23
Read of size 8 at addr ffff88808dfc1980 by task syz-executor133/8113

CPU: 0 PID: 8113 Comm: syz-executor133 Not tainted 4.19.172-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack syzkaller/managers/linux-4-19/kernel/lib/dump_stack.c:77 [inline]
dump_stack+0x1fc/0x2ef syzkaller/managers/linux-4-19/kernel/lib/dump_stack.c:118
print_address_description.cold+0x54/0x219 syzkaller/managers/linux-4-19/kernel/mm/kasan/report.c:256
kasan_report_error.cold+0x8a/0x1b9 syzkaller/managers/linux-4-19/kernel/mm/kasan/report.c:354
kasan_report syzkaller/managers/linux-4-19/kernel/mm/kasan/report.c:412 [inline]
__asan_report_load8_noabort+0x88/0x90 syzkaller/managers/linux-4-19/kernel/mm/kasan/report.c:433
__list_add_valid+0x81/0xa0 syzkaller/managers/linux-4-19/kernel/lib/list_debug.c:23
__list_add syzkaller/managers/linux-4-19/kernel/./include/linux/list.h:60 [inline]
list_add syzkaller/managers/linux-4-19/kernel/./include/linux/list.h:79 [inline]
chrdev_open+0x4b9/0x770 syzkaller/managers/linux-4-19/kernel/fs/char_dev.c:405
do_dentry_open+0x4aa/0x1160 syzkaller/managers/linux-4-19/kernel/fs/open.c:796
do_last syzkaller/managers/linux-4-19/kernel/fs/namei.c:3421 [inline]
path_openat+0x793/0x2df0 syzkaller/managers/linux-4-19/kernel/fs/namei.c:3537
do_filp_open+0x18c/0x3f0 syzkaller/managers/linux-4-19/kernel/fs/namei.c:3567
do_sys_open+0x3b3/0x520 syzkaller/managers/linux-4-19/kernel/fs/open.c:1085
do_syscall_64+0xf9/0x620 syzkaller/managers/linux-4-19/kernel/arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x446849
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 41 15 00 00 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 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fbaae0db2f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000055
RAX: ffffffffffffffda RBX: 00000000004d0530 RCX: 0000000000446849
RDX: 00007fbaae0db700 RSI: 0000000000000000 RDI: 00000000200001c0
RBP: 00000000004a013c R08: 00007fbaae0db700 R09: 0000000000000000
R10: 00007fbaae0db700 R11: 0000000000000246 R12: 0030656c69662f2e
R13: 000000000049e138 R14: 2f30656c69662f2e R15: 00000000004d0538

Allocated by task 8104:
kmem_cache_alloc+0x122/0x370 syzkaller/managers/linux-4-19/kernel/mm/slab.c:3559
fuse_alloc_inode+0x1d/0x3f0 syzkaller/managers/linux-4-19/kernel/fs/fuse/inode.c:87
alloc_inode+0x5d/0x180 syzkaller/managers/linux-4-19/kernel/fs/inode.c:211
iget5_locked syzkaller/managers/linux-4-19/kernel/fs/inode.c:1131 [inline]
iget5_locked+0x57/0xd0 syzkaller/managers/linux-4-19/kernel/fs/inode.c:1124
fuse_iget+0x1a6/0x800 syzkaller/managers/linux-4-19/kernel/fs/fuse/inode.c:307
fuse_lookup_name+0x413/0x5c0 syzkaller/managers/linux-4-19/kernel/fs/fuse/dir.c:341
fuse_lookup+0xdf/0x410 syzkaller/managers/linux-4-19/kernel/fs/fuse/dir.c:368
fuse_atomic_open+0x20a/0x330 syzkaller/managers/linux-4-19/kernel/fs/fuse/dir.c:508
atomic_open syzkaller/managers/linux-4-19/kernel/fs/namei.c:3073 [inline]
lookup_open+0x1023/0x1a20 syzkaller/managers/linux-4-19/kernel/fs/namei.c:3205
do_last syzkaller/managers/linux-4-19/kernel/fs/namei.c:3327 [inline]
path_openat+0x1094/0x2df0 syzkaller/managers/linux-4-19/kernel/fs/namei.c:3537
do_filp_open+0x18c/0x3f0 syzkaller/managers/linux-4-19/kernel/fs/namei.c:3567
do_sys_open+0x3b3/0x520 syzkaller/managers/linux-4-19/kernel/fs/open.c:1085
do_syscall_64+0xf9/0x620 syzkaller/managers/linux-4-19/kernel/arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 0:
__cache_free syzkaller/managers/linux-4-19/kernel/mm/slab.c:3503 [inline]
kmem_cache_free+0x7f/0x260 syzkaller/managers/linux-4-19/kernel/mm/slab.c:3765
__rcu_reclaim syzkaller/managers/linux-4-19/kernel/kernel/rcu/rcu.h:236 [inline]
rcu_do_batch syzkaller/managers/linux-4-19/kernel/kernel/rcu/tree.c:2584 [inline]
invoke_rcu_callbacks syzkaller/managers/linux-4-19/kernel/kernel/rcu/tree.c:2897 [inline]
__rcu_process_callbacks syzkaller/managers/linux-4-19/kernel/kernel/rcu/tree.c:2864 [inline]
rcu_process_callbacks+0x8ff/0x18b0 syzkaller/managers/linux-4-19/kernel/kernel/rcu/tree.c:2881
__do_softirq+0x265/0x980 syzkaller/managers/linux-4-19/kernel/kernel/softirq.c:292

The buggy address belongs to the object at ffff88808dfc1600
which belongs to the cache fuse_inode of size 1264
The buggy address is located 896 bytes inside of
1264-byte region [ffff88808dfc1600, ffff88808dfc1af0)
The buggy address belongs to the page:
page:ffffea000237f040 count:1 mapcount:0 mapping:ffff888239712c80 index:0xffff88808dfc1ffe
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffffea000237da48 ffff8880b0e3b648 ffff888239712c80
raw: ffff88808dfc1ffe ffff88808dfc1080 0000000100000002 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88808dfc1880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88808dfc1900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88808dfc1980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88808dfc1a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88808dfc1a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc
Reply all
Reply to author
Forward
0 new messages