syzbot


KASAN: use-after-free Read in br_dev_xmit

Status: upstream: reported C repro on 2021/12/19 03:10
Reported-by: syzbot+f0b88ff740ba5aeb8772@syzkaller.appspotmail.com
First crash: 353d, last: 26d

Fix bisection: failed (bisect log)
similar bugs (2):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in br_dev_xmit 1 1015d 1015d 17/24 fixed on 2020/04/15 17:19
upstream KMSAN: uninit-value in br_dev_xmit C 536 95d 1016d 0/24 upstream: reported C repro on 2020/02/24 08:38

Sample crash report:
bond0: Enslaving vlan3 as an active interface with an up link
device bridge14 entered promiscuous mode
team0: Port device vlan4 added
device bridge15 entered promiscuous mode
==================================================================
BUG: KASAN: use-after-free in br_dev_xmit+0x12b3/0x13e0 net/bridge/br_device.c:68 net/bridge/br_device.c:68
Read of size 2 at addr ffff8880aed5eb8e by task swapper/1/0

CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.19.211-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 lib/dump_stack.c:77 [inline] lib/dump_stack.c:118
 dump_stack+0x1fc/0x2ef lib/dump_stack.c:118 lib/dump_stack.c:118
 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256 mm/kasan/report.c:256
 kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354 mm/kasan/report.c:354
 kasan_report mm/kasan/report.c:412 [inline]
 kasan_report mm/kasan/report.c:412 [inline] mm/kasan/report.c:443
 __asan_report_load_n_noabort+0x8b/0xa0 mm/kasan/report.c:443 mm/kasan/report.c:443
 br_dev_xmit+0x12b3/0x13e0 net/bridge/br_device.c:68 net/bridge/br_device.c:68
 __netdev_start_xmit include/linux/netdevice.h:4349 [inline]
 netdev_start_xmit include/linux/netdevice.h:4363 [inline]
 xmit_one net/core/dev.c:3256 [inline]
 __netdev_start_xmit include/linux/netdevice.h:4349 [inline] net/core/dev.c:3272
 netdev_start_xmit include/linux/netdevice.h:4363 [inline] net/core/dev.c:3272
 xmit_one net/core/dev.c:3256 [inline] net/core/dev.c:3272
 dev_hard_start_xmit+0x1a8/0x920 net/core/dev.c:3272 net/core/dev.c:3272
 __dev_queue_xmit+0x269d/0x2e00 net/core/dev.c:3838 net/core/dev.c:3838
 vlan_dev_hard_start_xmit+0x38f/0x800 net/8021q/vlan_dev.c:131 net/8021q/vlan_dev.c:131
 __netdev_start_xmit include/linux/netdevice.h:4349 [inline]
 netdev_start_xmit include/linux/netdevice.h:4363 [inline]
 xmit_one net/core/dev.c:3256 [inline]
 __netdev_start_xmit include/linux/netdevice.h:4349 [inline] net/core/dev.c:3272
 netdev_start_xmit include/linux/netdevice.h:4363 [inline] net/core/dev.c:3272
 xmit_one net/core/dev.c:3256 [inline] net/core/dev.c:3272
 dev_hard_start_xmit+0x1a8/0x920 net/core/dev.c:3272 net/core/dev.c:3272
 __dev_queue_xmit+0x269d/0x2e00 net/core/dev.c:3838 net/core/dev.c:3838
 neigh_connected_output+0x3e8/0x5e0 net/core/neighbour.c:1403 net/core/neighbour.c:1403
 neigh_output include/net/neighbour.h:501 [inline]
 neigh_output include/net/neighbour.h:501 [inline] net/ipv6/ip6_output.c:120
 ip6_finish_output2+0x113d/0x2290 net/ipv6/ip6_output.c:120 net/ipv6/ip6_output.c:120
 ip6_finish_output+0x89b/0x10f0 net/ipv6/ip6_output.c:192 net/ipv6/ip6_output.c:192
 NF_HOOK_COND include/linux/netfilter.h:278 [inline]
 NF_HOOK_COND include/linux/netfilter.h:278 [inline] net/ipv6/ip6_output.c:209
 ip6_output+0x205/0x770 net/ipv6/ip6_output.c:209 net/ipv6/ip6_output.c:209
 dst_output include/net/dst.h:455 [inline]
 NF_HOOK include/linux/netfilter.h:289 [inline]
 dst_output include/net/dst.h:455 [inline] net/ipv6/mcast.c:1681
 NF_HOOK include/linux/netfilter.h:289 [inline] net/ipv6/mcast.c:1681
 mld_sendpack+0x674/0x1060 net/ipv6/mcast.c:1681 net/ipv6/mcast.c:1681
 mld_send_cr net/ipv6/mcast.c:1977 [inline]
 mld_send_cr net/ipv6/mcast.c:1977 [inline] net/ipv6/mcast.c:2476
 mld_ifc_timer_expire+0x616/0xdf0 net/ipv6/mcast.c:2476 net/ipv6/mcast.c:2476
 call_timer_fn+0x177/0x700 kernel/time/timer.c:1338 kernel/time/timer.c:1338
 expire_timers+0x243/0x4e0 kernel/time/timer.c:1375 kernel/time/timer.c:1375
 __run_timers kernel/time/timer.c:1696 [inline]
 __run_timers kernel/time/timer.c:1696 [inline] kernel/time/timer.c:1709
 run_timer_softirq+0x21c/0x670 kernel/time/timer.c:1709 kernel/time/timer.c:1709
 __do_softirq+0x265/0x980 kernel/softirq.c:292 kernel/softirq.c:292
 invoke_softirq kernel/softirq.c:372 [inline]
 invoke_softirq kernel/softirq.c:372 [inline] kernel/softirq.c:412
 irq_exit+0x215/0x260 kernel/softirq.c:412 kernel/softirq.c:412
 exiting_irq arch/x86/include/asm/apic.h:536 [inline]
 exiting_irq arch/x86/include/asm/apic.h:536 [inline] arch/x86/kernel/apic/apic.c:1098
 smp_apic_timer_interrupt+0x136/0x550 arch/x86/kernel/apic/apic.c:1098 arch/x86/kernel/apic/apic.c:1098
 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:894 arch/x86/entry/entry_64.S:894
 </IRQ>
