syzbot


KASAN: use-after-free Read in __lock_sock

Status: upstream: reported syz repro on 2020/02/11 04:34
Reported-by: syzbot+c02617cad14b1a84a31e@syzkaller.appspotmail.com
First crash: 1533d, last: 1413d
Fix bisection the fix commit could be any of (bisect log):
  e0f8b8a65a47 Linux 4.14.170
  56dfe6252c68 Linux 4.14.188
  
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: use-after-free Read in __lock_sock syz done 2 1639d 1639d 1/1 fixed on 2019/12/18 04:11
upstream KASAN: use-after-free Read in __lock_sock sctp syz done error 26 1168d 1984d 20/26 fixed on 2022/03/08 16:11
linux-4.19 KASAN: use-after-free Read in __lock_sock (2) 1 1542d 1542d 0/1 auto-closed as invalid on 2020/06/01 06:17
Last patch testing requests (2)
Created Duration User Patch Repo Result
2023/01/24 00:32 12m retest repro linux-4.14.y report log
2022/09/06 17:27 10m retest repro linux-4.14.y report log
Fix bisection attempts (5)
Created Duration User Patch Repo Result
2020/07/10 08:01 31m bisect fix linux-4.14.y job log (2)
2020/06/10 07:35 24m bisect fix linux-4.14.y job log (0) log
2020/05/11 06:44 26m bisect fix linux-4.14.y job log (0) log
2020/04/11 06:19 25m bisect fix linux-4.14.y job log (0) log
2020/03/12 04:33 28m bisect fix linux-4.14.y job log (0) log

Sample crash report:
NOHZ: local_softirq_pending 08
==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x3098/0x4620 kernel/locking/lockdep.c:3365
Read of size 8 at addr ffff8880a8e598a0 by task syz-executor.0/14268

CPU: 1 PID: 14268 Comm: syz-executor.0 Not tainted 4.14.170-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+0x142/0x197 lib/dump_stack.c:58
 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
 __lock_acquire+0x3098/0x4620 kernel/locking/lockdep.c:3365
 lock_acquire+0x16f/0x430 kernel/locking/lockdep.c:3994
 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline]
 _raw_spin_lock_bh+0x33/0x50 kernel/locking/spinlock.c:176
 spin_lock_bh include/linux/spinlock.h:322 [inline]
 __lock_sock+0x13a/0x210 net/core/sock.c:2241
 lock_sock_nested+0xee/0x110 net/core/sock.c:2764
 lock_sock include/net/sock.h:1467 [inline]
 sctp_sock_dump+0x122/0xb00 net/sctp/sctp_diag.c:294
 sctp_for_each_transport+0x251/0x2e0 net/sctp/socket.c:4748
 sctp_diag_dump+0x2de/0x3c0 net/sctp/sctp_diag.c:497
 __inet_diag_dump+0x8e/0x120 net/ipv4/inet_diag.c:1053
 inet_diag_dump+0x8e/0x110 net/ipv4/inet_diag.c:1069
 netlink_dump+0x3fa/0xb10 net/netlink/af_netlink.c:2202
 __netlink_dump_start+0x4e6/0x740 net/netlink/af_netlink.c:2299
 netlink_dump_start include/linux/netlink.h:217 [inline]
 inet_diag_handler_cmd+0x225/0x2e0 net/ipv4/inet_diag.c:1174
 __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+0x44d/0x650 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
 sock_write_iter+0x25b/0x3b0 net/socket.c:925
 call_write_iter include/linux/fs.h:1777 [inline]
 do_iter_readv_writev+0x418/0x670 fs/read_write.c:675
 do_iter_write fs/read_write.c:954 [inline]
 do_iter_write+0x154/0x540 fs/read_write.c:935
 vfs_writev+0x170/0x2a0 fs/read_write.c:999
 do_writev+0x10a/0x2d0 fs/read_write.c:1034
 SYSC_writev fs/read_write.c:1107 [inline]
 SyS_writev+0x28/0x30 fs/read_write.c:1104
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x45b3b9
RSP: 002b:00007f05a5187c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000014
RAX: ffffffffffffffda RBX: 00007f05a51886d4 RCX: 000000000045b3b9
RDX: 0000000000000001 RSI: 0000000020000000 RDI: 000000000000000b
RBP: 000000000075c070 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 0000000000000cdd R14: 00000000004c9cc2 R15: 000000000075c07c

Allocated by task 14267:
 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
 sk_prot_alloc+0x67/0x2a0 net/core/sock.c:1461
 sk_alloc+0x39/0xd70 net/core/sock.c:1521
 inet6_create net/ipv6/af_inet6.c:183 [inline]
 inet6_create+0x2d8/0xe10 net/ipv6/af_inet6.c:110
 __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 14267:
 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
 sk_prot_free net/core/sock.c:1502 [inline]
 __sk_destruct+0x3c5/0x650 net/core/sock.c:1581
 sk_destruct+0xa4/0xd0 net/core/sock.c:1596
 __sk_free+0x54/0x230 net/core/sock.c:1604
 sk_free+0x35/0x40 net/core/sock.c:1615
 sock_put include/net/sock.h:1658 [inline]
 sctp_close+0x5f0/0x730 net/sctp/socket.c:1589
 inet_release+0xec/0x1c0 net/ipv4/af_inet.c:425
 inet6_release+0x53/0x80 net/ipv6/af_inet6.c:450
 __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
 get_signal+0x18a8/0x1cd0 kernel/signal.c:2229
 do_signal+0x86/0x19a0 arch/x86/kernel/signal.c:814
 exit_to_usermode_loop+0x15c/0x220 arch/x86/entry/common.c:160
 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 ffff8880a8e59800
 which belongs to the cache SCTPv6 of size 1896
The buggy address is located 160 bytes inside of
 1896-byte region [ffff8880a8e59800, ffff8880a8e59f68)
The buggy address belongs to the page:
page:ffffea0002a39640 count:1 mapcount:0 mapping:ffff8880a8e59000 index:0x0
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffff8880a8e59000 0000000000000000 0000000100000002
raw: ffffea0002a2b460 ffffea00026cc4e0 ffff88809ac7e380 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a8e59780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880a8e59800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880a8e59880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                               ^
 ffff8880a8e59900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880a8e59980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/02/11 04:33 linux-4.14.y e0f8b8a65a47 d9e55b05 .config console log report syz ci2-linux-4-14
* Struck through repros no longer work on HEAD.