syzbot


KASAN: use-after-free Read in br_multicast_port_group_expired

Status: auto-obsoleted due to no activity on 2024/11/18 18:23
Reported-by: syzbot+2553741eb6bcf78a59be@syzkaller.appspotmail.com
First crash: 104d, last: 104d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-use-after-free Read in br_multicast_port_group_expired bridge 1 159d 159d 28/28 fixed on 2024/10/03 15:25

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in br_multicast_port_group_expired+0x56/0x870 net/bridge/br_multicast.c:640
Read of size 8 at addr ffff888110546000 by task syz.0.2001/8859

CPU: 0 PID: 8859 Comm: syz.0.2001 Not tainted 5.10.223-syzkaller-01561-g0890c03b8b7d #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118
 print_address_description+0x81/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:435 [inline]
 kasan_report+0x179/0x1c0 mm/kasan/report.c:452
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:309
 br_multicast_port_group_expired+0x56/0x870 net/bridge/br_multicast.c:640
 call_timer_fn+0x3b/0x2d0 kernel/time/timer.c:1450
 expire_timers kernel/time/timer.c:1495 [inline]
 __run_timers+0x72a/0xa10 kernel/time/timer.c:1789
 run_timer_softirq+0x69/0xf0 kernel/time/timer.c:1802
 __do_softirq+0x268/0x5bb kernel/softirq.c:309
 asm_call_irq_on_stack+0xf/0x20
 </IRQ>
 __run_on_irqstack arch/x86/include/asm/irq_stack.h:26 [inline]
 run_on_irqstack_cond arch/x86/include/asm/irq_stack.h:77 [inline]
 do_softirq_own_stack+0x60/0x80 arch/x86/kernel/irq_64.c:77
 invoke_softirq kernel/softirq.c:405 [inline]
 __irq_exit_rcu+0x128/0x150 kernel/softirq.c:435
 irq_exit_rcu+0x9/0x10 kernel/softirq.c:447
 sysvec_apic_timer_interrupt+0xbf/0xe0 arch/x86/kernel/apic/apic.c:1094
 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:635
RIP: 0010:__skb_datagram_iter+0x6/0x780 net/core/datagram.c:416
Code: f9 41 b8 01 00 00 00 49 c7 c1 c0 4b 52 82 41 56 e8 0f 00 00 00 48 83 c4 08 5b 41 5c 41 5d 41 5e 41 5f 5d c3 55 48 89 e5 41 57 <41> 56 41 55 41 54 53 48 83 ec 68 4c 89 4d 90 44 89 45 a4 41 89 cd
RSP: 0018:ffffc900015e7700 EFLAGS: 00000246
RAX: ffffffff83c19a39 RBX: ffff88813d1e48c0 RCX: 0000000000000000
RDX: ffffc900015e7d70 RSI: 0000000000000000 RDI: ffff88813d1e48c0
RBP: ffffc900015e7708 R08: 0000000000000000 R09: ffffffff83c19b90
R10: 0000000000000000 R11: dffffc0000000001 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: ffffc900015e7d70
 skb_copy_datagram_iter+0x46/0x180 net/core/datagram.c:533
 skb_copy_datagram_msg include/linux/skbuff.h:3613 [inline]
 unix_dgram_recvmsg+0x7d1/0x1240 net/unix/af_unix.c:2199
 ____sys_recvmsg+0x286/0x530
 ___sys_recvmsg+0x1ec/0x690 net/socket.c:2637
 do_recvmmsg+0x407/0x920 net/socket.c:2731
 __sys_recvmmsg net/socket.c:2810 [inline]
 __do_sys_recvmmsg net/socket.c:2833 [inline]
 __se_sys_recvmmsg net/socket.c:2826 [inline]
 __x64_sys_recvmmsg+0x195/0x240 net/socket.c:2826
 do_syscall_64+0x34/0x70
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7fe38d960e79
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fe38c5bd038 EFLAGS: 00000246 ORIG_RAX: 000000000000012b
RAX: ffffffffffffffda RBX: 00007fe38dafd058 RCX: 00007fe38d960e79
RDX: 0000000000010106 RSI: 00000000200000c0 RDI: 000000000000000a
RBP: 00007fe38d9ce916 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000002 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007fe38dafd058 R15: 00007fff93814368