RIP: 0010:native_safe_halt+0xe/0x10 arch/x86/include/asm/irqflags.h:61 arch/x86/include/asm/irqflags.h:61
Code: 48 89 df e8 f4 20 7f f9 e9 2e ff ff ff 48 89 df e8 e7 20 7f f9 eb 82 90 90 90 90 90 e9 07 00 00 00 0f 00 2d 14 43 4e 00 fb f4 <c3> 90 e9 07 00 00 00 0f 00 2d 04 43 4e 00 f4 c3 90 90 41 56 41 55
RSP: 0018:ffff8880b5a9fd40 EFLAGS: 00000282 ORIG_RAX: ffffffffffffff13
RAX: 1ffffffff13e3054 RBX: dffffc0000000000 RCX: 0000000000000000
RDX: dffffc0000000000 RSI: 0000000000000001 RDI: ffff8880b5a86c44
RBP: 0000000000000001 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffffffff89f18290
R13: 1ffff11016b53fb2 R14: 0000000000000000 R15: 0000000000000000
 arch_safe_halt arch/x86/include/asm/paravirt.h:94 [inline]
 arch_safe_halt arch/x86/include/asm/paravirt.h:94 [inline] arch/x86/kernel/process.c:557
 default_idle+0x49/0x310 arch/x86/kernel/process.c:557 arch/x86/kernel/process.c:557
 cpuidle_idle_call kernel/sched/idle.c:153 [inline]
 cpuidle_idle_call kernel/sched/idle.c:153 [inline] kernel/sched/idle.c:263
 do_idle+0x2ec/0x4b0 kernel/sched/idle.c:263 kernel/sched/idle.c:263
 cpu_startup_entry+0xc5/0xe0 kernel/sched/idle.c:369 kernel/sched/idle.c:369
 start_secondary+0x435/0x5c0 arch/x86/kernel/smpboot.c:271 arch/x86/kernel/smpboot.c:271
 secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:243 arch/x86/kernel/head_64.S:243

