syzbot


KASAN: use-after-free Read in __smc_diag_dump

Status: upstream: reported syz repro on 2019/06/30 13:50
Reported-by: syzbot+ff70bd4c42a91c828268@syzkaller.appspotmail.com
First crash: 1761d, last: 1360d
Fix bisection the fix commit could be any of (bisect log):
  01fd1694b93c Linux 4.14.141
  4139fb08c05f Linux 4.14.187
  
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in __smc_diag_dump net s390 syz 34 1927d 1940d 11/26 fixed on 2019/03/06 07:43
Last patch testing requests (6)
Created Duration User Patch Repo Result
2023/01/29 17:32 12m retest repro linux-4.14.y report log
2023/01/29 16:32 10m retest repro linux-4.14.y report log
2023/01/29 08:32 14m retest repro linux-4.14.y report log
2022/09/09 22:27 8m retest repro linux-4.14.y report log
2022/09/09 21:27 9m retest repro linux-4.14.y report log
2022/09/09 20:27 9m retest repro linux-4.14.y report log
Fix bisection attempts (7)
Created Duration User Patch Repo Result
2020/06/27 20:55 30m (3) bisect fix linux-4.14.y job log (2)
2020/05/28 15:04 26m bisect fix linux-4.14.y job log (0) log
2020/04/28 14:26 26m bisect fix linux-4.14.y job log (0) log
2020/03/16 06:22 25m bisect fix linux-4.14.y job log (0) log
2020/02/15 01:48 24m bisect fix linux-4.14.y job log (0) log
2020/01/15 23:58 25m bisect fix linux-4.14.y job log (0) log
2019/12/16 18:10 25m bisect fix linux-4.14.y job log (0) log

Sample crash report:
SELinux: unrecognized netlink message: protocol=4 nlmsg_type=0 sclass=netlink_tcpdiag_socket pig=7261 comm=syz-executor.3
SELinux: unrecognized netlink message: protocol=4 nlmsg_type=0 sclass=netlink_tcpdiag_socket pig=7294 comm=syz-executor.1
==================================================================
BUG: KASAN: use-after-free in smc_diag_msg_common_fill net/smc/smc_diag.c:44 [inline]
BUG: KASAN: use-after-free in __smc_diag_dump.isra.0+0x16e0/0x17b0 net/smc/smc_diag.c:82
Read of size 8 at addr ffff8880761a6ae0 by task syz-executor.4/7307

CPU: 0 PID: 7307 Comm: syz-executor.4 Not tainted 4.14.141 #37
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+0x138/0x197 lib/dump_stack.c:53
 print_address_description.cold+0x7c/0x1dc mm/kasan/report.c:252
 kasan_report_error mm/kasan/report.c:351 [inline]
 kasan_report mm/kasan/report.c:409 [inline]
 kasan_report.cold+0xa9/0x2af mm/kasan/report.c:393
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430
 smc_diag_msg_common_fill net/smc/smc_diag.c:44 [inline]
 __smc_diag_dump.isra.0+0x16e0/0x17b0 net/smc/smc_diag.c:82
 smc_diag_dump+0x1e5/0x2a0 net/smc/smc_diag.c:170
 netlink_dump+0x3fa/0xb10 net/netlink/af_netlink.c:2202
 __netlink_dump_start+0x4ff/0x750 net/netlink/af_netlink.c:2299
 netlink_dump_start include/linux/netlink.h:217 [inline]
 smc_diag_handler_dump+0x1b7/0x200 net/smc/smc_diag.c:191
 __sock_diag_cmd net/core/sock_diag.c:231 [inline]
 sock_diag_rcv_msg+0x29e/0x3a0 net/core/sock_diag.c:263
 netlink_rcv_skb+0x14f/0x3c0 net/netlink/af_netlink.c:2432
 sock_diag_rcv+0x2b/0x40 net/core/sock_diag.c:274
 netlink_unicast_kernel net/netlink/af_netlink.c:1286 [inline]
 netlink_unicast+0x45d/0x640 net/netlink/af_netlink.c:1312
 netlink_sendmsg+0x7c4/0xc60 net/netlink/af_netlink.c:1877
 sock_sendmsg_nosec net/socket.c:646 [inline]
 sock_sendmsg+0xce/0x110 net/socket.c:656
 kernel_sendmsg+0x44/0x50 net/socket.c:664
 sock_no_sendpage+0x107/0x130 net/core/sock.c:2564
 kernel_sendpage+0x92/0xf0 net/socket.c:3406
 sock_sendpage+0x8b/0xc0 net/socket.c:871
 pipe_to_sendpage+0x242/0x340 fs/splice.c:451
 splice_from_pipe_feed fs/splice.c:502 [inline]
 __splice_from_pipe+0x348/0x780 fs/splice.c:626
 splice_from_pipe+0xf0/0x150 fs/splice.c:661
 generic_splice_sendpage+0x3c/0x50 fs/splice.c:832
 do_splice_from fs/splice.c:851 [inline]
 do_splice fs/splice.c:1147 [inline]
 SYSC_splice fs/splice.c:1402 [inline]
 SyS_splice+0xd92/0x1430 fs/splice.c:1382
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x459879
RSP: 002b:00007f1544487c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000113
RAX: ffffffffffffffda RBX: 0000000000000006 RCX: 0000000000459879
RDX: 0000000000000006 RSI: 0000000000000000 RDI: 0000000000000004
RBP: 000000000075c070 R08: 0000000080000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f15444886d4
R13: 00000000004c907b R14: 00000000004df4f0 R15: 00000000ffffffff