Allocated by task 3112:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:430 [inline]
 ____kasan_kmalloc+0xdb/0x110 mm/kasan/common.c:509
 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:518
 kasan_kmalloc include/linux/kasan.h:254 [inline]
 kmem_cache_alloc_trace+0x18a/0x2e0 mm/slub.c:2974
 kmalloc include/linux/slab.h:552 [inline]
 kzalloc include/linux/slab.h:664 [inline]
 new_nbp+0x211/0x5c0 net/bridge/br_if.c:421
 br_add_if+0x29c/0x1080 net/bridge/br_if.c:611
 br_add_slave+0x2c/0x40 net/bridge/br_device.c:391
 do_set_master net/core/rtnetlink.c:2539 [inline]
 do_setlink+0xe14/0x3c30 net/core/rtnetlink.c:2736
 __rtnl_newlink net/core/rtnetlink.c:3407 [inline]
 rtnl_newlink+0x15f0/0x2000 net/core/rtnetlink.c:3527
 rtnetlink_rcv_msg+0x955/0xc50 net/core/rtnetlink.c:5607
 netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2500
 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:5625
 netlink_unicast_kernel net/netlink/af_netlink.c:1322 [inline]
 netlink_unicast+0x8df/0xac0 net/netlink/af_netlink.c:1348
 netlink_sendmsg+0xa46/0xd00 net/netlink/af_netlink.c:1916
 sock_sendmsg_nosec net/socket.c:652 [inline]
 __sock_sendmsg net/socket.c:664 [inline]
 __sys_sendto+0x545/0x700 net/socket.c:2006
 __do_sys_sendto net/socket.c:2018 [inline]
 __se_sys_sendto net/socket.c:2014 [inline]
 __x64_sys_sendto+0xe5/0x100 net/socket.c:2014
 do_syscall_64+0x34/0x70
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Freed by task 8857:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:45
 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370
 ____kasan_slab_free+0x121/0x160 mm/kasan/common.c:362
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:370
 kasan_slab_free include/linux/kasan.h:220 [inline]
 slab_free_hook mm/slub.c:1595 [inline]
 slab_free_freelist_hook+0xc0/0x190 mm/slub.c:1621
 slab_free mm/slub.c:3203 [inline]
 kfree+0xc3/0x270 mm/slub.c:4191
 release_nbp+0x1c/0x20 net/bridge/br_if.c:254
 kobject_cleanup lib/kobject.c:713 [inline]
 kobject_release lib/kobject.c:744 [inline]
 kref_put include/linux/kref.h:65 [inline]
 kobject_put+0x178/0x260 lib/kobject.c:761
 destroy_nbp net/bridge/br_if.c:280 [inline]
 destroy_nbp_rcu+0x93/0xa0 net/bridge/br_if.c:287
 rcu_do_batch+0x597/0xc40 kernel/rcu/tree.c:2494
 rcu_core+0x5ad/0xe40 kernel/rcu/tree.c:2735
 rcu_core_si+0x9/0x10 kernel/rcu/tree.c:2748
 __do_softirq+0x268/0x5bb kernel/softirq.c:309

Last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xd3/0x100 mm/kasan/generic.c:348
 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358
 __call_rcu kernel/rcu/tree.c:2976 [inline]
 call_rcu+0x135/0x11f0 kernel/rcu/tree.c:3050
 del_nbp+0xbfb/0xd80 net/bridge/br_if.c:366
 br_dev_delete+0x72/0x110 net/bridge/br_if.c:376
 rtnl_delete_link net/core/rtnetlink.c:3077 [inline]
 rtnl_dellink+0x4bd/0x7c0 net/core/rtnetlink.c:3130
 rtnetlink_rcv_msg+0x955/0xc50 net/core/rtnetlink.c:5607
 netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2500
 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:5625
 netlink_unicast_kernel net/netlink/af_netlink.c:1322 [inline]
 netlink_unicast+0x8df/0xac0 net/netlink/af_netlink.c:1348
 netlink_sendmsg+0xa46/0xd00 net/netlink/af_netlink.c:1916
 sock_sendmsg_nosec net/socket.c:652 [inline]
 __sock_sendmsg net/socket.c:664 [inline]
 ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2376
 ___sys_sendmsg+0x252/0x2e0 net/socket.c:2430
 __sys_sendmsg net/socket.c:2459 [inline]
 __do_sys_sendmsg net/socket.c:2468 [inline]
 __se_sys_sendmsg+0x1b1/0x280 net/socket.c:2466
 __x64_sys_sendmsg+0x7b/0x90 net/socket.c:2466
 do_syscall_64+0x34/0x70
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

