KASAN: use-after-free Read in inet_twsk_purge

5 views
Skip to first unread message

syzbot

unread,
Aug 25, 2019, 12:41:07 AM8/25/19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 45f092f9 Linux 4.14.139
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=12c7fab6600000
kernel config: https://syzkaller.appspot.com/x/.config?x=56ab4cf14cc8892d
dashboard link: https://syzkaller.appspot.com/bug?extid=1213843ce3d718b68fe8
compiler: gcc (GCC) 9.0.0 20181231 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+121384...@syzkaller.appspotmail.com

==================================================================
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+0x480/0x4e0
net/ipv4/inet_timewait_sock.c:276
Read of size 4 at addr ffff8880a8f64244 by task kworker/u4:2/6669

CPU: 1 PID: 6669 Comm: kworker/u4:2 Not tainted 4.14.139 #35
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+0x138/0x19c lib/dump_stack.c:53
print_address_description.cold+0x7c/0x1dc mm/kasan/report.c:252
kasan_report_error mm/kasan/report.c:351 [inline]
kasan_report mm/kasan/report.c:409 [inline]
kasan_report.cold+0xa9/0x2af mm/kasan/report.c:393
__asan_report_load4_noabort+0x14/0x20 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+0x480/0x4e0 net/ipv4/inet_timewait_sock.c:276
tcpv6_net_exit_batch+0x1a/0x20 net/ipv6/tcp_ipv6.c:1992
ops_exit_list.isra.0+0xfc/0x150 net/core/net_namespace.c:145
cleanup_net+0x3ba/0x880 net/core/net_namespace.c:484
process_one_work+0x863/0x1600 kernel/workqueue.c:2114
worker_thread+0x5d9/0x1050 kernel/workqueue.c:2248
kthread+0x319/0x430 kernel/kthread.c:232
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

Allocated by task 22102:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x45/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc mm/kasan/kasan.c:551 [inline]
kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:529
kasan_slab_alloc+0xf/0x20 mm/kasan/kasan.c:489
kmem_cache_alloc+0x12e/0x780 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+0xfa/0x440 net/core/net_namespace.c:402
create_new_namespaces+0x37b/0x720 kernel/nsproxy.c:107
unshare_nsproxy_namespaces+0xab/0x1e0 kernel/nsproxy.c:206
SYSC_unshare kernel/fork.c:2406 [inline]
SyS_unshare+0x2f3/0x7e0 kernel/fork.c:2356
do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 6964:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x45/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0x75/0xc0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kmem_cache_free+0x83/0x2b0 mm/slab.c:3758
net_free net/core/net_namespace.c:378 [inline]
net_drop_ns.part.0+0x63/0x80 net/core/net_namespace.c:385
net_drop_ns net/core/net_namespace.c:384 [inline]
cleanup_net+0x4ef/0x880 net/core/net_namespace.c:502
process_one_work+0x863/0x1600 kernel/workqueue.c:2114
worker_thread+0x5d9/0x1050 kernel/workqueue.c:2248
kthread+0x319/0x430 kernel/kthread.c:232
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

The buggy address belongs to the object at ffff8880a8f64240
which belongs to the cache net_namespace of size 8832
The buggy address is located 4 bytes inside of
8832-byte region [ffff8880a8f64240, ffff8880a8f664c0)
The buggy address belongs to the page:
page:ffffea0002a3d900 count:1 mapcount:0 mapping:ffff8880a8f64240 index:0x0
compound_mapcount: 0
flags: 0x1fffc0000008100(slab|head)
raw: 01fffc0000008100 ffff8880a8f64240 0000000000000000 0000000100000001
raw: ffffea0002540920 ffffea000150a920 ffff8880a9e0fd80 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880a8f64100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8880a8f64180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
> ffff8880a8f64200: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
^
ffff8880a8f64280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880a8f64300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
Mar 31, 2020, 8:08:09 AM3/31/20
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages