syzbot


KASAN: use-after-free Read in __gnet_stats_copy_basic

Status: auto-closed as invalid on 2020/10/01 15:18
Subsystems: net
[Documentation on labels]
First crash: 1877d, last: 1877d

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x3c7b/0x56e0 kernel/locking/lockdep.c:4250
Read of size 8 at addr ffff888098805148 by task syz-executor.5/7306

CPU: 1 PID: 7306 Comm: syz-executor.5 Not tainted 5.8.0-rc3-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x18f/0x20d lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xae/0x436 mm/kasan/report.c:383
 __kasan_report mm/kasan/report.c:513 [inline]
 kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530
 __lock_acquire+0x3c7b/0x56e0 kernel/locking/lockdep.c:4250
 lock_acquire+0x1f1/0xad0 kernel/locking/lockdep.c:4959
 seqcount_lockdep_reader_access include/linux/seqlock.h:97 [inline]
 read_seqcount_begin include/linux/seqlock.h:182 [inline]
 __gnet_stats_copy_basic+0xd9/0x590 net/core/gen_stats.c:153
 est_fetch_counters+0xc6/0x160 net/core/gen_estimator.c:69
 est_timer+0x7d/0x4e0 net/core/gen_estimator.c:82
 call_timer_fn+0x1ac/0x760 kernel/time/timer.c:1404
 expire_timers kernel/time/timer.c:1449 [inline]
 __run_timers.part.0+0x54c/0xa20 kernel/time/timer.c:1773
 __run_timers kernel/time/timer.c:1745 [inline]
 run_timer_softirq+0xae/0x1a0 kernel/time/timer.c:1786
 __do_softirq+0x34c/0xa60 kernel/softirq.c:292
 asm_call_on_stack+0xf/0x20 arch/x86/entry/entry_64.S:711
 </IRQ>
 __run_on_irqstack arch/x86/include/asm/irq_stack.h:22 [inline]
 run_on_irqstack_cond arch/x86/include/asm/irq_stack.h:48 [inline]
 do_softirq_own_stack+0x111/0x170 arch/x86/kernel/irq_64.c:77
 invoke_softirq kernel/softirq.c:387 [inline]
 __irq_exit_rcu kernel/softirq.c:417 [inline]
 irq_exit_rcu+0x229/0x270 kernel/softirq.c:429
 sysvec_apic_timer_interrupt+0x54/0x120 arch/x86/kernel/apic/apic.c:1091
 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:596
RIP: 0010:arch_local_irq_restore+0x2e/0x50 arch/x86/include/asm/paravirt.h:765
Code: e0 b4 89 53 48 89 fb 48 ba 00 00 00 00 00 fc ff df 48 c1 e8 03 80 3c 10 00 75 18 48 83 3d e9 e8 5b 08 00 74 0c 48 89 df 57 9d <0f> 1f 44 00 00 5b c3 0f 0b 48 c7 c7 40 e0 b4 89 e8 2d 15 5a 00 eb
RSP: 0018:ffffc90006f6fd08 EFLAGS: 00000282
RAX: 1ffffffff1369c08 RBX: 0000000000000282 RCX: ffffffff81c203fb
RDX: dffffc0000000000 RSI: ffffffff89bc1080 RDI: 0000000000000282
RBP: ffff88805a696000 R08: 0000000000000001 R09: ffffffff8c58fab7
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: ffff88805a6968d0 R14: ffff88805a6968d0 R15: 0000000000000282
 lock_is_held_type+0xb0/0xe0 kernel/locking/lockdep.c:4998
 lock_is_held include/linux/lockdep.h:425 [inline]
 ___might_sleep+0x268/0x2f0 kernel/sched/core.c:6865
 down_write_nested+0x71/0x150 kernel/locking/rwsem.c:1626
 inode_lock_nested include/linux/fs.h:834 [inline]
 do_unlinkat+0x27d/0x660 fs/namei.c:3875
 do_syscall_32_irqs_on+0x3f/0x60 arch/x86/entry/common.c:403
 __do_fast_syscall_32 arch/x86/entry/common.c:448 [inline]
 do_fast_syscall_32+0x7f/0x120 arch/x86/entry/common.c:474
 entry_SYSENTER_compat+0x6d/0x7c arch/x86/entry/entry_64_compat.S:138
RIP: 0023:0xf7f6d569
Code: Bad RIP value.
RSP: 002b:00000000086aed1c EFLAGS: 00000212 ORIG_RAX: 000000000000000a
RAX: ffffffffffffffda RBX: 00000000086aedac RCX: 000000005eff4bf8
RDX: 000000000a388198 RSI: 0000000000000000 RDI: 00000000080d75bc
RBP: 00000000086aedac R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 15012:
 save_stack+0x1b/0x40 mm/kasan/common.c:48
 set_track mm/kasan/common.c:56 [inline]
 __kasan_kmalloc.constprop.0+0xc2/0xd0 mm/kasan/common.c:494
 kmalloc_node include/linux/slab.h:578 [inline]
 kzalloc_node include/linux/slab.h:680 [inline]
 qdisc_alloc+0xb1/0xcd0 net/sched/sch_generic.c:818
 qdisc_create+0xdc/0x12e0 net/sched/sch_api.c:1204
 tc_modify_qdisc+0x97c/0x1990 net/sched/sch_api.c:1645
 rtnetlink_rcv_msg+0x44e/0xad0 net/core/rtnetlink.c:5460
 netlink_rcv_skb+0x15a/0x430 net/netlink/af_netlink.c:2469
 netlink_unicast_kernel net/netlink/af_netlink.c:1303 [inline]
 netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1329
 netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1918
 sock_sendmsg_nosec net/socket.c:652 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:672
 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2352
 ___sys_sendmsg+0xf3/0x170 net/socket.c:2406
 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2439
 do_syscall_32_irqs_on+0x3f/0x60 arch/x86/entry/common.c:403
 __do_fast_syscall_32 arch/x86/entry/common.c:448 [inline]
 do_fast_syscall_32+0x7f/0x120 arch/x86/entry/common.c:474
 entry_SYSENTER_compat+0x6d/0x7c arch/x86/entry/entry_64_compat.S:138

Freed by task 17111:
 save_stack+0x1b/0x40 mm/kasan/common.c:48
 set_track mm/kasan/common.c:56 [inline]
 kasan_set_free_info mm/kasan/common.c:316 [inline]
 __kasan_slab_free+0xf5/0x140 mm/kasan/common.c:455
 __cache_free mm/slab.c:3426 [inline]
 kfree+0x103/0x2c0 mm/slab.c:3757
 rcu_do_batch kernel/rcu/tree.c:2414 [inline]
 rcu_core+0x5c7/0x1160 kernel/rcu/tree.c:2641
 __do_softirq+0x34c/0xa60 kernel/softirq.c:292

The buggy address belongs to the object at ffff888098805000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 328 bytes inside of
 2048-byte region [ffff888098805000, ffff888098805800)
The buggy address belongs to the page:
page:ffffea0002620140 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0
flags: 0xfffe0000000200(slab)
raw: 00fffe0000000200 ffffea00024376c8 ffffea00023e6a88 ffff8880aa000e00
raw: 0000000000000000 ffff888098805000 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888098805000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888098805080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888098805100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                              ^
 ffff888098805180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888098805200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/07/03 15:17 upstream cd77006e01b3 bed10395 .config console log report ci-upstream-kasan-gce-386
* Struck through repros no longer work on HEAD.