syzbot


KASAN: use-after-free Read in br_multicast_port_group_expired (2)

Status: premoderation: reported on 2025/02/23 05:27
Reported-by: syzbot+cbc012b9fc211fdf87f7@syzkaller.appspotmail.com
First crash: 14d, last: 14d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-10 KASAN: use-after-free Read in br_multicast_port_group_expired 1 200d 200d 0/2 auto-obsoleted due to no activity on 2024/11/18 18:23
upstream KASAN: slab-use-after-free Read in br_multicast_port_group_expired bridge 1 255d 255d 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 ffff88812548a000 by task syz.6.920/3999

CPU: 0 PID: 3999 Comm: syz.6.920 Not tainted 5.10.234-syzkaller-00023-g3f5f2283d684 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/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:1106
 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:635
RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:161 [inline]
RIP: 0010:_raw_spin_unlock_irqrestore+0x51/0x80 kernel/locking/spinlock.c:191
Code: 74 0c 48 c7 c7 30 79 6c 86 e8 7b ee f4 fc 48 83 3d 03 09 b9 01 00 74 37 48 89 df e8 1d 46 9d fc 66 90 4c 89 75 e8 ff 75 e8 9d <bf> 01 00 00 00 e8 35 b5 95 fc 65 8b 05 3a fd 4e 7b 85 c0 74 09 48
RSP: 0018:ffffc90000f0f618 EFLAGS: 00000246
RAX: 0000000000000001 RBX: ffff888114076c00 RCX: dffffc0000000000
RDX: dffffc0000000000 RSI: 0000000000000246 RDI: ffff888114076c00
RBP: ffffc90000f0f630 R08: dffffc0000000000 R09: ffffed1021f5d9e1
R10: 0000000000000000 R11: dffffc0000000001 R12: 0000000000000246
R13: 1ffff920001e1ed0 R14: 0000000000000246 R15: 0000000000000001
 spin_unlock_irqrestore include/linux/spinlock.h:409 [inline]
 __wake_up_common_lock kernel/sched/wait.c:126 [inline]
 __wake_up_sync_key+0x1b1/0x3d0 kernel/sched/wait.c:194
 unix_dgram_recvmsg+0x5f0/0x1240 net/unix/af_unix.c:2180
 ____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:0x7fb97b21c169
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:00007fb979865038 EFLAGS: 00000246 ORIG_RAX: 000000000000012b
RAX: ffffffffffffffda RBX: 00007fb97b435080 RCX: 00007fb97b21c169
RDX: 000000000400034f RSI: 0000400000000480 RDI: 0000000000000008
RBP: 00007fb97b29d2a0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000002 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000001 R14: 00007fb97b435080 R15: 00007ffc5c54bb18

Allocated by task 287:
 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:396
 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:2485
 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:5625
 netlink_unicast_kernel net/netlink/af_netlink.c:1307 [inline]
 netlink_unicast+0x8df/0xac0 net/netlink/af_netlink.c:1333
 netlink_sendmsg+0xa46/0xd00 net/netlink/af_netlink.c:1901
 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 328:
 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
 default_device_exit_batch+0x2e9/0x3f0 net/core/dev.c:11281
 ops_exit_list net/core/net_namespace.c:190 [inline]
 cleanup_net+0x6e9/0xcb0 net/core/net_namespace.c:609
 process_one_work+0x6dc/0xbd0 kernel/workqueue.c:2301
 worker_thread+0xaea/0x1510 kernel/workqueue.c:2447
 kthread+0x34b/0x3d0 kernel/kthread.c:313
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

The buggy address belongs to the object at ffff88812548a000
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 0 bytes inside of
 1024-byte region [ffff88812548a000, ffff88812548a400)
The buggy address belongs to the page:
page:ffffea0004952200 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x125488
head:ffffea0004952200 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head)
raw: 4000000000010200 ffffea0004688c00 0000000400000004 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 287, ts 21606396442, 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]
 kmem_cache_alloc_trace+0x1bd/0x2e0 mm/slub.c:2972
 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:396
 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:2485
 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:5625
 netlink_unicast_kernel net/netlink/af_netlink.c:1307 [inline]
 netlink_unicast+0x8df/0xac0 net/netlink/af_netlink.c:1333
page_owner free stack trace missing

Memory state around the buggy address:
 ffff888125489f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888125489f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88812548a000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff88812548a080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88812548a100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
