KASAN: use-after-free Read in tcp_retransmit_timer

14 views
Skip to first unread message

syzbot

unread,
Dec 26, 2019, 12:26:09 AM12/26/19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 672481c2 Linux 4.19.91
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=12da52c6e00000
kernel config: https://syzkaller.appspot.com/x/.config?x=445a712574d168a6
dashboard link: https://syzkaller.appspot.com/bug?extid=75a2838bf261586d71c6
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+75a283...@syzkaller.appspotmail.com

overlayfs: fs on './file0' does not support file handles, falling back to
index=off,nfs_export=off.
overlayfs: filesystem on './file0' not supported as upperdir
==================================================================
BUG: KASAN: use-after-free in tcp_retransmit_timer+0x2bd3/0x2f90
net/ipv4/tcp_timer.c:485
Read of size 8 at addr ffff888094eecbb8 by task kworker/u4:1/9117

CPU: 0 PID: 9117 Comm: kworker/u4:1 Not tainted 4.19.91-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Workqueue: netns cleanup_net
Call Trace:
<IRQ>
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x197/0x210 lib/dump_stack.c:118
print_address_description.cold+0x7c/0x20d mm/kasan/report.c:256
kasan_report_error mm/kasan/report.c:354 [inline]
kasan_report mm/kasan/report.c:412 [inline]
kasan_report.cold+0x8c/0x2ba mm/kasan/report.c:396
__asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
tcp_retransmit_timer+0x2bd3/0x2f90 net/ipv4/tcp_timer.c:485
tcp_write_timer_handler+0x513/0x900 net/ipv4/tcp_timer.c:598
tcp_write_timer+0x111/0x1d0 net/ipv4/tcp_timer.c:618
call_timer_fn+0x18d/0x720 kernel/time/timer.c:1326
expire_timers kernel/time/timer.c:1363 [inline]
__run_timers kernel/time/timer.c:1684 [inline]
__run_timers kernel/time/timer.c:1652 [inline]
run_timer_softirq+0x64f/0x16a0 kernel/time/timer.c:1697
__do_softirq+0x25c/0x921 kernel/softirq.c:292
invoke_softirq kernel/softirq.c:372 [inline]
irq_exit+0x180/0x1d0 kernel/softirq.c:412
exiting_irq arch/x86/include/asm/apic.h:536 [inline]
smp_apic_timer_interrupt+0x13b/0x550 arch/x86/kernel/apic/apic.c:1094
apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:893
</IRQ>
RIP: 0010:should_resched arch/x86/include/asm/preempt.h:99 [inline]
RIP: 0010:__local_bh_enable_ip+0x18e/0x270 kernel/softirq.c:196
Code: 00 00 00 00 fc ff df 48 c1 e8 03 80 3c 10 00 0f 85 df 00 00 00 48 83
3d 57 f8 b1 07 00 0f 84 8f 00 00 00 fb 66 0f 1f 44 00 00 <65> 8b 05 3b 8a
c1 7e 85 c0 74 7f 5b 41 5c 41 5d 5d c3 80 3d 3c 22
RSP: 0018:ffff8880841df6c0 EFLAGS: 00000286 ORIG_RAX: ffffffffffffff13
RAX: 1ffffffff11e4b7b RBX: 0000000000000200 RCX: 1ffff1101214c1b3
RDX: dffffc0000000000 RSI: ffff888090a60d78 RDI: ffff888090a60cfc
RBP: ffff8880841df6d8 R08: ffff888090a60480 R09: ffff888090a60d98
R10: 0000000000000000 R11: 0000000000000000 R12: ffffffff85ee28e1
R13: ffff888090a60480 R14: 0000000000000001 R15: dffffc0000000000
local_bh_enable include/linux/bottom_half.h:32 [inline]
get_next_corpse net/netfilter/nf_conntrack_core.c:1928 [inline]
nf_ct_iterate_cleanup+0x217/0x4e0 net/netfilter/nf_conntrack_core.c:1951
nf_ct_iterate_cleanup_net net/netfilter/nf_conntrack_core.c:2036 [inline]
nf_ct_iterate_cleanup_net+0x133/0x190
net/netfilter/nf_conntrack_core.c:2021
masq_device_event+0xb5/0xe0 net/ipv6/netfilter/nf_nat_masquerade_ipv6.c:77
notifier_call_chain+0xc2/0x230 kernel/notifier.c:93
__raw_notifier_call_chain kernel/notifier.c:394 [inline]
raw_notifier_call_chain+0x2e/0x40 kernel/notifier.c:401
call_netdevice_notifiers_info+0x3f/0x90 net/core/dev.c:1747
call_netdevice_notifiers net/core/dev.c:1765 [inline]
dev_close_many+0x33f/0x6f0 net/core/dev.c:1517
rollback_registered_many+0x33f/0xda0 net/core/dev.c:7997
unregister_netdevice_many.part.0+0x1b/0x1f0 net/core/dev.c:9130
unregister_netdevice_many+0x3b/0x50 net/core/dev.c:9129
ip_tunnel_delete_nets+0x41e/0x5f0 net/ipv4/ip_tunnel.c:1079
ipgre_tap_exit_batch_net+0x23/0x30 net/ipv4/ip_gre.c:1661
ops_exit_list.isra.0+0xfc/0x150 net/core/net_namespace.c:156
cleanup_net+0x404/0x960 net/core/net_namespace.c:553
process_one_work+0x989/0x1750 kernel/workqueue.c:2153
worker_thread+0x98/0xe40 kernel/workqueue.c:2296
kthread+0x354/0x420 kernel/kthread.c:246
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

