syzbot


KASAN: use-after-free Read in inet_shutdown

Status: public: reported C repro on 2019/04/13 00:00
Reported-by: syzbot+8c35f79ef6a1f6f0a6da@syzkaller.appspotmail.com
First crash: 2500d, last: 2280d
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in inet_shutdown (2) 4 1039d 1120d 0/1 auto-closed as invalid on 2022/05/17 02:29
upstream KASAN: use-after-free Read in inet_shutdown net C 22 2454d 2500d 4/28 fixed on 2018/03/06 13:29
android-44 KASAN: use-after-free Read in inet_shutdown syz 8 2285d 2048d 0/2 public: reported syz repro on 2019/04/14 00:02
linux-4.14 KASAN: use-after-free Read in inet_shutdown 12 1283d 1377d 0/1 auto-closed as invalid on 2021/09/14 22:13

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in inet_shutdown+0x2d4/0x350 net/ipv4/af_inet.c:824
Read of size 4 at addr ffff8801c50a1980 by task syzkaller564537/3517

CPU: 1 PID: 3517 Comm: syzkaller564537 Not tainted 4.9.77-g9c3804b #17
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
 ffff8801c66afbc0 ffffffff81d941c9 ffffea0007142800 ffff8801c50a1980
 0000000000000000 ffff8801c50a1980 ffff8801cb34ea58 ffff8801c66afbf8
 ffffffff8153db93 ffff8801c50a1980 0000000000000004 0000000000000000
Call Trace:
 [<ffffffff81d941c9>] __dump_stack lib/dump_stack.c:15 [inline]
 [<ffffffff81d941c9>] dump_stack+0xc1/0x128 lib/dump_stack.c:51
 [<ffffffff8153db93>] print_address_description+0x73/0x280 mm/kasan/report.c:252
 [<ffffffff8153e0b5>] kasan_report_error mm/kasan/report.c:351 [inline]
 [<ffffffff8153e0b5>] kasan_report+0x275/0x360 mm/kasan/report.c:408
 [<ffffffff8153e1f4>] __asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:428
 [<ffffffff832e83c4>] inet_shutdown+0x2d4/0x350 net/ipv4/af_inet.c:824
 [<ffffffff835896a0>] pppol2tp_session_close+0xa0/0xe0 net/l2tp/l2tp_ppp.c:441
 [<ffffffff8358409f>] l2tp_tunnel_closeall+0x21f/0x3a0 net/l2tp/l2tp_core.c:1368
 [<ffffffff83584ca7>] l2tp_udp_encap_destroy+0x87/0xe0 net/l2tp/l2tp_core.c:1394
 [<ffffffff8348ab71>] udpv6_destroy_sock+0xb1/0xd0 net/ipv6/udp.c:1336
 [<ffffffff82eeb5ab>] sk_common_release+0x6b/0x2f0 net/core/sock.c:2727
 [<ffffffff83489b25>] udp_lib_close+0x15/0x20 include/net/udp.h:203
 [<ffffffff832e853a>] inet_release+0xfa/0x1d0 net/ipv4/af_inet.c:434
 [<ffffffff8340f0d0>] inet6_release+0x50/0x70 net/ipv6/af_inet6.c:437
 [<ffffffff82ed489d>] sock_release+0x8d/0x1e0 net/socket.c:599
 [<ffffffff82ed4a06>] sock_close+0x16/0x20 net/socket.c:1046
 [<ffffffff8157502c>] __fput+0x28c/0x6e0 fs/file_table.c:208
 [<ffffffff81575505>] ____fput+0x15/0x20 fs/file_table.c:244
 [<ffffffff81195795>] task_work_run+0x115/0x190 kernel/task_work.c:116
 [<ffffffff81003a4c>] tracehook_notify_resume include/linux/tracehook.h:191 [inline]
 [<ffffffff81003a4c>] exit_to_usermode_loop+0xfc/0x120 arch/x86/entry/common.c:160
 [<ffffffff81006340>] prepare_exit_to_usermode arch/x86/entry/common.c:190 [inline]
 [<ffffffff81006340>] syscall_return_slowpath+0x1a0/0x1e0 arch/x86/entry/common.c:259
 [<ffffffff838b2ceb>] entry_SYSCALL_64_fastpath+0xe6/0xe8

Allocated by task 3518:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
 save_stack+0x43/0xd0 mm/kasan/kasan.c:505
 set_track mm/kasan/kasan.c:517 [inline]
 kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:609
 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:547
 slab_post_alloc_hook mm/slab.h:417 [inline]
 slab_alloc_node mm/slub.c:2715 [inline]
 slab_alloc mm/slub.c:2723 [inline]
 kmem_cache_alloc+0xba/0x290 mm/slub.c:2728
 sock_alloc_inode+0x1d/0x250 net/socket.c:250
 alloc_inode+0x65/0x180 fs/inode.c:207
 new_inode_pseudo+0x17/0xe0 fs/inode.c:890
 sock_alloc+0x41/0x270 net/socket.c:567
 __sock_create+0xa5/0x640 net/socket.c:1146
 sock_create net/socket.c:1222 [inline]
 SYSC_socket net/socket.c:1252 [inline]
 SyS_socket+0xf0/0x1b0 net/socket.c:1232
 entry_SYSCALL_64_fastpath+0x29/0xe8

