syzbot


KASAN: use-after-free Read in sock_i_ino

Status: fixed on 2018/09/26 21:51
Subsystems: tipc
[Documentation on labels]
Reported-by: syzbot+48804b87c16588ad491d@syzkaller.appspotmail.com
Fix commit: 0a3b8b2b215f tipc: orphan sock in tipc_release()
First crash: 2266d, last: 2252d
Discussions (3)
Title Replies (including bot) Last reply
[PATCH 4.18 000/235] 4.18.10-stable review 261 (261) 2018/10/09 15:15
[Patch net] tipc: call start and done ops directly in __tipc_nl_compat_dumpit() 6 (6) 2018/09/06 05:15
KASAN: use-after-free Read in sock_i_ino 0 (1) 2018/09/03 19:31

Sample crash report:
IPv6: ADDRCONF(NETDEV_UP): veth1: link is not ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth1: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth0: link becomes ready
8021q: adding VLAN 0 to HW filter on device team0
==================================================================
BUG: KASAN: use-after-free in sock_i_ino+0x94/0xa0 net/core/sock.c:1921
Read of size 8 at addr ffff8801b38330b0 by task syz-executor0/5635

CPU: 1 PID: 5635 Comm: syz-executor0 Not tainted 4.19.0-rc3+ #232
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+0x1c4/0x2b4 lib/dump_stack.c:113
 print_address_description.cold.8+0x9/0x1ff mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.9+0x242/0x309 mm/kasan/report.c:412
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
 sock_i_ino+0x94/0xa0 net/core/sock.c:1921
 tipc_sk_fill_sock_diag+0x39c/0xd90 net/tipc/socket.c:3316
 __tipc_add_sock_diag+0x233/0x360 net/tipc/diag.c:62
 tipc_nl_sk_walk+0x122/0x1d0 net/tipc/socket.c:3250
 tipc_diag_dump+0x24/0x30 net/tipc/diag.c:73
 netlink_dump+0x519/0xd50 net/netlink/af_netlink.c:2233
 __netlink_dump_start+0x4f1/0x6f0 net/netlink/af_netlink.c:2329
 netlink_dump_start include/linux/netlink.h:213 [inline]
 tipc_sock_diag_handler_dump+0x28e/0x3d0 net/tipc/diag.c:91
 __sock_diag_cmd net/core/sock_diag.c:232 [inline]
 sock_diag_rcv_msg+0x31d/0x410 net/core/sock_diag.c:263
 netlink_rcv_skb+0x172/0x440 net/netlink/af_netlink.c:2454
 sock_diag_rcv+0x2a/0x40 net/core/sock_diag.c:274
 netlink_unicast_kernel net/netlink/af_netlink.c:1317 [inline]
 netlink_unicast+0x5a5/0x760 net/netlink/af_netlink.c:1343
 netlink_sendmsg+0xa18/0xfc0 net/netlink/af_netlink.c:1908
 sock_sendmsg_nosec net/socket.c:621 [inline]
 sock_sendmsg+0xd5/0x120 net/socket.c:631
 ___sys_sendmsg+0x7fd/0x930 net/socket.c:2114
 __sys_sendmsg+0x11d/0x280 net/socket.c:2152
 __do_sys_sendmsg net/socket.c:2161 [inline]
 __se_sys_sendmsg net/socket.c:2159 [inline]
 __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2159
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x4572d9
Code: fd 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 cb b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f41f40adc78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f41f40ae6d4 RCX: 00000000004572d9
RDX: 0000000000000000 RSI: 0000000020000040 RDI: 0000000000000006
RBP: 00000000009300a0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 00000000004d4f40 R14: 00000000004c941e R15: 0000000000000000