general protection fault, probably for non-canonical address 0xdffffc0000000008: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000040-0x0000000000000047]
CPU: 0 PID: 3999 Comm: syz.6.920 Tainted: G    B             5.10.234-syzkaller-00023-g3f5f2283d684 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
RIP: 0010:constant_test_bit arch/x86/include/asm/bitops.h:207 [inline]
RIP: 0010:test_bit include/asm-generic/bitops/instrumented-non-atomic.h:135 [inline]
RIP: 0010:netif_running include/linux/netdevice.h:3645 [inline]
RIP: 0010:br_multicast_port_group_expired+0xac/0x870 net/bridge/br_multicast.c:645
Code: 00 74 08 48 89 df e8 b3 33 63 fd 48 89 5d c0 48 8b 1b 48 83 c3 40 48 89 df be 08 00 00 00 e8 7b 35 63 fd 48 89 d8 48 c1 e8 03 <42> 80 3c 30 00 74 08 48 89 df e8 85 33 63 fd 48 8b 1b 89 de 83 e6
RSP: 0018:ffffc90000007ce0 EFLAGS: 00010202
RAX: 0000000000000008 RBX: 0000000000000040 RCX: ffffffff84452b05
RDX: 0000000000000000 RSI: 0000000000000282 RDI: 0000000000000040
RBP: ffffc90000007d70 R08: dffffc0000000000 R09: 0000000000000003
R10: fffff52000000f8c R11: dffffc0000000001 R12: 00000000fffffa00
R13: ffff88810dcbc458 R14: dffffc0000000000 R15: ffff8881249e8750
FS:  00007fb9798656c0(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000900 CR3: 000000010fb6c000 CR4: 00000000003506b0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <IRQ>
 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:1106
 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:635
RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:161 [inline]
RIP: 0010:_raw_spin_unlock_irqrestore+0x51/0x80 kernel/locking/spinlock.c:191
Code: 74 0c 48 c7 c7 30 79 6c 86 e8 7b ee f4 fc 48 83 3d 03 09 b9 01 00 74 37 48 89 df e8 1d 46 9d fc 66 90 4c 89 75 e8 ff 75 e8 9d <bf> 01 00 00 00 e8 35 b5 95 fc 65 8b 05 3a fd 4e 7b 85 c0 74 09 48
RSP: 0018:ffffc90000f0f618 EFLAGS: 00000246
RAX: 0000000000000001 RBX: ffff888114076c00 RCX: dffffc0000000000
RDX: dffffc0000000000 RSI: 0000000000000246 RDI: ffff888114076c00
RBP: ffffc90000f0f630 R08: dffffc0000000000 R09: ffffed1021f5d9e1
R10: 0000000000000000 R11: dffffc0000000001 R12: 0000000000000246
R13: 1ffff920001e1ed0 R14: 0000000000000246 R15: 0000000000000001
 spin_unlock_irqrestore include/linux/spinlock.h:409 [inline]
 __wake_up_common_lock kernel/sched/wait.c:126 [inline]
 __wake_up_sync_key+0x1b1/0x3d0 kernel/sched/wait.c:194
 unix_dgram_recvmsg+0x5f0/0x1240 net/unix/af_unix.c:2180
 ____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:0x7fb97b21c169
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:00007fb979865038 EFLAGS: 00000246 ORIG_RAX: 000000000000012b
RAX: ffffffffffffffda RBX: 00007fb97b435080 RCX: 00007fb97b21c169
RDX: 000000000400034f RSI: 0000400000000480 RDI: 0000000000000008
RBP: 00007fb97b29d2a0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000002 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000001 R14: 00007fb97b435080 R15: 00007ffc5c54bb18
Modules linked in:
---[ end trace 76e655d175f49466 ]---
RIP: 0010:constant_test_bit arch/x86/include/asm/bitops.h:207 [inline]
RIP: 0010:test_bit include/asm-generic/bitops/instrumented-non-atomic.h:135 [inline]
RIP: 0010:netif_running include/linux/netdevice.h:3645 [inline]
RIP: 0010:br_multicast_port_group_expired+0xac/0x870 net/bridge/br_multicast.c:645
Code: 00 74 08 48 89 df e8 b3 33 63 fd 48 89 5d c0 48 8b 1b 48 83 c3 40 48 89 df be 08 00 00 00 e8 7b 35 63 fd 48 89 d8 48 c1 e8 03 <42> 80 3c 30 00 74 08 48 89 df e8 85 33 63 fd 48 8b 1b 89 de 83 e6
RSP: 0018:ffffc90000007ce0 EFLAGS: 00010202
RAX: 0000000000000008 RBX: 0000000000000040 RCX: ffffffff84452b05
RDX: 0000000000000000 RSI: 0000000000000282 RDI: 0000000000000040
RBP: ffffc90000007d70 R08: dffffc0000000000 R09: 0000000000000003
R10: fffff52000000f8c R11: dffffc0000000001 R12: 00000000fffffa00
R13: ffff88810dcbc458 R14: dffffc0000000000 R15: ffff8881249e8750
FS:  00007fb9798656c0(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000900 CR3: 000000010fb6c000 CR4: 00000000003506b0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	74 0c                	je     0xe
   2:	48 c7 c7 30 79 6c 86 	mov    $0xffffffff866c7930,%rdi
   9:	e8 7b ee f4 fc       	call   0xfcf4ee89
   e:	48 83 3d 03 09 b9 01 	cmpq   $0x0,0x1b90903(%rip)        # 0x1b90919
  15:	00
  16:	74 37                	je     0x4f
  18:	48 89 df             	mov    %rbx,%rdi
  1b:	e8 1d 46 9d fc       	call   0xfc9d463d
  20:	66 90                	xchg   %ax,%ax
  22:	4c 89 75 e8          	mov    %r14,-0x18(%rbp)
  26:	ff 75 e8             	push   -0x18(%rbp)
  29:	9d                   	popf
* 2a:	bf 01 00 00 00       	mov    $0x1,%edi <-- trapping instruction
  2f:	e8 35 b5 95 fc       	call   0xfc95b569
  34:	65 8b 05 3a fd 4e 7b 	mov    %gs:0x7b4efd3a(%rip),%eax        # 0x7b4efd75
  3b:	85 c0                	test   %eax,%eax
  3d:	74 09                	je     0x48
  3f:	48                   	rex.W

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/02/23 05:27 android13-5.10-lts 3f5f2283d684 d34966d1 .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.