Freed by task 3518:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
 save_stack+0x43/0xd0 mm/kasan/kasan.c:505
 set_track mm/kasan/kasan.c:517 [inline]
 kasan_slab_free+0x72/0xc0 mm/kasan/kasan.c:582
 slab_free_hook mm/slub.c:1355 [inline]
 slab_free_freelist_hook mm/slub.c:1377 [inline]
 slab_free mm/slub.c:2958 [inline]
 kmem_cache_free+0xc7/0x300 mm/slub.c:2980
 sock_destroy_inode+0x56/0x70 net/socket.c:280
 destroy_inode+0xc3/0x120 fs/inode.c:264
 evict+0x329/0x4f0 fs/inode.c:570
 iput_final fs/inode.c:1516 [inline]
 iput+0x47b/0x900 fs/inode.c:1543
 dentry_unlink_inode+0x470/0x570 fs/dcache.c:370
 __dentry_kill+0x25b/0x480 fs/dcache.c:565
 dentry_kill fs/dcache.c:606 [inline]
 dput.part.23+0x680/0x7b0 fs/dcache.c:818
 dput+0x1f/0x30 fs/dcache.c:780
 __fput+0x46a/0x6e0 fs/file_table.c:226
 ____fput+0x15/0x20 fs/file_table.c:244
 task_work_run+0x115/0x190 kernel/task_work.c:116
 tracehook_notify_resume include/linux/tracehook.h:191 [inline]
 exit_to_usermode_loop+0xfc/0x120 arch/x86/entry/common.c:160
 prepare_exit_to_usermode arch/x86/entry/common.c:190 [inline]
 syscall_return_slowpath+0x1a0/0x1e0 arch/x86/entry/common.c:259
 entry_SYSCALL_64_fastpath+0xe6/0xe8

The buggy address belongs to the object at ffff8801c50a1980
 which belongs to the cache sock_inode_cache of size 944
The buggy address is located 0 bytes inside of
 944-byte region [ffff8801c50a1980, ffff8801c50a1d30)
The buggy address belongs to the page:
page:ffffea0007142800 count:1 mapcount:0 mapping:          (null) index:0x0 compound_mapcount: 0
flags: 0x8000000000004080(slab|head)
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801c50a1880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc
 ffff8801c50a1900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8801c50a1980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff8801c50a1a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801c50a1a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (51):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/01/19 15:41 https://android.googlesource.com/kernel/common android-4.9 9c3804bc9b62 161c1d64 .config console log report syz C ci-android-49-kasan-gce