Allocated by task 5635:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:553
 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:490
 kmem_cache_alloc+0x12e/0x730 mm/slab.c:3554
 sock_alloc_inode+0x1d/0x260 net/socket.c:244
 alloc_inode+0x63/0x190 fs/inode.c:210
 new_inode_pseudo+0x71/0x1a0 fs/inode.c:903
 sock_alloc+0x41/0x270 net/socket.c:547
 __sock_create+0x175/0x930 net/socket.c:1239
 sock_create net/socket.c:1315 [inline]
 __sys_socket+0x106/0x260 net/socket.c:1345
 __do_sys_socket net/socket.c:1354 [inline]
 __se_sys_socket net/socket.c:1352 [inline]
 __x64_sys_socket+0x73/0xb0 net/socket.c:1352
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 5634:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kmem_cache_free+0x83/0x290 mm/slab.c:3756
 sock_destroy_inode+0x51/0x60 net/socket.c:272
 destroy_inode+0x159/0x200 fs/inode.c:267
 evict+0x5e0/0x980 fs/inode.c:575
 iput_final fs/inode.c:1547 [inline]
 iput+0x679/0xa90 fs/inode.c:1573
 dentry_unlink_inode+0x461/0x5e0 fs/dcache.c:374
 __dentry_kill+0x44c/0x7a0 fs/dcache.c:566
 dentry_kill+0xc9/0x5a0 fs/dcache.c:685
 dput.part.26+0x660/0x790 fs/dcache.c:846
 dput+0x15/0x20 fs/dcache.c:828
 __fput+0x4cf/0xa30 fs/file_table.c:291
 ____fput+0x15/0x20 fs/file_table.c:309
 task_work_run+0x1e8/0x2a0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:193 [inline]
 exit_to_usermode_loop+0x318/0x380 arch/x86/entry/common.c:166
 prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:268 [inline]
 do_syscall_64+0x6be/0x820 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8801b3833040
 which belongs to the cache sock_inode_cache(17:syz0) of size 984
The buggy address is located 112 bytes inside of
 984-byte region [ffff8801b3833040, ffff8801b3833418)
The buggy address belongs to the page:
page:ffffea0006ce0cc0 count:1 mapcount:0 mapping:ffff8801ca015800 index:0xffff8801b3833ffd
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffffea0006ce0c08 ffffea0006ce0d08 ffff8801ca015800
raw: ffff8801b3833ffd ffff8801b3833040 0000000100000003 ffff8801ce8a4640
page dumped because: kasan: bad access detected
page->mem_cgroup:ffff8801ce8a4640

Memory state around the buggy address:
 ffff8801b3832f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8801b3833000: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
>ffff8801b3833080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                     ^
 ffff8801b3833100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801b3833180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (127):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/09/12 08:52 upstream 5e335542de83 3c88136c .config console log report syz ci-upstream-kasan-gce-root
