syzbot


KASAN: use-after-free Read in tcp_sk_exit

Status: auto-closed as invalid on 2019/10/25 08:37
Subsystems: net
[Documentation on labels]
Reported-by: syzbot+f797267da5e5012d0920@syzkaller.appspotmail.com
First crash: 1924d, last: 1780d
Discussions (3)
Title Replies (including bot) Last reply
Reminder: 99 open syzbot bugs in net subsystem 14 (14) 2019/07/31 15:13
Reminder: 94 open syzbot bugs in net subsystem 1 (1) 2019/06/25 05:48
KASAN: use-after-free Read in tcp_sk_exit 0 (1) 2019/02/06 05:01
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in tcp_sk_exit (2) net syz error error 6 915d 1032d 0/26 closed as invalid on 2022/01/11 13:53

Sample crash report:
Unknown ioctl 1074311008
==================================================================
BUG: KASAN: use-after-free in inet_ctl_sock_destroy include/net/inet_common.h:56 [inline]
BUG: KASAN: use-after-free in tcp_sk_exit+0x203/0x230 net/ipv4/tcp_ipv4.c:2591
Read of size 8 at addr ffff8880550978d8 by task kworker/u4:0/7

CPU: 0 PID: 7 Comm: kworker/u4:0 Not tainted 5.0.0-rc8 #88
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: netns cleanup_net
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x172/0x1f0 lib/dump_stack.c:113
 print_address_description.cold+0x7c/0x20d mm/kasan/report.c:187
 kasan_report.cold+0x1b/0x40 mm/kasan/report.c:317
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:135
 inet_ctl_sock_destroy include/net/inet_common.h:56 [inline]
 tcp_sk_exit+0x203/0x230 net/ipv4/tcp_ipv4.c:2591
 ops_exit_list.isra.0+0xb0/0x160 net/core/net_namespace.c:153
 cleanup_net+0x3fb/0x960 net/core/net_namespace.c:551
 process_one_work+0x98e/0x1790 kernel/workqueue.c:2173
 worker_thread+0x98/0xe40 kernel/workqueue.c:2319
 kthread+0x357/0x430 kernel/kthread.c:246
 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:352

Allocated by task 10701:
 save_stack+0x45/0xd0 mm/kasan/common.c:73
 set_track mm/kasan/common.c:85 [inline]
 __kasan_kmalloc mm/kasan/common.c:495 [inline]
 __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:468
 kasan_slab_alloc+0xf/0x20 mm/kasan/common.c:503
 slab_post_alloc_hook mm/slab.h:440 [inline]
 slab_alloc mm/slab.c:3388 [inline]
 kmem_cache_alloc+0x11a/0x6f0 mm/slab.c:3548
 sk_prot_alloc+0x67/0x2e0 net/core/sock.c:1471
 sk_alloc+0x39/0xf70 net/core/sock.c:1531
 inet_create net/ipv4/af_inet.c:321 [inline]
 inet_create+0x36a/0xe10 net/ipv4/af_inet.c:247
 __sock_create+0x3e6/0x750 net/socket.c:1275
 sock_create_kern+0x3b/0x50 net/socket.c:1321
 inet_ctl_sock_create+0x9d/0x1f0 net/ipv4/af_inet.c:1614
 icmp_sk_init net/ipv4/icmp.c:1203 [inline]
 icmp_sk_init+0x120/0x680 net/ipv4/icmp.c:1192
 ops_init+0xb6/0x410 net/core/net_namespace.c:129
 setup_net+0x2c5/0x730 net/core/net_namespace.c:314
 copy_net_ns+0x1d9/0x340 net/core/net_namespace.c:437
 create_new_namespaces+0x400/0x7b0 kernel/nsproxy.c:107
 unshare_nsproxy_namespaces+0xc2/0x200 kernel/nsproxy.c:206
 ksys_unshare+0x440/0x980 kernel/fork.c:2550
 __do_sys_unshare kernel/fork.c:2618 [inline]
 __se_sys_unshare kernel/fork.c:2616 [inline]
 __ia32_sys_unshare+0x30/0x40 kernel/fork.c:2616
 do_syscall_32_irqs_on arch/x86/entry/common.c:326 [inline]
 do_fast_syscall_32+0x281/0xc98 arch/x86/entry/common.c:397
 entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139

