syzbot


KASAN: use-after-free Read in __dev_queue_xmit (3)

Status: fixed on 2018/11/12 21:25
Subsystems: net
[Documentation on labels]
Fix commit: 460b360104d5 net_sched: fix a crash in tc_new_tfilter()
First crash: 2071d, last: 2068d
Similar bugs (9)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-49 KASAN: use-after-free Read in __dev_queue_xmit C 46 1652d 1874d 0/3 public: reported C repro on 2019/04/13 00:00
upstream KASAN: use-after-free Read in __dev_queue_xmit (4) block 1 1404d 1404d 0/26 auto-closed as invalid on 2020/10/23 09:56
upstream KASAN: use-after-free Read in __dev_queue_xmit (5) block C unreliable error 49 89d 968d 0/26 upstream: reported C repro on 2021/10/04 21:37
upstream KASAN: use-after-free Read in __dev_queue_xmit (2) net C 2 2201d 2201d 5/26 fixed on 2018/06/07 13:52
linux-6.1 KASAN: use-after-free Read in __dev_queue_xmit origin:upstream C 2 33d 396d 0/3 upstream: reported C repro on 2023/04/29 13:33
linux-5.15 KASAN: use-after-free Read in __dev_queue_xmit origin:upstream missing-backport C error 3 117d 367d 0/3 upstream: reported C repro on 2023/05/28 17:42
linux-4.19 KASAN: use-after-free Read in __dev_queue_xmit C error 15 454d 1126d 0/1 upstream: reported C repro on 2021/04/30 04:08
upstream KASAN: use-after-free Read in __dev_queue_xmit net C 10 2219d 2338d 5/26 fixed on 2018/05/09 07:47
linux-4.14 KASAN: use-after-free Read in __dev_queue_xmit C error 1 628d 840d 0/1 upstream: reported C repro on 2022/02/10 06:42

Sample crash report:
netlink: 4 bytes leftover after parsing attributes in process `syz-executor3'.
netlink: 4 bytes leftover after parsing attributes in process `syz-executor3'.
==================================================================
BUG: KASAN: use-after-free in __dev_queue_xmit+0x33ab/0x3950 net/core/dev.c:3772
Read of size 8 at addr ffff8801c15a1240 by task kworker/u4:5/7397

CPU: 0 PID: 7397 Comm: kworker/u4:5 Not tainted 4.19.0-rc5+ #237
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+0x1c4/0x2b4 lib/dump_stack.c:113
 print_address_description.cold.8+0x9/0x1ff mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.9+0x242/0x309 mm/kasan/report.c:412
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
 __dev_queue_xmit+0x33ab/0x3950 net/core/dev.c:3772
 dev_queue_xmit+0x17/0x20 net/core/dev.c:3838
 neigh_resolve_output+0x681/0xaf0 net/core/neighbour.c:1364
 neigh_output include/net/neighbour.h:483 [inline]
 ip6_finish_output2+0xc91/0x27a0 net/ipv6/ip6_output.c:120
 ip6_finish_output+0x5fe/0xbc0 net/ipv6/ip6_output.c:154
 NF_HOOK_COND include/linux/netfilter.h:276 [inline]
 ip6_output+0x23e/0xa00 net/ipv6/ip6_output.c:171
 dst_output include/net/dst.h:444 [inline]
 ip6_local_out+0xc5/0x1b0 net/ipv6/output_core.c:176
 ip6_send_skb+0xbc/0x340 net/ipv6/ip6_output.c:1695
 ip6_push_pending_frames+0xc5/0xf0 net/ipv6/ip6_output.c:1715
 icmpv6_push_pending_frames+0x34a/0x540 net/ipv6/icmp.c:288
 icmp6_send+0x265c/0x2d70 net/ipv6/icmp.c:580
 icmpv6_send+0x180/0x310 net/ipv6/ip6_icmp.c:43
 ip6_link_failure+0xb8/0x950 net/ipv6/route.c:2236
 dst_link_failure include/net/dst.h:427 [inline]
 ndisc_error_report+0xd1/0x1c0 net/ipv6/ndisc.c:695
 neigh_invalidate+0x246/0x550 net/core/neighbour.c:894
 neigh_timer_handler+0xb07/0xdf0 net/core/neighbour.c:980
 call_timer_fn+0x272/0x920 kernel/time/timer.c:1326
 expire_timers kernel/time/timer.c:1363 [inline]
 __run_timers+0x7e5/0xc70 kernel/time/timer.c:1682
 run_timer_softirq+0x52/0xb0 kernel/time/timer.c:1695
 __do_softirq+0x30b/0xad8 kernel/softirq.c:292
 invoke_softirq kernel/softirq.c:372 [inline]
 irq_exit+0x17f/0x1c0 kernel/softirq.c:412
 exiting_irq arch/x86/include/asm/apic.h:536 [inline]
 smp_apic_timer_interrupt+0x1cb/0x760 arch/x86/kernel/apic/apic.c:1056
 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:864
 </IRQ>