2018/09/12 07:37 upstream 5e335542de83 3c88136c .config console log report syz ci-upstream-kasan-gce-selinux-root
2018/09/11 07:42 upstream 11da3a7f84f1 8c88323f .config console log report syz ci-upstream-kasan-gce
2018/09/10 12:52 upstream 11da3a7f84f1 6b5120a4 .config console log report syz ci-upstream-kasan-gce-smack-root
2018/09/10 11:55 upstream 11da3a7f84f1 6b5120a4 .config console log report syz ci-upstream-kasan-gce-smack-root
2018/09/10 04:29 upstream 9a5682765a2e 6b5120a4 .config console log report syz ci-upstream-kasan-gce-selinux-root
2018/09/09 20:16 upstream 9a5682765a2e 6b5120a4 .config console log report syz ci-upstream-kasan-gce-selinux-root
2018/09/09 11:06 upstream f8f65382c98a 6b5120a4 .config console log report syz ci-upstream-kasan-gce-root
2018/09/08 15:37 upstream 3d0e7a9e00fd 6b5120a4 .config console log report syz ci-upstream-kasan-gce
2018/09/08 12:56 upstream 3d0e7a9e00fd 6b5120a4 .config console log report syz ci-upstream-kasan-gce
2018/09/08 06:44 upstream 3d0e7a9e00fd 6b5120a4 .config console log report syz ci-upstream-kasan-gce-root
2018/09/08 04:56 upstream 3d0e7a9e00fd 6b5120a4 .config console log report syz ci-upstream-kasan-gce-smack-root
2018/09/06 04:54 upstream b36fdc6853a3 873745f2 .config console log report syz ci-upstream-kasan-gce
2018/09/06 04:54 upstream b36fdc6853a3 873745f2 .config console log report syz ci-upstream-kasan-gce-selinux-root
2018/09/06 04:53 upstream b36fdc6853a3 873745f2 .config console log report syz ci-upstream-kasan-gce-root
2018/09/10 12:28 upstream 11da3a7f84f1 6b5120a4 .config console log report syz ci-upstream-kasan-gce-386
2018/09/08 14:02 upstream 3d0e7a9e00fd 6b5120a4 .config console log report syz ci-upstream-kasan-gce-386
2018/09/08 11:17 upstream 3d0e7a9e00fd 6b5120a4 .config console log report syz ci-upstream-kasan-gce-386
2018/09/06 04:54 upstream b36fdc6853a3 873745f2 .config console log report syz ci-upstream-kasan-gce-386
2018/09/06 04:54 net-old e65a9e480e91 873745f2 .config console log report syz ci-upstream-net-this-kasan-gce
2018/09/04 06:26 net-old 9fd0e09a4e86 a4718693 .config console log report syz ci-upstream-net-this-kasan-gce
2018/09/02 08:37 net-old 93bbadd6e0a2 a4718693 .config console log report syz ci-upstream-net-this-kasan-gce
2018/08/30 18:55 net-old dc6417949297 938220fd .config console log report syz ci-upstream-net-this-kasan-gce
2018/09/10 12:16 net-next-old 09317da317e5 6b5120a4 .config console log report syz ci-upstream-net-kasan-gce
2018/09/08 07:03 net-next-old 98cdb4807123 6b5120a4 .config console log report syz ci-upstream-net-kasan-gce
2018/09/08 05:14 net-next-old 98cdb4807123 6b5120a4 .config console log report syz ci-upstream-net-kasan-gce
2018/09/06 04:30 net-next-old 05dcc7129864 873745f2 .config console log report syz ci-upstream-net-kasan-gce
2018/09/10 21:07 linux-next f2b6e66e9885 f167cb6b .config console log report syz ci-upstream-linux-next-kasan-gce-root
2018/09/09 00:43 linux-next f2b6e66e9885 6b5120a4 .config console log report syz ci-upstream-linux-next-kasan-gce-root
2018/09/08 18:55 linux-next f2b6e66e9885 6b5120a4 .config console log report syz ci-upstream-linux-next-kasan-gce-root
2018/09/06 04:54 linux-next f2b6e66e9885 873745f2 .config console log report syz ci-upstream-linux-next-kasan-gce-root
2018/09/04 06:05 linux-next f2b6e66e9885 a4718693 .config console log report syz ci-upstream-linux-next-kasan-gce-root
2018/09/02 09:55 linux-next a880148cb2af a4718693 .config console log report syz ci-upstream-linux-next-kasan-gce-root
2018/09/12 18:52 upstream 96eddb810b14 71907daf .config console log report ci-upstream-kasan-gce-selinux-root
2018/09/12 16:07 upstream 5e335542de83 71907daf .config console log report ci-upstream-kasan-gce-smack-root
2018/09/12 05:22 upstream 5e335542de83 3c88136c .config console log report ci-upstream-kasan-gce-selinux-root
2018/09/10 07:54 upstream 11da3a7f84f1 6b5120a4 .config console log report ci-upstream-kasan-gce-smack-root
2018/09/09 18:19 upstream 9a5682765a2e 6b5120a4 .config console log report ci-upstream-kasan-gce-root
2018/09/09 05:50 upstream f8f65382c98a 6b5120a4 .config console log report ci-upstream-kasan-gce
2018/09/08 16:55 upstream d7b686ebf704 6b5120a4 .config console log report ci-upstream-kasan-gce
2018/09/08 15:23 upstream d7b686ebf704 6b5120a4 .config console log report ci-upstream-kasan-gce-root
2018/09/08 03:56 upstream 3d0e7a9e00fd 6b5120a4 .config console log report ci-upstream-kasan-gce
2018/09/13 06:20 upstream 96eddb810b14 71907daf .config console log report ci-upstream-kasan-gce-386
2018/09/11 04:19 upstream 11da3a7f84f1 8c88323f .config console log report ci-upstream-kasan-gce-386
2018/09/10 15:59 upstream 11da3a7f84f1 f167cb6b .config console log report ci-upstream-kasan-gce-386
2018/09/09 06:52 upstream f8f65382c98a 6b5120a4 .config console log report ci-upstream-kasan-gce-386
2018/09/08 05:00 upstream 3d0e7a9e00fd 6b5120a4 .config console log report ci-upstream-kasan-gce-386
2018/09/06 08:51 net-old e65a9e480e91 873745f2 .config console log report ci-upstream-net-this-kasan-gce
2018/09/13 22:59 net-next-old a20625e49dde 19e9088b .config console log report ci-upstream-net-kasan-gce
2018/09/13 19:38 net-next-old a20625e49dde 19e9088b .config console log report ci-upstream-net-kasan-gce
2018/09/13 10:56 net-next-old a20625e49dde 19e9088b .config console log report ci-upstream-net-kasan-gce
2018/09/13 06:24 net-next-old a20625e49dde 71907daf .config console log report ci-upstream-net-kasan-gce
2018/09/13 05:14 net-next-old a20625e49dde 71907daf .config console log report ci-upstream-net-kasan-gce
2018/09/12 03:30 net-next-old 11957be20ff6 3c88136c .config console log report ci-upstream-net-kasan-gce
2018/09/11 23:13 net-next-old 11957be20ff6 4ae17b1f .config console log report ci-upstream-net-kasan-gce
2018/09/11 19:15 net-next-old 11957be20ff6 4ae17b1f .config console log report ci-upstream-net-kasan-gce
2018/09/11 17:41 net-next-old 11957be20ff6 4ae17b1f .config console log report ci-upstream-net-kasan-gce
2018/09/11 16:24 net-next-old 11957be20ff6 4ae17b1f .config console log report ci-upstream-net-kasan-gce
2018/09/11 12:59 net-next-old 11957be20ff6 8c88323f .config console log report ci-upstream-net-kasan-gce
2018/09/11 11:51 net-next-old 11957be20ff6 8c88323f .config console log report ci-upstream-net-kasan-gce
2018/09/11 08:49 net-next-old 11957be20ff6 8c88323f .config console log report ci-upstream-net-kasan-gce
2018/09/11 03:18 net-next-old 11957be20ff6 8c88323f .config console log report ci-upstream-net-kasan-gce
2018/09/10 23:20 net-next-old 11957be20ff6 f167cb6b .config console log report ci-upstream-net-kasan-gce
2018/09/10 20:16 net-next-old 11957be20ff6 f167cb6b .config console log report ci-upstream-net-kasan-gce
2018/09/10 17:15 net-next-old 09317da317e5 f167cb6b .config console log report ci-upstream-net-kasan-gce
2018/09/10 14:41 net-next-old 09317da317e5 f167cb6b .config console log report ci-upstream-net-kasan-gce
2018/09/10 10:48 net-next-old 09317da317e5 6b5120a4 .config console log report ci-upstream-net-kasan-gce
2018/09/10 04:27 net-next-old 09317da317e5 6b5120a4 .config console log report ci-upstream-net-kasan-gce
2018/09/10 02:12 net-next-old 09317da317e5 6b5120a4 .config console log report ci-upstream-net-kasan-gce
2018/09/09 17:01 net-next-old 09317da317e5 6b5120a4 .config console log report ci-upstream-net-kasan-gce
2018/09/09 13:37 net-next-old 09317da317e5 6b5120a4 .config console log report ci-upstream-net-kasan-gce
2018/09/09 08:54 net-next-old 09317da317e5 6b5120a4 .config console log report ci-upstream-net-kasan-gce
2018/09/09 04:34 net-next-old 7a8c7f5c30f9 6b5120a4 .config console log report ci-upstream-net-kasan-gce
2018/09/08 12:29 net-next-old 98cdb4807123 6b5120a4 .config console log report ci-upstream-net-kasan-gce
2018/09/08 07:01 net-next-old 98cdb4807123 6b5120a4 .config console log report ci-upstream-net-kasan-gce
2018/09/11 15:54 linux-next f2b6e66e9885 4ae17b1f .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.