syzbot


KASAN: use-after-free Read in inet_shutdown

Status: public: reported syz repro on 2019/04/14 00:02
Reported-by: syzbot+b907c7defb4d06b02b49@syzkaller.appspotmail.com
First crash: 2488d, last: 2285d
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
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
android-49 KASAN: use-after-free Read in inet_shutdown C 51 2280d 2049d 0/3 public: reported C repro on 2019/04/13 00:00

Sample crash report:
IPv6: ADDRCONF(NETDEV_CHANGE): veth0_to_bridge: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth1_to_bridge: link becomes ready
IPv6: ADDRCONF(NETDEV_UP): veth0: link is not ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth0: link becomes ready
==================================================================
BUG: KASAN: use-after-free in inet_shutdown+0x2e9/0x370 net/ipv4/af_inet.c:809
Read of size 4 at addr ffff8801c7724440 by task syz-executor0/4224

CPU: 0 PID: 4224 Comm: syz-executor0 Not tainted 4.4.138-gcf21a9a #62
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
 0000000000000000 42f239834f51da51 ffff8801d6e4fb58 ffffffff81e0ed0d
 ffffea00071dc900 ffff8801c7724440 0000000000000000 ffff8801c7724440
 ffff8801d98f5458 ffff8801d6e4fb90 ffffffff81515a16 ffff8801c7724440
Call Trace:
 [<ffffffff81e0ed0d>] __dump_stack lib/dump_stack.c:15 [inline]
 [<ffffffff81e0ed0d>] dump_stack+0xc1/0x124 lib/dump_stack.c:51
 [<ffffffff81515a16>] print_address_description+0x6c/0x216 mm/kasan/report.c:252
 [<ffffffff81515d35>] kasan_report_error mm/kasan/report.c:351 [inline]
 [<ffffffff81515d35>] kasan_report.cold.7+0x175/0x2f7 mm/kasan/report.c:408
 [<ffffffff814f9804>] __asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:428
 [<ffffffff832f8a69>] inet_shutdown+0x2e9/0x370 net/ipv4/af_inet.c:809
 [<ffffffff835a6370>] pppol2tp_session_close+0xa0/0xe0 net/l2tp/l2tp_ppp.c:458
 [<ffffffff8359f3e5>] l2tp_tunnel_closeall+0x205/0x350 net/l2tp/l2tp_core.c:1274
 [<ffffffff8359ffab>] l2tp_udp_encap_destroy+0x8b/0xf0 net/l2tp/l2tp_core.c:1300
 [<ffffffff83492431>] udpv6_destroy_sock+0xb1/0xd0 net/ipv6/udp.c:1421
 [<ffffffff82f2fa5d>] sk_common_release+0x6d/0x300 net/core/sock.c:2680
 [<ffffffff834910e5>] udp_lib_close+0x15/0x20 include/net/udp.h:190
 [<ffffffff832f8bef>] inet_release+0xff/0x1d0 net/ipv4/af_inet.c:435
 [<ffffffff8341b810>] inet6_release+0x50/0x70 net/ipv6/af_inet6.c:424
 [<ffffffff82f1a186>] sock_release+0x96/0x1c0 net/socket.c:586
 [<ffffffff82f1a2c6>] sock_close+0x16/0x20 net/socket.c:1037
 [<ffffffff81522e05>] __fput+0x235/0x6f0 fs/file_table.c:208
 [<ffffffff81523345>] ____fput+0x15/0x20 fs/file_table.c:244
 [<ffffffff8118bd7f>] task_work_run+0x10f/0x190 kernel/task_work.c:115
 [<ffffffff8100362d>] tracehook_notify_resume include/linux/tracehook.h:191 [inline]
 [<ffffffff8100362d>] exit_to_usermode_loop+0x13d/0x160 arch/x86/entry/common.c:252
 [<ffffffff81007090>] prepare_exit_to_usermode arch/x86/entry/common.c:283 [inline]
 [<ffffffff81007090>] syscall_return_slowpath arch/x86/entry/common.c:348 [inline]
 [<ffffffff81007090>] do_syscall_32_irqs_on arch/x86/entry/common.c:398 [inline]
 [<ffffffff81007090>] do_fast_syscall_32+0x620/0x8b0 arch/x86/entry/common.c:459
 [<ffffffff838c406a>] sysenter_flags_fixed+0xd/0x17