Allocated by task 28074:
save_stack+0x45/0xd0 mm/kasan/kasan.c:448
set_track mm/kasan/kasan.c:460 [inline]
kasan_kmalloc mm/kasan/kasan.c:553 [inline]
kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:531
kasan_slab_alloc+0xf/0x20 mm/kasan/kasan.c:490
kmem_cache_alloc+0x12e/0x700 mm/slab.c:3559
kmem_cache_zalloc include/linux/slab.h:699 [inline]
net_alloc net/core/net_namespace.c:385 [inline]
copy_net_ns+0xed/0x33c net/core/net_namespace.c:425
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:2520
__do_sys_unshare kernel/fork.c:2588 [inline]
__se_sys_unshare kernel/fork.c:2586 [inline]
__x64_sys_unshare+0x31/0x40 kernel/fork.c:2586
do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 9117:
save_stack+0x45/0xd0 mm/kasan/kasan.c:448
set_track mm/kasan/kasan.c:460 [inline]
__kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
__cache_free mm/slab.c:3503 [inline]
kmem_cache_free+0x86/0x260 mm/slab.c:3765
net_free net/core/net_namespace.c:401 [inline]
net_drop_ns+0x7e/0x90 net/core/net_namespace.c:408
cleanup_net+0x53b/0x960 net/core/net_namespace.c:571
process_one_work+0x989/0x1750 kernel/workqueue.c:2153
worker_thread+0x98/0xe40 kernel/workqueue.c:2296
kthread+0x354/0x420 kernel/kthread.c:246
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

The buggy address belongs to the object at ffff888094eec980
which belongs to the cache net_namespace of size 8640
The buggy address is located 568 bytes inside of
8640-byte region [ffff888094eec980, ffff888094eeeb40)
The buggy address belongs to the page:
page:ffffea000253bb00 count:1 mapcount:0 mapping:ffff88821bab2540 index:0x0
compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffffea0002720d08 ffffea0000be0608 ffff88821bab2540
raw: 0000000000000000 ffff888094eec980 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff888094eeca80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888094eecb00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ffff888094eecb80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
kobject: 'loop2' (0000000004da3b6e): fill_kobj_path: path
= '/devices/virtual/block/loop2'
^
ffff888094eecc00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888094eecc80: 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,
Apr 25, 2020, 5:53:09 AM4/25/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