RIP: 0010:arch_local_irq_enable arch/x86/include/asm/paravirt.h:798 [inline]
RIP: 0010:__local_bh_enable_ip+0x193/0x260 kernel/softirq.c:194
Code: 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 c8 00 00 00 48 83 3d 9e 66 e7 07 00 74 5b fb 66 0f 1f 44 00 00 <65> 8b 05 46 62 b7 7e 85 c0 75 05 e8 14 f2 b5 ff 5b 41 5c 41 5d 5d
RSP: 0018:ffff880196b9f320 EFLAGS: 00000286 ORIG_RAX: ffffffffffffff13
RAX: dffffc0000000000 RBX: 0000000000000200 RCX: 1ffff10037a4612e
RDX: 1ffffffff1263e43 RSI: 0000000000000000 RDI: ffffffff8931f218
RBP: ffff880196b9f338 R08: ffff8801bd230970 R09: 0000000000000007
R10: 0000000000000000 R11: ffff8801bd230080 R12: ffffffff863dfa31
R13: ffff8801bd230080 R14: 0000000000000001 R15: dffffc0000000000
 local_bh_enable include/linux/bottom_half.h:32 [inline]
 get_next_corpse net/netfilter/nf_conntrack_core.c:1866 [inline]
 nf_ct_iterate_cleanup+0x298/0x5c0 net/netfilter/nf_conntrack_core.c:1889
 nf_conntrack_cleanup_net_list+0xd7/0x330 net/netfilter/nf_conntrack_core.c:2076
 nf_conntrack_pernet_exit+0x11d/0x170 net/netfilter/nf_conntrack_standalone.c:663
 ops_exit_list.isra.7+0x105/0x160 net/core/net_namespace.c:156
 cleanup_net+0x555/0xb10 net/core/net_namespace.c:551
 process_one_work+0xc90/0x1b90 kernel/workqueue.c:2153
 worker_thread+0x17f/0x1390 kernel/workqueue.c:2296
 kthread+0x35a/0x420 kernel/kthread.c:246
 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:413