Allocated by task 0:
 __do_kmalloc_node mm/slab.c:3689 [inline]
 __do_kmalloc_node mm/slab.c:3689 [inline] mm/slab.c:3703
 __kmalloc_node_track_caller+0x4c/0x70 mm/slab.c:3703 mm/slab.c:3703
 __kmalloc_reserve net/core/skbuff.c:137 [inline]
 __kmalloc_reserve net/core/skbuff.c:137 [inline] net/core/skbuff.c:205
 __alloc_skb+0xae/0x560 net/core/skbuff.c:205 net/core/skbuff.c:205
 alloc_skb include/linux/skbuff.h:995 [inline]
 alloc_skb include/linux/skbuff.h:995 [inline] net/core/skbuff.c:5333
 alloc_skb_with_frags+0x92/0x570 net/core/skbuff.c:5333 net/core/skbuff.c:5333
 sock_alloc_send_pskb+0x6e1/0x830 net/core/sock.c:2108 net/core/sock.c:2108
 mld_newpack+0x1d2/0x760 net/ipv6/mcast.c:1609 net/ipv6/mcast.c:1609
 add_grhead+0x265/0x330 net/ipv6/mcast.c:1712 net/ipv6/mcast.c:1712
 add_grec+0xe3c/0x10b0 net/ipv6/mcast.c:1843 net/ipv6/mcast.c:1843
 mld_send_cr net/ipv6/mcast.c:1969 [inline]
 mld_send_cr net/ipv6/mcast.c:1969 [inline] net/ipv6/mcast.c:2476
 mld_ifc_timer_expire+0x5a2/0xdf0 net/ipv6/mcast.c:2476 net/ipv6/mcast.c:2476
 call_timer_fn+0x177/0x700 kernel/time/timer.c:1338 kernel/time/timer.c:1338
 expire_timers+0x243/0x4e0 kernel/time/timer.c:1375 kernel/time/timer.c:1375
 __run_timers kernel/time/timer.c:1696 [inline]
 __run_timers kernel/time/timer.c:1696 [inline] kernel/time/timer.c:1709
 run_timer_softirq+0x21c/0x670 kernel/time/timer.c:1709 kernel/time/timer.c:1709
 __do_softirq+0x265/0x980 kernel/softirq.c:292 kernel/softirq.c:292