Freed by task 7:
 save_stack+0x45/0xd0 mm/kasan/common.c:73
 set_track mm/kasan/common.c:85 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/common.c:457
 kasan_slab_free+0xe/0x10 mm/kasan/common.c:465
 __cache_free mm/slab.c:3494 [inline]
 kmem_cache_free+0x86/0x260 mm/slab.c:3754
 sk_prot_free net/core/sock.c:1512 [inline]
 __sk_destruct+0x4b6/0x6d0 net/core/sock.c:1596
 sk_destruct+0x7b/0x90 net/core/sock.c:1604
 __sk_free+0xce/0x300 net/core/sock.c:1615
 sk_free+0x42/0x50 net/core/sock.c:1626
 sock_put include/net/sock.h:1707 [inline]
 sk_common_release+0x224/0x330 net/core/sock.c:3042
 raw_close+0x22/0x30 net/ipv4/raw.c:708
 inet_release+0x105/0x1f0 net/ipv4/af_inet.c:428
 __sock_release+0x1d3/0x250 net/socket.c:579
 sock_release+0x18/0x20 net/socket.c:598
 inet_ctl_sock_destroy include/net/inet_common.h:56 [inline]
 icmp_sk_exit+0x11f/0x1f0 net/ipv4/icmp.c:1187
 ops_exit_list.isra.0+0xb0/0x160 net/core/net_namespace.c:153
 cleanup_net+0x3fb/0x960 net/core/net_namespace.c:551
 process_one_work+0x98e/0x1790 kernel/workqueue.c:2173
 worker_thread+0x98/0xe40 kernel/workqueue.c:2319
 kthread+0x357/0x430 kernel/kthread.c:246
 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:352

The buggy address belongs to the object at ffff888055097840
 which belongs to the cache RAW(17:syz0) of size 1320
The buggy address is located 152 bytes inside of
 1320-byte region [ffff888055097840, ffff888055097d68)
The buggy address belongs to the page:
page:ffffea0001542580 count:1 mapcount:0 mapping:ffff8880a9958e40 index:0x0 compound_mapcount: 0
flags: 0x1fffc0000010200(slab|head)
raw: 01fffc0000010200 ffffea00025b2b88 ffff88808cdc5248 ffff8880a9958e40
raw: 0000000000000000 ffff888055096140 0000000100000005 ffff88806aa62a40
page dumped because: kasan: bad access detected
page->mem_cgroup:ffff88806aa62a40

Memory state around the buggy address:
 ffff888055097780: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc
 ffff888055097800: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
>ffff888055097880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                    ^
 ffff888055097900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888055097980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (7):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/02/25 09:48 upstream 5908e6b738e3 a70141bf .config console log report ci-upstream-kasan-gce-386
2019/06/17 12:30 net-old d4d5d8e83c96 442206d7 .config console log report ci-upstream-net-this-kasan-gce
2019/04/21 11:12 net-old 12c768611132 b0e8efcb .config console log report ci-upstream-net-this-kasan-gce
2019/06/10 08:40 net-next-old 900d96e418dc 0159583c .config console log report ci-upstream-net-kasan-gce
2019/03/01 00:50 net-next-old be9cefe796f3 09aeeba4 .config console log report ci-upstream-net-kasan-gce
2019/02/15 00:57 net-next-old f8b1f9f6459c 76dd003f .config console log report ci-upstream-net-kasan-gce
2019/01/24 05:47 net-next-old 33a0efa4baec 56558f63 .config console log report ci-upstream-net-kasan-gce
* Struck through repros no longer work on HEAD.