Allocated by task 5836:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:553
 __do_kmalloc_node mm/slab.c:3682 [inline]
 __kmalloc_node+0x47/0x70 mm/slab.c:3689
 kmalloc_node include/linux/slab.h:555 [inline]
 kzalloc_node include/linux/slab.h:718 [inline]
 qdisc_alloc+0x10f/0xb50 net/sched/sch_generic.c:820
 qdisc_create_dflt+0x7a/0x1e0 net/sched/sch_generic.c:894
 attach_one_default_qdisc net/sched/sch_generic.c:1041 [inline]
 netdev_for_each_tx_queue include/linux/netdevice.h:2114 [inline]
 attach_default_qdiscs net/sched/sch_generic.c:1060 [inline]
 dev_activate+0x82f/0xcb0 net/sched/sch_generic.c:1103
 __dev_open+0x2cb/0x410 net/core/dev.c:1400
 __dev_change_flags+0x730/0x9b0 net/core/dev.c:7448
 dev_change_flags+0x89/0x150 net/core/dev.c:7517
 do_setlink+0xb5f/0x3f20 net/core/rtnetlink.c:2441
 rtnl_newlink+0x136f/0x1d40 net/core/rtnetlink.c:3054
 rtnetlink_rcv_msg+0x46a/0xc20 net/core/rtnetlink.c:4730
 netlink_rcv_skb+0x172/0x440 net/netlink/af_netlink.c:2447
 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:4748
 netlink_unicast_kernel net/netlink/af_netlink.c:1310 [inline]
 netlink_unicast+0x5a5/0x760 net/netlink/af_netlink.c:1336
 netlink_sendmsg+0xa18/0xfc0 net/netlink/af_netlink.c:1901
 sock_sendmsg_nosec net/socket.c:621 [inline]
 sock_sendmsg+0xd5/0x120 net/socket.c:631
 ___sys_sendmsg+0x7fd/0x930 net/socket.c:2116
 __sys_sendmsg+0x11d/0x280 net/socket.c:2154
 __do_sys_sendmsg net/socket.c:2163 [inline]
 __se_sys_sendmsg net/socket.c:2161 [inline]
 __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2161
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 23329:
 save_stack+0x43/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:3498 [inline]
 kfree+0xcf/0x230 mm/slab.c:3813
 qdisc_free+0x89/0x100 net/sched/sch_generic.c:941
 qdisc_free_cb+0x19/0x20 net/sched/sch_generic.c:948
 __rcu_reclaim kernel/rcu/rcu.h:236 [inline]
 rcu_do_batch kernel/rcu/tree.c:2576 [inline]
 invoke_rcu_callbacks kernel/rcu/tree.c:2880 [inline]
 __rcu_process_callbacks kernel/rcu/tree.c:2847 [inline]
 rcu_process_callbacks+0xf23/0x2670 kernel/rcu/tree.c:2864
 __do_softirq+0x30b/0xad8 kernel/softirq.c:292

The buggy address belongs to the object at ffff8801c15a1240
 which belongs to the cache kmalloc-1024 of size 1024
The buggy address is located 0 bytes inside of
 1024-byte region [ffff8801c15a1240, ffff8801c15a1640)
The buggy address belongs to the page:
page:ffffea0007056800 count:1 mapcount:0 mapping:ffff8801da800ac0 index:0x0 compound_mapcount: 0
flags: 0x2fffc0000008100(slab|head)
raw: 02fffc0000008100 ffffea0007600d88 ffffea0006fe3e88 ffff8801da800ac0
raw: 0000000000000000 ffff8801c15a0040 0000000100000007 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801c15a1100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801c15a1180: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff8801c15a1200: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
                                           ^
 ffff8801c15a1280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801c15a1300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (11):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/09/30 01:23 net-next-old d4017665854b 41e4b329 .config console log report ci-upstream-net-kasan-gce
2018/10/01 07:45 linux-next 4794a36bf08d 41e4b329 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/10/01 06:24 linux-next 4794a36bf08d 41e4b329 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/10/01 06:00 linux-next 4794a36bf08d 41e4b329 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/10/01 01:59 linux-next 4794a36bf08d 41e4b329 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/10/01 00:08 linux-next 4794a36bf08d 41e4b329 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/09/30 20:12 linux-next 4794a36bf08d 41e4b329 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/09/30 08:47 linux-next 4794a36bf08d 41e4b329 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/09/30 06:28 linux-next 4794a36bf08d 41e4b329 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/09/30 04:32 linux-next 4794a36bf08d 41e4b329 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/09/28 00:04 linux-next 9e27e2c2d003 0c2fa87b .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.