Freed by task 0:
 __cache_free mm/slab.c:3503 [inline]
 __cache_free mm/slab.c:3503 [inline] mm/slab.c:3822
 kfree+0xcc/0x210 mm/slab.c:3822 mm/slab.c:3822
 skb_free_head net/core/skbuff.c:563 [inline]
 skb_free_head net/core/skbuff.c:563 [inline] net/core/skbuff.c:1506
 pskb_expand_head+0x327/0xf20 net/core/skbuff.c:1506 net/core/skbuff.c:1506
 __skb_cow include/linux/skbuff.h:2977 [inline]
 skb_cow_head include/linux/skbuff.h:3011 [inline]
 __vlan_insert_inner_tag include/linux/if_vlan.h:346 [inline]
 vlan_insert_inner_tag include/linux/if_vlan.h:416 [inline]
 vlan_insert_tag include/linux/if_vlan.h:441 [inline]
 vlan_insert_tag_set_proto include/linux/if_vlan.h:460 [inline]
 __allowed_ingress net/bridge/br_vlan.c:437 [inline]
 __skb_cow include/linux/skbuff.h:2977 [inline] net/bridge/br_vlan.c:514
 skb_cow_head include/linux/skbuff.h:3011 [inline] net/bridge/br_vlan.c:514
 __vlan_insert_inner_tag include/linux/if_vlan.h:346 [inline] net/bridge/br_vlan.c:514
 vlan_insert_inner_tag include/linux/if_vlan.h:416 [inline] net/bridge/br_vlan.c:514
 vlan_insert_tag include/linux/if_vlan.h:441 [inline] net/bridge/br_vlan.c:514
 vlan_insert_tag_set_proto include/linux/if_vlan.h:460 [inline] net/bridge/br_vlan.c:514
 __allowed_ingress net/bridge/br_vlan.c:437 [inline] net/bridge/br_vlan.c:514
 br_allowed_ingress+0x376/0xed0 net/bridge/br_vlan.c:514 net/bridge/br_vlan.c:514
 br_dev_xmit+0x3e5/0x13e0 net/bridge/br_device.c:64 net/bridge/br_device.c:64
 __netdev_start_xmit include/linux/netdevice.h:4349 [inline]
 netdev_start_xmit include/linux/netdevice.h:4363 [inline]
 xmit_one net/core/dev.c:3256 [inline]
 __netdev_start_xmit include/linux/netdevice.h:4349 [inline] net/core/dev.c:3272
 netdev_start_xmit include/linux/netdevice.h:4363 [inline] net/core/dev.c:3272
 xmit_one net/core/dev.c:3256 [inline] net/core/dev.c:3272
 dev_hard_start_xmit+0x1a8/0x920 net/core/dev.c:3272 net/core/dev.c:3272
 __dev_queue_xmit+0x269d/0x2e00 net/core/dev.c:3838 net/core/dev.c:3838
 vlan_dev_hard_start_xmit+0x38f/0x800 net/8021q/vlan_dev.c:131 net/8021q/vlan_dev.c:131
 __netdev_start_xmit include/linux/netdevice.h:4349 [inline]
 netdev_start_xmit include/linux/netdevice.h:4363 [inline]
 xmit_one net/core/dev.c:3256 [inline]
 __netdev_start_xmit include/linux/netdevice.h:4349 [inline] net/core/dev.c:3272
 netdev_start_xmit include/linux/netdevice.h:4363 [inline] net/core/dev.c:3272
 xmit_one net/core/dev.c:3256 [inline] net/core/dev.c:3272
 dev_hard_start_xmit+0x1a8/0x920 net/core/dev.c:3272 net/core/dev.c:3272
 __dev_queue_xmit+0x269d/0x2e00 net/core/dev.c:3838 net/core/dev.c:3838
 neigh_connected_output+0x3e8/0x5e0 net/core/neighbour.c:1403 net/core/neighbour.c:1403
 neigh_output include/net/neighbour.h:501 [inline]
 neigh_output include/net/neighbour.h:501 [inline] net/ipv6/ip6_output.c:120
 ip6_finish_output2+0x113d/0x2290 net/ipv6/ip6_output.c:120 net/ipv6/ip6_output.c:120
 ip6_finish_output+0x89b/0x10f0 net/ipv6/ip6_output.c:192 net/ipv6/ip6_output.c:192
 NF_HOOK_COND include/linux/netfilter.h:278 [inline]
 NF_HOOK_COND include/linux/netfilter.h:278 [inline] net/ipv6/ip6_output.c:209
 ip6_output+0x205/0x770 net/ipv6/ip6_output.c:209 net/ipv6/ip6_output.c:209
 dst_output include/net/dst.h:455 [inline]
 NF_HOOK include/linux/netfilter.h:289 [inline]
 dst_output include/net/dst.h:455 [inline] net/ipv6/mcast.c:1681
 NF_HOOK include/linux/netfilter.h:289 [inline] net/ipv6/mcast.c:1681
 mld_sendpack+0x674/0x1060 net/ipv6/mcast.c:1681 net/ipv6/mcast.c:1681
 mld_send_cr net/ipv6/mcast.c:1977 [inline]
 mld_send_cr net/ipv6/mcast.c:1977 [inline] net/ipv6/mcast.c:2476
 mld_ifc_timer_expire+0x616/0xdf0 net/ipv6/mcast.c:2476 net/ipv6/mcast.c:2476
 call_timer_fn+0x177/0x700 kernel/time/timer.c:1338 kernel/time/timer.c:1338
 expire_timers+0x243/0x4e0 kernel/time/timer.c:1375 kernel/time/timer.c:1375
 __run_timers kernel/time/timer.c:1696 [inline]
 __run_timers kernel/time/timer.c:1696 [inline] kernel/time/timer.c:1709
 run_timer_softirq+0x21c/0x670 kernel/time/timer.c:1709 kernel/time/timer.c:1709
 __do_softirq+0x265/0x980 kernel/softirq.c:292 kernel/softirq.c:292

The buggy address belongs to the object at ffff8880aed5eb80
 which belongs to the cache kmalloc-2048 of size 2048
The buggy address is located 14 bytes inside of
 2048-byte region [ffff8880aed5eb80, ffff8880aed5f380)
The buggy address belongs to the page:
page:ffffea0002bb5780 count:1 mapcount:0 mapping:ffff88813bff0c40 index:0x0 compound_mapcount: 0
flags: 0xfff00000008100(slab|head)
raw: 00fff00000008100 ffffea000254b008 ffff88813bff1948 ffff88813bff0c40
raw: 0000000000000000 ffff8880aed5e300 0000000100000003 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880aed5ea80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880aed5eb00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880aed5eb80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                      ^
 ffff8880aed5ec00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880aed5ec80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
   0:	48 89 df             	mov    %rbx,%rdi
   3:	e8 f4 20 7f f9       	callq  0xf97f20fc
   8:	e9 2e ff ff ff       	jmpq   0xffffff3b
   d:	48 89 df             	mov    %rbx,%rdi
  10:	e8 e7 20 7f f9       	callq  0xf97f20fc
  15:	eb 82                	jmp    0xffffff99
  17:	90                   	nop
  18:	90                   	nop
  19:	90                   	nop
  1a:	90                   	nop
  1b:	90                   	nop
  1c:	e9 07 00 00 00       	jmpq   0x28
  21:	0f 00 2d 14 43 4e 00 	verw   0x4e4314(%rip)        # 0x4e433c
  28:	fb                   	sti
  29:	f4                   	hlt