Allocated by task 4224:
 [<ffffffff81033e46>] save_stack_trace+0x26/0x50 arch/x86/kernel/stacktrace.c:63
 [<ffffffff814f88d3>] save_stack+0x43/0xd0 mm/kasan/kasan.c:512
 [<ffffffff814f8bb7>] set_track mm/kasan/kasan.c:524 [inline]
 [<ffffffff814f8bb7>] kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:616
 [<ffffffff814f9182>] kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:554
 [<ffffffff814f4c7e>] slab_post_alloc_hook mm/slub.c:1349 [inline]
 [<ffffffff814f4c7e>] slab_alloc_node mm/slub.c:2615 [inline]
 [<ffffffff814f4c7e>] slab_alloc mm/slub.c:2623 [inline]
 [<ffffffff814f4c7e>] kmem_cache_alloc+0xbe/0x2a0 mm/slub.c:2628
 [<ffffffff82f1c72d>] sock_alloc_inode+0x1d/0x260 net/socket.c:250
 [<ffffffff8156f863>] alloc_inode+0x63/0x180 fs/inode.c:198
 [<ffffffff815750f7>] new_inode_pseudo+0x17/0xe0 fs/inode.c:878
 [<ffffffff82f1a9e1>] sock_alloc+0x41/0x280 net/socket.c:555
 [<ffffffff82f2044d>] __sock_create+0x8d/0x5f0 net/socket.c:1141
 [<ffffffff82f20be0>] sock_create net/socket.c:1217 [inline]
 [<ffffffff82f20be0>] SYSC_socket net/socket.c:1247 [inline]
 [<ffffffff82f20be0>] SyS_socket+0xf0/0x1b0 net/socket.c:1227
 [<ffffffff81006d96>] do_syscall_32_irqs_on arch/x86/entry/common.c:392 [inline]
 [<ffffffff81006d96>] do_fast_syscall_32+0x326/0x8b0 arch/x86/entry/common.c:459
 [<ffffffff838c406a>] sysenter_flags_fixed+0xd/0x17

Freed by task 4226:
 [<ffffffff81033e46>] save_stack_trace+0x26/0x50 arch/x86/kernel/stacktrace.c:63
 [<ffffffff814f88d3>] save_stack+0x43/0xd0 mm/kasan/kasan.c:512
 [<ffffffff814f9202>] set_track mm/kasan/kasan.c:524 [inline]
 [<ffffffff814f9202>] kasan_slab_free+0x72/0xc0 mm/kasan/kasan.c:589
 [<ffffffff814f638e>] slab_free_hook mm/slub.c:1383 [inline]
 [<ffffffff814f638e>] slab_free_freelist_hook mm/slub.c:1405 [inline]
 [<ffffffff814f638e>] slab_free mm/slub.c:2859 [inline]
 [<ffffffff814f638e>] kmem_cache_free+0xbe/0x340 mm/slub.c:2881
 [<ffffffff82f1c6f6>] sock_destroy_inode+0x56/0x70 net/socket.c:280
 [<ffffffff81571ff2>] destroy_inode+0xc2/0x120 fs/inode.c:255
 [<ffffffff81572372>] evict+0x322/0x4f0 fs/inode.c:559
 [<ffffffff815729c1>] iput_final fs/inode.c:1477 [inline]
 [<ffffffff815729c1>] iput+0x391/0x980 fs/inode.c:1504
 [<ffffffff81564232>] dentry_iput fs/dcache.c:372 [inline]
 [<ffffffff81564232>] __dentry_kill+0x492/0x5f0 fs/dcache.c:559
 [<ffffffff81567b27>] dentry_kill fs/dcache.c:603 [inline]
 [<ffffffff81567b27>] dput.part.26+0x587/0x760 fs/dcache.c:818
 [<ffffffff81567d1f>] dput+0x1f/0x30 fs/dcache.c:782
 [<ffffffff81522fd1>] __fput+0x401/0x6f0 fs/file_table.c:226
 [<ffffffff81523345>] ____fput+0x15/0x20 fs/file_table.c:244
 [<ffffffff8118bd7f>] task_work_run+0x10f/0x190 kernel/task_work.c:115
 [<ffffffff8100362d>] tracehook_notify_resume include/linux/tracehook.h:191 [inline]
 [<ffffffff8100362d>] exit_to_usermode_loop+0x13d/0x160 arch/x86/entry/common.c:252
 [<ffffffff81007090>] prepare_exit_to_usermode arch/x86/entry/common.c:283 [inline]
 [<ffffffff81007090>] syscall_return_slowpath arch/x86/entry/common.c:348 [inline]
 [<ffffffff81007090>] do_syscall_32_irqs_on arch/x86/entry/common.c:398 [inline]
 [<ffffffff81007090>] do_fast_syscall_32+0x620/0x8b0 arch/x86/entry/common.c:459
 [<ffffffff838c406a>] sysenter_flags_fixed+0xd/0x17

The buggy address belongs to the object at ffff8801c7724440
 which belongs to the cache sock_inode_cache of size 936
The buggy address is located 0 bytes inside of
 936-byte region [ffff8801c7724440, ffff8801c77247e8)