The buggy address belongs to the object at ffff888110546000
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 0 bytes inside of
 1024-byte region [ffff888110546000, ffff888110546400)
The buggy address belongs to the page:
page:ffffea0004415000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x110540
head:ffffea0004415000 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head)
raw: 4000000000010200 0000000000000000 0000000800000001 ffff888100042f00
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 99, ts 3942503274, free_ts 0
 set_page_owner include/linux/page_owner.h:35 [inline]
 post_alloc_hook mm/page_alloc.c:2456 [inline]
 prep_new_page+0x166/0x180 mm/page_alloc.c:2462
 get_page_from_freelist+0x2d8c/0x2f30 mm/page_alloc.c:4254
 __alloc_pages_nodemask+0x435/0xaf0 mm/page_alloc.c:5348
 allocate_slab mm/slub.c:1808 [inline]
 new_slab+0x80/0x400 mm/slub.c:1869
 new_slab_objects mm/slub.c:2627 [inline]
 ___slab_alloc+0x302/0x4b0 mm/slub.c:2791
 __slab_alloc+0x63/0xa0 mm/slub.c:2831
 slab_alloc_node mm/slub.c:2913 [inline]
 slab_alloc mm/slub.c:2955 [inline]
 __kmalloc_track_caller+0x1f8/0x320 mm/slub.c:4536
 __kmalloc_reserve net/core/skbuff.c:144 [inline]
 __alloc_skb+0xbc/0x510 net/core/skbuff.c:212
 alloc_skb include/linux/skbuff.h:1126 [inline]
 netlink_alloc_large_skb net/netlink/af_netlink.c:1194 [inline]
 netlink_sendmsg+0x7a4/0xd00 net/netlink/af_netlink.c:1891
 sock_sendmsg_nosec net/socket.c:652 [inline]
 __sock_sendmsg net/socket.c:664 [inline]
 ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2376
 ___sys_sendmsg+0x252/0x2e0 net/socket.c:2430
 __sys_sendmsg net/socket.c:2459 [inline]
 __do_sys_sendmsg net/socket.c:2468 [inline]
 __se_sys_sendmsg+0x1b1/0x280 net/socket.c:2466
 __x64_sys_sendmsg+0x7b/0x90 net/socket.c:2466
 do_syscall_64+0x34/0x70
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
page_owner free stack trace missing

Memory state around the buggy address:
 ffff888110545f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888110545f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888110546000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff888110546080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888110546100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
   0:	f9                   	stc
   1:	41 b8 01 00 00 00    	mov    $0x1,%r8d
   7:	49 c7 c1 c0 4b 52 82 	mov    $0xffffffff82524bc0,%r9
   e:	41 56                	push   %r14
  10:	e8 0f 00 00 00       	call   0x24
  15:	48 83 c4 08          	add    $0x8,%rsp
  19:	5b                   	pop    %rbx
  1a:	41 5c                	pop    %r12
  1c:	41 5d                	pop    %r13
  1e:	41 5e                	pop    %r14
  20:	41 5f                	pop    %r15
  22:	5d                   	pop    %rbp
  23:	c3                   	ret
  24:	55                   	push   %rbp
  25:	48 89 e5             	mov    %rsp,%rbp
  28:	41 57                	push   %r15
* 2a:	41 56                	push   %r14 <-- trapping instruction
  2c:	41 55                	push   %r13
  2e:	41 54                	push   %r12
  30:	53                   	push   %rbx
  31:	48 83 ec 68          	sub    $0x68,%rsp
  35:	4c 89 4d 90          	mov    %r9,-0x70(%rbp)
  39:	44 89 45 a4          	mov    %r8d,-0x5c(%rbp)
  3d:	41 89 cd             	mov    %ecx,%r13d

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/08/20 18:18 android13-5.10-lts 0890c03b8b7d 9f0ab3fb .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Read in br_multicast_port_group_expired
* Struck through repros no longer work on HEAD.