* 2a:	c3                   	retq <-- trapping instruction
  2b:	90                   	nop
  2c:	e9 07 00 00 00       	jmpq   0x38
  31:	0f 00 2d 04 43 4e 00 	verw   0x4e4304(%rip)        # 0x4e433c
  38:	f4                   	hlt
  39:	c3                   	retq
  3a:	90                   	nop
  3b:	90                   	nop
  3c:	41 56                	push   %r14
  3e:	41 55                	push   %r13
----------------
Code disassembly (best guess):
   0:	48 89 df             	mov    %rbx,%rdi
   3:	e8 f4 20 7f f9       	callq  0xf97f20fc
   8:	e9 2e ff ff ff       	jmpq   0xffffff3b
   d:	48 89 df             	mov    %rbx,%rdi
  10:	e8 e7 20 7f f9       	callq  0xf97f20fc
  15:	eb 82                	jmp    0xffffff99
  17:	90                   	nop
  18:	90                   	nop
  19:	90                   	nop
  1a:	90                   	nop
  1b:	90                   	nop
  1c:	e9 07 00 00 00       	jmpq   0x28
  21:	0f 00 2d 14 43 4e 00 	verw   0x4e4314(%rip)        # 0x4e433c
  28:	fb                   	sti
  29:	f4                   	hlt
* 2a:	c3                   	retq <-- trapping instruction
  2b:	90                   	nop
  2c:	e9 07 00 00 00       	jmpq   0x38
  31:	0f 00 2d 04 43 4e 00 	verw   0x4e4304(%rip)        # 0x4e433c
  38:	f4                   	hlt
  39:	c3                   	retq
  3a:	90                   	nop
  3b:	90                   	nop
  3c:	41 56                	push   %r14
  3e:	41 55                	push   %r13

Crashes (12):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-19 2021/12/19 03:35 linux-4.19.y 3f8a27f9e27b 44068e19 .config log report syz C KASAN: use-after-free Read in br_dev_xmit
ci2-linux-4-19 2022/11/10 15:56 linux-4.19.y 3f8a27f9e27b 3ead01ad .config log report info KASAN: use-after-free Read in br_dev_xmit
ci2-linux-4-19 2022/10/04 15:12 linux-4.19.y 3f8a27f9e27b eab8f949 .config log report info KASAN: use-after-free Read in br_dev_xmit
ci2-linux-4-19 2022/04/15 13:44 linux-4.19.y 3f8a27f9e27b b17b2923 .config log report info KASAN: use-after-free Read in br_dev_xmit
ci2-linux-4-19 2022/04/09 12:53 linux-4.19.y 3f8a27f9e27b e22c3da3 .config log report info KASAN: use-after-free Read in br_dev_xmit
ci2-linux-4-19 2022/03/19 05:22 linux-4.19.y 3f8a27f9e27b e2d91b1d .config log report info KASAN: use-after-free Read in br_dev_xmit
ci2-linux-4-19 2022/03/13 00:05 linux-4.19.y 3f8a27f9e27b 9e8eaa75 .config log report info KASAN: use-after-free Read in br_dev_xmit
ci2-linux-4-19 2022/03/02 09:12 linux-4.19.y 3f8a27f9e27b 45a13a73 .config log report info KASAN: use-after-free Read in br_dev_xmit
ci2-linux-4-19 2022/02/13 23:13 linux-4.19.y 3f8a27f9e27b 8b9ca619 .config log report info KASAN: use-after-free Read in br_dev_xmit
ci2-linux-4-19 2022/02/13 16:07 linux-4.19.y 3f8a27f9e27b 8b9ca619 .config log report info KASAN: use-after-free Read in br_dev_xmit
ci2-linux-4-19 2022/01/07 17:06 linux-4.19.y 3f8a27f9e27b 2ca0d385 .config log report info KASAN: use-after-free Read in br_dev_xmit
ci2-linux-4-19 2021/12/19 03:09 linux-4.19.y 3f8a27f9e27b 44068e19 .config log report info KASAN: use-after-free Read in br_dev_xmit
* Struck through repros no longer work on HEAD.