syzbot


KASAN: use-after-free Read in inet_twsk_purge (2)

Status: auto-closed as invalid on 2021/07/30 01:43
Reported-by: syzbot+a01494819e2b895c7be1@syzkaller.appspotmail.com
First crash: 1388d, last: 1352d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in inet_twsk_purge 3 1838d 1937d 0/1 auto-closed as invalid on 2020/03/31 12:08

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __read_once_size include/linux/compiler.h:183 [inline]
BUG: KASAN: use-after-free in atomic_read arch/x86/include/asm/atomic.h:27 [inline]
BUG: KASAN: use-after-free in inet_twsk_purge+0x530/0x5a0 net/ipv4/inet_timewait_sock.c:276
Read of size 4 at addr ffff8880572f8084 by task kworker/u4:4/2850

CPU: 0 PID: 2850 Comm: kworker/u4:4 Not tainted 4.14.228-syzkaller #0
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:17 [inline]
 dump_stack+0x1b2/0x281 lib/dump_stack.c:58
 print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
 kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351
 kasan_report mm/kasan/report.c:409 [inline]
 __asan_report_load4_noabort+0x68/0x70 mm/kasan/report.c:429
 __read_once_size include/linux/compiler.h:183 [inline]
 atomic_read arch/x86/include/asm/atomic.h:27 [inline]
 inet_twsk_purge+0x530/0x5a0 net/ipv4/inet_timewait_sock.c:276
 ops_exit_list+0xf9/0x150 net/core/net_namespace.c:145
 cleanup_net+0x3b3/0x840 net/core/net_namespace.c:484
 process_one_work+0x793/0x14a0 kernel/workqueue.c:2116
 worker_thread+0x5cc/0xff0 kernel/workqueue.c:2250
 kthread+0x30d/0x420 kernel/kthread.c:232
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

Allocated by task 8017:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
 kmem_cache_alloc+0x124/0x3c0 mm/slab.c:3552
 kmem_cache_zalloc include/linux/slab.h:651 [inline]
 net_alloc net/core/net_namespace.c:362 [inline]
 copy_net_ns+0xf7/0x440 net/core/net_namespace.c:402
 create_new_namespaces+0x375/0x720 kernel/nsproxy.c:107
 unshare_nsproxy_namespaces+0xa1/0x1d0 kernel/nsproxy.c:206
 SYSC_unshare kernel/fork.c:2412 [inline]
 SyS_unshare+0x308/0x7f0 kernel/fork.c:2362
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 619:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kmem_cache_free+0x7c/0x2b0 mm/slab.c:3758
 net_free net/core/net_namespace.c:378 [inline]
 net_drop_ns+0x63/0x70 net/core/net_namespace.c:385
 cleanup_net+0x526/0x840 net/core/net_namespace.c:502
 process_one_work+0x793/0x14a0 kernel/workqueue.c:2116
 worker_thread+0x5cc/0xff0 kernel/workqueue.c:2250
 kthread+0x30d/0x420 kernel/kthread.c:232
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

The buggy address belongs to the object at ffff8880572f8080
 which belongs to the cache net_namespace of size 8832
The buggy address is located 4 bytes inside of
 8832-byte region [ffff8880572f8080, ffff8880572fa300)
The buggy address belongs to the page:
page:ffffea00015cbe00 count:1 mapcount:0 mapping:ffff8880572f8080 index:0x0 compound_mapcount: 0
flags: 0xfff00000008100(slab|head)
raw: 00fff00000008100 ffff8880572f8080 0000000000000000 0000000100000001
raw: ffff8880b5583c48 ffffea00015ba120 ffff8880b5f92b40 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880572f7f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8880572f8000: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880572f8080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff8880572f8100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880572f8180: 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
2021/04/01 01:42 linux-4.14.y bd634aa64163 6a81331a .config console log report info ci2-linux-4-14 KASAN: use-after-free Read in inet_twsk_purge
2021/02/24 06:10 linux-4.14.y 3242aa3a635c fcc6d71b .config console log report info ci2-linux-4-14 KASAN: use-after-free Read in inet_twsk_purge
* Struck through repros no longer work on HEAD.