The buggy address belongs to the page:
kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory accessgeneral protection fault: 0000 [#1] PREEMPT SMP KASAN
Dumping ftrace buffer:
   (ftrace buffer empty)
Modules linked in:
CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.4.138-gcf21a9a #62
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
task: ffff8801d9a41800 task.stack: ffff8801d9a50000
RIP: 0010:[<ffffffff81e2c678>]  [<ffffffff81e2c678>] timerqueue_add+0xb8/0x2b0 lib/timerqueue.c:51
RSP: 0018:ffff8801db307d30  EFLAGS: 00010007
RAX: ffffed003b66338b RBX: ffff8801db319c40 RCX: 0000000000000000
RDX: 000000001083e1e8 RSI: ffffffff81e2c65c RDI: 00000000841f0f46
RBP: ffff8801db307d70 R08: 0000000000000096 R09: 0000000000000001
R10: 0000000000000000 R11: ffff8801d9a41800 R12: dffffc0000000000
R13: 00000000841f0f2e R14: 0000000c8cb0bb00 R15: ffffffff8148cf87
FS:  0000000000000000(0000) GS:ffff8801db300000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f13f8436000 CR3: 00000000ad9a5000 CR4: 00000000001606f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Stack:
 ffff8801db319c58 ffff8801db319710 ffffed003b66338b ffff8801db319700
 ffff8801db319c40 ffff8801db319640 0000000000000001 0000000000000000
 ffff8801db307da8 ffffffff8129b35f ffff8801db319c40 0000000000000001
Call Trace:
 <IRQ> 
 [<ffffffff8129b35f>] enqueue_hrtimer+0x15f/0x440 kernel/time/hrtimer.c:893
 [<ffffffff8129e052>] __run_hrtimer kernel/time/hrtimer.c:1276 [inline]
 [<ffffffff8129e052>] __hrtimer_run_queues+0x6b2/0x1000 kernel/time/hrtimer.c:1325
 [<ffffffff8129f4c1>] hrtimer_interrupt+0x1b1/0x430 kernel/time/hrtimer.c:1359
 [<ffffffff810ad284>] local_apic_timer_interrupt+0x74/0xa0 arch/x86/kernel/apic/apic.c:901
 [<ffffffff838c534c>] smp_apic_timer_interrupt+0x7c/0xa0 arch/x86/kernel/apic/apic.c:925
 [<ffffffff838c4290>] apic_timer_interrupt+0xa0/0xb0 arch/x86/entry/entry_64.S:741
 <EOI> 
 [<ffffffff81025cf5>] arch_safe_halt arch/x86/include/asm/paravirt.h:117 [inline]
 [<ffffffff81025cf5>] default_idle+0x55/0x3c0 arch/x86/kernel/process.c:290
 [<ffffffff81027240>] arch_cpu_idle+0x10/0x20 arch/x86/kernel/process.c:281
 [<ffffffff8121bc07>] default_idle_call+0x57/0x70 kernel/sched/idle.c:93
 [<ffffffff8121c3af>] cpuidle_idle_call kernel/sched/idle.c:157 [inline]
 [<ffffffff8121c3af>] cpu_idle_loop kernel/sched/idle.c:253 [inline]
 [<ffffffff8121c3af>] cpu_startup_entry+0x6af/0x780 kernel/sched/idle.c:301
 [<ffffffff810a9e54>] start_secondary+0x324/0x400 arch/x86/kernel/smpboot.c:242
Code: 00 00 4d 8b 2f 4d 85 ed 74 3d e8 54 4e 52 ff 48 8b 45 d0 80 38 00 0f 85 96 01 00 00 49 8d 7d 18 4c 8b 73 18 48 89 fa 48 c1 ea 03 <42> 80 3c 22 00 0f 85 8a 01 00 00 4d 3b 75 18 7c a3 e8 22 4e 52 
RIP  [<ffffffff81e2c678>] timerqueue_add+0xb8/0x2b0 lib/timerqueue.c:51
 RSP <ffff8801db307d30>
---[ end trace f35182ce9c183740 ]---

Crashes (8):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/06/30 10:59 https://android.googlesource.com/kernel/common android-4.4 cf21a9ac5ee4 dba0b50e .config console log report syz ci-android-44-kasan-gce-386
2018/08/20 09:48 https://android.googlesource.com/kernel/common android-4.4 5541782ce2bb 2dc4378f .config console log report ci-android-44-kasan-gce
2018/08/01 00:03 https://android.googlesource.com/kernel/common android-4.4 7bbfac190345 1477993e .config console log report ci-android-44-kasan-gce
2018/07/18 04:16 https://android.googlesource.com/kernel/common android-4.4 b1bad9e2324d 6d5bd5b5 .config console log report ci-android-44-kasan-gce
2018/07/13 03:05 https://android.googlesource.com/kernel/common android-4.4 789274d6967d 06c33b3a .config console log report ci-android-44-kasan-gce
2018/08/14 14:27 https://android.googlesource.com/kernel/common android-4.4 a5fc66599b61 7a88b141 .config console log report ci-android-44-kasan-gce-386
2018/02/28 09:18 https://android.googlesource.com/kernel/common android-4.4 239a415f39e0 05b5a32c .config console log report ci-android-44-kasan-gce-386
2018/01/29 10:20 https://android.googlesource.com/kernel/common android-4.4 202e079275c6 08d47756 .config console log report ci-android-44-kasan-gce-386
* Struck through repros no longer work on HEAD.