syzbot


KASAN: use-after-free Read in __sock_release

Status: auto-closed as invalid on 2021/01/01 16:13
Reported-by: syzbot+7b4b02d0d7af3aa4f5ab@syzkaller.appspotmail.com
First crash: 664d, last: 664d
similar bugs (1):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in __sock_release syz done 3 664d 672d 1/1 fixed on 2020/10/05 13:19

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in atomic64_read include/asm-generic/atomic-instrumented.h:27 [inline]
BUG: KASAN: use-after-free in atomic_long_read include/asm-generic/atomic-long.h:47 [inline]
BUG: KASAN: use-after-free in __rwsem_down_write_failed_common kernel/locking/rwsem-xadd.c:591 [inline]
BUG: KASAN: use-after-free in rwsem_down_write_failed+0x401/0x760 kernel/locking/rwsem-xadd.c:618
Read of size 8 at addr ffff88804d95db88 by task syz-executor.4/20164

CPU: 0 PID: 20164 Comm: syz-executor.4 Not tainted 4.19.143-syzkaller #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+0x1fc/0x2fe lib/dump_stack.c:118
 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
 kasan_report_error.cold+0x8a/0x1c7 mm/kasan/report.c:354
 kasan_report+0x8f/0x96 mm/kasan/report.c:412
 atomic64_read include/asm-generic/atomic-instrumented.h:27 [inline]
 atomic_long_read include/asm-generic/atomic-long.h:47 [inline]
 __rwsem_down_write_failed_common kernel/locking/rwsem-xadd.c:591 [inline]
 rwsem_down_write_failed+0x401/0x760 kernel/locking/rwsem-xadd.c:618
 call_rwsem_down_write_failed+0x13/0x20 arch/x86/lib/rwsem.S:117
 __down_write arch/x86/include/asm/rwsem.h:142 [inline]
 down_write+0x4f/0x90 kernel/locking/rwsem.c:72
 inode_lock include/linux/fs.h:748 [inline]
 __sock_release+0x86/0x2a0 net/socket.c:578
 sock_close+0x15/0x20 net/socket.c:1140
 __fput+0x2ce/0x890 fs/file_table.c:278
 task_work_run+0x148/0x1c0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:193 [inline]
 exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167
 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
 do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x45d5b9
Code: 5d b4 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 2b b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fd875138c78 EFLAGS: 00000246 ORIG_RAX: 00000000000000e9
RAX: 0000000000000000 RBX: 0000000000002ac0 RCX: 000000000045d5b9
RDX: 0000000000000008 RSI: 0000000000000001 RDI: 0000000000000007
RBP: 000000000118cf88 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000020d5dff4 R11: 0000000000000246 R12: 000000000118cf4c
R13: 00007ffc77c7883f R14: 00007fd8751399c0 R15: 000000000118cf4c

Allocated by task 20164:
netlink: 52 bytes leftover after parsing attributes in process `syz-executor.5'.
 kmem_cache_alloc+0x122/0x370 mm/slab.c:3559
 sock_alloc_inode+0x19/0x250 net/socket.c:244
 alloc_inode+0x5d/0x180 fs/inode.c:211
 new_inode_pseudo+0x14/0xe0 fs/inode.c:911
 sock_alloc+0x3c/0x260 net/socket.c:547
 __sock_create+0xba/0x740 net/socket.c:1240
 sock_create net/socket.c:1316 [inline]
 __sys_socket+0xef/0x200 net/socket.c:1346
 __do_sys_socket net/socket.c:1355 [inline]
 __se_sys_socket net/socket.c:1353 [inline]
 __x64_sys_socket+0x6f/0xb0 net/socket.c:1353
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 20160:
 __cache_free mm/slab.c:3503 [inline]
 kmem_cache_free+0x7f/0x260 mm/slab.c:3765
 destroy_inode+0xb9/0x110 fs/inode.c:268
 iput_final fs/inode.c:1555 [inline]
 iput+0x4f1/0x860 fs/inode.c:1581
 dentry_unlink_inode+0x265/0x320 fs/dcache.c:374
 __dentry_kill+0x3c0/0x640 fs/dcache.c:566
 dentry_kill+0xc4/0x510 fs/dcache.c:685
 dput+0x55f/0x640 fs/dcache.c:846
 __fput+0x415/0x890 fs/file_table.c:291
 task_work_run+0x148/0x1c0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:193 [inline]
 exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167
 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
 do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff88804d95da80
 which belongs to the cache sock_inode_cache of size 992
The buggy address is located 264 bytes inside of
 992-byte region [ffff88804d95da80, ffff88804d95de60)
The buggy address belongs to the page:
page:ffffea0001365740 count:1 mapcount:0 mapping:ffff88821b6c3000 index:0xffff88804d95dffd
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffffea0002003588 ffffea0002006908 ffff88821b6c3000
raw: ffff88804d95dffd ffff88804d95d180 0000000100000003 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88804d95da80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88804d95db00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88804d95db80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                      ^
netlink: 4 bytes leftover after parsing attributes in process `syz-executor.3'.
 ffff88804d95dc00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88804d95dc80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-19 2020/09/03 16:12 linux-4.19.y c37da90efff5 abf9ba4f .config log report