2018/08/22 20:54 https://android.googlesource.com/kernel/common android-4.9 8dd3fc2ed765 95b5c82b .config console log report syz ci-android-49-kasan-gce
2018/02/02 18:03 https://android.googlesource.com/kernel/common android-4.9 71f146972231 632a8c2c .config console log report syz ci-android-49-kasan-gce-386
2018/08/24 03:44 https://android.googlesource.com/kernel/common android-4.9 7fa8c15e72a4 95b5c82b .config console log report ci-android-49-kasan-gce
2018/08/04 21:09 https://android.googlesource.com/kernel/common android-4.9 8b21e85d919c 3476a2df .config console log report ci-android-49-kasan-gce
2018/07/20 01:12 https://android.googlesource.com/kernel/common android-4.9 47bbcd6bf8f9 49f35839 .config console log report ci-android-49-kasan-gce-root
2018/05/25 20:27 https://android.googlesource.com/kernel/common android-4.9 70c65e471b71 f48c20b8 .config console log report ci-android-49-kasan-gce
2018/05/24 19:55 https://android.googlesource.com/kernel/common android-4.9 c5aceac71b68 f48c20b8 .config console log report ci-android-49-kasan-gce
2018/05/23 08:26 https://android.googlesource.com/kernel/common android-4.9 d054505522c4 f48c20b8 .config console log report ci-android-49-kasan-gce
2018/05/22 14:13 https://android.googlesource.com/kernel/common android-4.9 aef17a58e8ca f48c20b8 .config console log report ci-android-49-kasan-gce
2018/05/21 01:06 https://android.googlesource.com/kernel/common android-4.9 aef17a58e8ca f48c20b8 .config console log report ci-android-49-kasan-gce-root
2018/05/19 01:44 https://android.googlesource.com/kernel/common android-4.9 e14d1a35ebd9 849705db .config console log report ci-android-49-kasan-gce
2018/03/16 19:27 https://android.googlesource.com/kernel/common android-4.9 fc8bd0f6ffec 08dacaa0 .config console log report ci-android-49-kasan-gce
2018/03/14 13:57 https://android.googlesource.com/kernel/common android-4.9 97d7f1c7c0f0 08dacaa0 .config console log report ci-android-49-kasan-gce
2018/03/13 09:55 https://android.googlesource.com/kernel/common android-4.9 a2904940bde8 08dacaa0 .config console log report ci-android-49-kasan-gce
2018/03/08 21:29 https://android.googlesource.com/kernel/common android-4.9 00db063b0f88 acd0caa5 .config console log report ci-android-49-kasan-gce
2018/03/02 16:37 https://android.googlesource.com/kernel/common android-4.9 4c4262aa50dc 2c6f473e .config console log report ci-android-49-kasan-gce
2018/02/26 00:42 https://android.googlesource.com/kernel/common android-4.9 a92bb8d6eac3 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/25 22:57 https://android.googlesource.com/kernel/common android-4.9 a92bb8d6eac3 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/18 18:31 https://android.googlesource.com/kernel/common android-4.9 cdfc8df1d262 833f78c7 .config console log report ci-android-49-kasan-gce
2018/02/18 15:23 https://android.googlesource.com/kernel/common android-4.9 cdfc8df1d262 833f78c7 .config console log report ci-android-49-kasan-gce
2018/02/04 01:24 https://android.googlesource.com/kernel/common android-4.9 47af77b1dced 632a8c2c .config console log report ci-android-49-kasan-gce
2018/02/01 10:03 https://android.googlesource.com/kernel/common android-4.9 71f146972231 02553e22 .config console log report ci-android-49-kasan-gce
2018/02/01 00:17 https://android.googlesource.com/kernel/common android-4.9 71f146972231 02553e22 .config console log report ci-android-49-kasan-gce
2018/01/31 08:25 https://android.googlesource.com/kernel/common android-4.9 7be198545491 02553e22 .config console log report ci-android-49-kasan-gce
2018/01/31 05:04 https://android.googlesource.com/kernel/common android-4.9 7be198545491 02553e22 .config console log report ci-android-49-kasan-gce
2018/01/31 00:05 https://android.googlesource.com/kernel/common android-4.9 7be198545491 a899be78 .config console log report ci-android-49-kasan-gce
2018/01/26 19:55 https://android.googlesource.com/kernel/common android-4.9 f518fe49bbaa 1d18b112 .config console log report ci-android-49-kasan-gce
2018/01/24 01:06 https://android.googlesource.com/kernel/common android-4.9 e9dabe69deb8 a5b7566c .config console log report ci-android-49-kasan-gce
2018/01/21 12:30 https://android.googlesource.com/kernel/common android-4.9 e12a9c4458ff fbbdcd92 .config console log report ci-android-49-kasan-gce
2018/01/20 21:02 https://android.googlesource.com/kernel/common android-4.9 e12a9c4458ff fbbdcd92 .config console log report ci-android-49-kasan-gce
2018/01/20 17:22 https://android.googlesource.com/kernel/common android-4.9 e12a9c4458ff fbbdcd92 .config console log report ci-android-49-kasan-gce
2018/08/25 01:45 https://android.googlesource.com/kernel/common android-4.9 6a1b5923548a 9b0f5c75 .config console log report ci-android-49-kasan-gce-386
2018/07/31 16:00 https://android.googlesource.com/kernel/common android-4.9 90e7a9002952 1a381291 .config console log report ci-android-49-kasan-gce-386
2018/03/29 09:01 https://android.googlesource.com/kernel/common android-4.9 dd4d08c98e95 bf5e585c .config console log report ci-android-49-kasan-gce-386
2018/03/25 05:18 https://android.googlesource.com/kernel/common android-4.9 f152ce1be2ab 2e9d9054 .config console log report ci-android-49-kasan-gce-386
2018/03/18 11:49 https://android.googlesource.com/kernel/common android-4.9 bb52bba67e35 08dacaa0 .config console log report ci-android-49-kasan-gce-386
2018/02/20 06:31 https://android.googlesource.com/kernel/common android-4.9 cdfc8df1d262 c1f526e3 .config console log report ci-android-49-kasan-gce-386
2018/02/19 03:08 https://android.googlesource.com/kernel/common android-4.9 cdfc8df1d262 833f78c7 .config console log report ci-android-49-kasan-gce-386
2018/02/18 06:45 https://android.googlesource.com/kernel/common android-4.9 cdfc8df1d262 833f78c7 .config console log report ci-android-49-kasan-gce-386
2018/02/13 08:32 https://android.googlesource.com/kernel/common android-4.9 8a174b4749d3 88bc17df .config console log report ci-android-49-kasan-gce-386
2018/02/12 05:18 https://android.googlesource.com/kernel/common android-4.9 8a174b4749d3 4e9b726d .config console log report ci-android-49-kasan-gce-386
2018/01/22 19:10 https://android.googlesource.com/kernel/common android-4.9 e12a9c4458ff 228e3d95 .config console log report ci-android-49-kasan-gce-386
* Struck through repros no longer work on HEAD.