Allocated by task 7307:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x45/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc mm/kasan/kasan.c:551 [inline]
 kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:529
 kasan_slab_alloc+0xf/0x20 mm/kasan/kasan.c:489
 kmem_cache_alloc+0x12e/0x780 mm/slab.c:3552
 sock_alloc_inode+0x1d/0x260 net/socket.c:251
 alloc_inode+0x64/0x180 fs/inode.c:209
 new_inode_pseudo+0x19/0xf0 fs/inode.c:891
 sock_alloc+0x41/0x280 net/socket.c:569
 __sock_create+0x8f/0x620 net/socket.c:1239
 sock_create_kern+0x3b/0x50 net/socket.c:1321
 smc_create+0x109/0x300 net/smc/af_smc.c:1361
 __sock_create+0x2f6/0x620 net/socket.c:1275
 sock_create net/socket.c:1315 [inline]
 SYSC_socket net/socket.c:1345 [inline]
 SyS_socket+0xd3/0x170 net/socket.c:1325
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 7281:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x45/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0x75/0xc0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kmem_cache_free+0x83/0x2b0 mm/slab.c:3758
 sock_destroy_inode+0x54/0x60 net/socket.c:281
 destroy_inode+0xc2/0x120 fs/inode.c:266
 evict+0x3e6/0x630 fs/inode.c:571
 iput_final fs/inode.c:1516 [inline]
 iput fs/inode.c:1543 [inline]
 iput+0x471/0x900 fs/inode.c:1528
 __sock_release+0x236/0x2b0 net/socket.c:615
 sock_release+0x18/0x20 net/socket.c:623
 smc_release+0x23b/0x630 net/smc/af_smc.c:141
 __sock_release+0xce/0x2b0 net/socket.c:602
 sock_close+0x1b/0x30 net/socket.c:1139
 __fput+0x275/0x7a0 fs/file_table.c:210
 ____fput+0x16/0x20 fs/file_table.c:244
 task_work_run+0x114/0x190 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:191 [inline]
 exit_to_usermode_loop+0x1da/0x220 arch/x86/entry/common.c:164
 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
 do_syscall_64+0x4bc/0x640 arch/x86/entry/common.c:297
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff8880761a6ac0
 which belongs to the cache sock_inode_cache of size 992
The buggy address is located 32 bytes inside of
 992-byte region [ffff8880761a6ac0, ffff8880761a6ea0)
The buggy address belongs to the page:
page:ffffea0001d86980 count:1 mapcount:0 mapping:ffff8880761a61c0 index:0xffff8880761a6ffd
flags: 0x1fffc0000000100(slab)
raw: 01fffc0000000100 ffff8880761a61c0 ffff8880761a6ffd 0000000100000003
raw: ffffea000251d4a0 ffffea000251ac60 ffff8880a9e82c00 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880761a6980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880761a6a00: fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880761a6a80: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
                                                       ^
 ffff8880761a6b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880761a6b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (6):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/08/30 11:36 linux-4.14.y 01fd1694b93c cd626f3b .config console log report syz ci2-linux-4-14
2019/07/03 19:17 linux-4.14.y e3c1b27308ae 55565fa0 .config console log report syz ci2-linux-4-14
2019/06/30 12:49 linux-4.14.y f4cc0ed9b2c7 7509bf36 .config console log report syz ci2-linux-4-14
2020/08/03 17:24 linux-4.14.y 7f2c5eb458b8 96dd3623 .config console log report ci2-linux-4-14
2020/03/29 14:26 linux-4.14.y 01364dad1d45 05736b29 .config console log report ci2-linux-4-14
2019/09/03 15:39 linux-4.14.y 01fd1694b93c 48448e71 .config console log report ci2-linux-4-14
* Struck through repros no longer work on HEAD.