syzbot


KASAN: use-after-free Write in reuseport_alloc

Status: auto-closed as invalid on 2021/03/09 17:34
Subsystems: net
[Documentation on labels]
First crash: 1796d, last: 1715d

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in reuseport_alloc+0x2dc/0x2f0 net/core/sock_reuseport.c:78
Write of size 8 at addr ffff888050852698 by task syz-executor.3/7362

CPU: 1 PID: 7362 Comm: syz-executor.3 Not tainted 5.10.0-rc6-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+0x107/0x163 lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xae/0x4c8 mm/kasan/report.c:385
 __kasan_report mm/kasan/report.c:545 [inline]
 kasan_report.cold+0x1f/0x37 mm/kasan/report.c:562
 reuseport_alloc+0x2dc/0x2f0 net/core/sock_reuseport.c:78
 reuseport_add_sock+0x708/0x8d0 net/core/sock_reuseport.c:145
 __sctp_hash_endpoint net/sctp/input.c:750 [inline]
 sctp_hash_endpoint+0x4fe/0x5f0 net/sctp/input.c:778
 sctp_listen_start net/sctp/socket.c:8390 [inline]
 sctp_inet_listen+0x71c/0x930 net/sctp/socket.c:8445
 __sys_listen+0x17d/0x250 net/socket.c:1668
 __do_sys_listen net/socket.c:1677 [inline]
 __se_sys_listen net/socket.c:1675 [inline]
 __x64_sys_listen+0x50/0x70 net/socket.c:1675
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x45e159
Code: 0d 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 db b3 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fd41022dc68 EFLAGS: 00000246 ORIG_RAX: 0000000000000032
RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 000000000045e159
RDX: 0000000000000000 RSI: 0000000000000050 RDI: 0000000000000004
RBP: 000000000119bfb8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000119bf8c
R13: 00007ffcc267db2f R14: 00007fd41022e9c0 R15: 000000000119bf8c

Allocated by task 7362:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48
 kasan_set_track mm/kasan/common.c:56 [inline]
 __kasan_kmalloc.constprop.0+0xc2/0xd0 mm/kasan/common.c:461
 slab_post_alloc_hook mm/slab.h:506 [inline]
 slab_alloc_node mm/slub.c:2891 [inline]
 slab_alloc mm/slub.c:2899 [inline]
 kmem_cache_alloc+0x122/0x460 mm/slub.c:2904
 sk_prot_alloc+0x5f/0x300 net/core/sock.c:1679
 sk_alloc+0x32/0xbd0 net/core/sock.c:1739
 inet6_create net/ipv6/af_inet6.c:183 [inline]
 inet6_create+0x3a4/0x1010 net/ipv6/af_inet6.c:110
 __sock_create+0x3de/0x780 net/socket.c:1405
 sock_create net/socket.c:1456 [inline]
 __sys_socket+0xef/0x200 net/socket.c:1498
 __do_sys_socket net/socket.c:1507 [inline]
 __se_sys_socket net/socket.c:1505 [inline]
 __x64_sys_socket+0x6f/0xb0 net/socket.c:1505
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 7360:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48
 kasan_set_track+0x1c/0x30 mm/kasan/common.c:56
 kasan_set_free_info+0x1b/0x30 mm/kasan/generic.c:355
 __kasan_slab_free+0x102/0x140 mm/kasan/common.c:422
 slab_free_hook mm/slub.c:1544 [inline]
 slab_free_freelist_hook+0x5d/0x150 mm/slub.c:1577
 slab_free mm/slub.c:3142 [inline]
 kmem_cache_free+0x82/0x350 mm/slub.c:3158
 sk_prot_free net/core/sock.c:1720 [inline]
 __sk_destruct+0x574/0x8f0 net/core/sock.c:1807
 sk_destruct+0xbd/0xe0 net/core/sock.c:1822
 __sk_free+0xef/0x3d0 net/core/sock.c:1833
 sk_free+0x78/0xa0 net/core/sock.c:1844
 sock_put include/net/sock.h:1799 [inline]
 sctp_close+0x773/0x8f0 net/sctp/socket.c:1538
 inet_release+0x12e/0x280 net/ipv4/af_inet.c:431
 inet6_release+0x4c/0x70 net/ipv6/af_inet6.c:475
 __sock_release+0xcd/0x280 net/socket.c:596
 sock_close+0x18/0x20 net/socket.c:1255
 __fput+0x285/0x920 fs/file_table.c:281
 task_work_run+0xdd/0x190 kernel/task_work.c:151
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:164 [inline]
 exit_to_user_mode_prepare+0x17e/0x1a0 kernel/entry/common.c:191
 syscall_exit_to_user_mode+0x38/0x260 kernel/entry/common.c:266
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

The buggy address belongs to the object at ffff888050852200
 which belongs to the cache SCTPv6 of size 2040
The buggy address is located 1176 bytes inside of
 2040-byte region [ffff888050852200, ffff8880508529f8)
The buggy address belongs to the page:
page:00000000be086b4f refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888050853300 pfn:0x50850
head:00000000be086b4f order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head)
raw: 00fff00000010200 ffffea00016f9800 0000000200000002 ffff8880216b3c80
raw: ffff888050853300 00000000800f000b 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888050852580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888050852600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888050852680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
 ffff888050852700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888050852780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/12/09 17:17 net-next-old afae3cc2da10 c090b4da .config console log report info ci-upstream-net-kasan-gce
2020/09/19 18:21 net-next-old 0db0561d13df 53ce8104 .config console log report info ci-upstream-net-kasan-gce
* Struck through repros no longer work on HEAD.