syzbot


KASAN: use-after-free Read in fib_flush

Status: premoderation: reported on 2025/08/20 05:00
Reported-by: syzbot+810a7d583b339ed3a59c@syzkaller.appspotmail.com
First crash: 9d02h, last: 9d02h
Similar bugs (1)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-10 KASAN: use-after-free Read in fib_flush 19 5 37d 82d 0/2 premoderation: reported on 2025/06/08 04:46

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in fib_flush+0x77/0x120 net/ipv4/fib_frontend.c:194
Read of size 8 at addr ffff88811b93d000 by task kworker/u4:79/15690

CPU: 1 PID: 15690 Comm: kworker/u4:79 Not tainted 6.1.145-syzkaller-00015-g87b9d836c3d8 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
Workqueue: netns cleanup_net
Call Trace:
 <TASK>
 __dump_stack+0x21/0x24 lib/dump_stack.c:88
 dump_stack_lvl+0xee/0x150 lib/dump_stack.c:106
 print_address_description+0x71/0x210 mm/kasan/report.c:316
 print_report+0x4a/0x60 mm/kasan/report.c:427
 kasan_report+0x122/0x150 mm/kasan/report.c:531
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:351
 fib_flush+0x77/0x120 net/ipv4/fib_frontend.c:194
 __remove_nexthop_fib+0xab/0x270 net/ipv4/nexthop.c:1855
 __remove_nexthop net/ipv4/nexthop.c:1869 [inline]
 remove_nexthop+0x73/0x500 net/ipv4/nexthop.c:1895
 remove_nh_grp_entry net/ipv4/nexthop.c:1751 [inline]
 remove_nexthop_from_groups+0x22f/0x1210 net/ipv4/nexthop.c:1816
 __remove_nexthop net/ipv4/nexthop.c:1880 [inline]
 remove_nexthop+0x3b6/0x500 net/ipv4/nexthop.c:1895
 flush_all_nexthops net/ipv4/nexthop.c:2404 [inline]
 nexthop_net_exit_batch+0x76/0x110 net/ipv4/nexthop.c:3730
 ops_exit_list net/core/net_namespace.c:177 [inline]
 cleanup_net+0x62d/0xb00 net/core/net_namespace.c:604
 process_one_work+0x71f/0xc40 kernel/workqueue.c:2302
 worker_thread+0xa29/0x11f0 kernel/workqueue.c:2449
 kthread+0x281/0x320 kernel/kthread.c:386
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
 </TASK>

Allocated by task 3616:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 kasan_save_alloc_info+0x25/0x30 mm/kasan/generic.c:505
 ____kasan_kmalloc mm/kasan/common.c:379 [inline]
 __kasan_kmalloc+0x95/0xb0 mm/kasan/common.c:388
 kasan_kmalloc include/linux/kasan.h:212 [inline]
 kmalloc_trace+0x40/0xb0 mm/slab_common.c:1033
 kmalloc include/linux/slab.h:563 [inline]
 kzalloc include/linux/slab.h:699 [inline]
 ip_fib_net_init net/ipv4/fib_frontend.c:1562 [inline]
 fib_net_init+0xe0/0x2d0 net/ipv4/fib_frontend.c:1621
 ops_init+0x1c8/0x4a0 net/core/net_namespace.c:138
 setup_net+0x4ab/0xcb0 net/core/net_namespace.c:335
 copy_net_ns+0x355/0x5c0 net/core/net_namespace.c:481
 create_new_namespaces+0x3a2/0x660 kernel/nsproxy.c:110
 unshare_nsproxy_namespaces+0x120/0x170 kernel/nsproxy.c:226
 ksys_unshare+0x4ac/0x7b0 kernel/fork.c:3388
 __do_sys_unshare kernel/fork.c:3459 [inline]
 __se_sys_unshare kernel/fork.c:3457 [inline]
 __x64_sys_unshare+0x38/0x40 kernel/fork.c:3457
 x64_sys_call+0x767/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:273
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Freed by task 15690:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 kasan_save_free_info+0x31/0x50 mm/kasan/generic.c:516
 ____kasan_slab_free+0x132/0x180 mm/kasan/common.c:241
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:249
 kasan_slab_free include/linux/kasan.h:178 [inline]
 slab_free_hook mm/slub.c:1745 [inline]
 slab_free_freelist_hook+0xc2/0x190 mm/slub.c:1771
 slab_free mm/slub.c:3686 [inline]
 __kmem_cache_free+0xb7/0x1b0 mm/slub.c:3702
 kfree+0x6f/0xf0 mm/slab_common.c:990
 ip_fib_net_exit+0x353/0x3a0 net/ipv4/fib_frontend.c:1610
 fib_net_exit_batch+0x47/0x90 net/ipv4/fib_frontend.c:1654
 ops_exit_list net/core/net_namespace.c:177 [inline]
 cleanup_net+0x62d/0xb00 net/core/net_namespace.c:604
 process_one_work+0x71f/0xc40 kernel/workqueue.c:2302
 worker_thread+0xa29/0x11f0 kernel/workqueue.c:2449
 kthread+0x281/0x320 kernel/kthread.c:386
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Last potentially related work creation:
 kasan_save_stack+0x3a/0x60 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xb6/0xc0 mm/kasan/generic.c:486
 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:496
 __call_rcu_common kernel/rcu/tree.c:2807 [inline]
 call_rcu+0xd4/0xf90 kernel/rcu/tree.c:2926
 netlink_release+0x12ef/0x16c0 net/netlink/af_netlink.c:801
 __sock_release net/socket.c:652 [inline]
 sock_close+0xf1/0x290 net/socket.c:1390
 __fput+0x1fc/0x8f0 fs/file_table.c:320
 ____fput+0x15/0x20 fs/file_table.c:348
 task_work_run+0x1db/0x240 kernel/task_work.c:203
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 exit_to_user_mode_loop+0x9b/0xb0 kernel/entry/common.c:177
 exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:210
 __syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline]
 syscall_exit_to_user_mode+0x1a/0x30 kernel/entry/common.c:303
 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:87
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

The buggy address belongs to the object at ffff88811b93d000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 0 bytes inside of
 2048-byte region [ffff88811b93d000, ffff88811b93d800)

The buggy address belongs to the physical page:
page:ffffea00046e4e00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88811b93e000 pfn:0x11b938
head:ffffea00046e4e00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head|zone=1)
raw: 4000000000010200 ffffea00045e4008 ffffea0004c4ee08 ffff888100043200
raw: ffff88811b93e000 0000000000080007 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 282, tgid 282 (syz-executor), ts 149451975003, free_ts 149448754110
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x1f5/0x210 mm/page_alloc.c:2637
 prep_new_page+0x1c/0x110 mm/page_alloc.c:2644
 get_page_from_freelist+0x2c7b/0x2cf0 mm/page_alloc.c:4544
 __alloc_pages+0x1c3/0x450 mm/page_alloc.c:5858
 alloc_slab_page+0x6e/0xf0 include/linux/gfp.h:-1
 allocate_slab mm/slub.c:1962 [inline]
 new_slab+0x98/0x3d0 mm/slub.c:2015
 ___slab_alloc+0x6f6/0xb50 mm/slub.c:3203
 __slab_alloc+0x5e/0xa0 mm/slub.c:3302
 slab_alloc_node mm/slub.c:3387 [inline]
 __kmem_cache_alloc_node+0x203/0x2c0 mm/slub.c:3462
 __do_kmalloc_node mm/slab_common.c:937 [inline]
 __kmalloc_node+0xa1/0x1e0 mm/slab_common.c:945
 kmalloc_node include/linux/slab.h:589 [inline]
 kvmalloc_node+0x294/0x480 mm/util.c:592
 kvmalloc include/linux/slab.h:716 [inline]
 kvmalloc_array include/linux/slab.h:734 [inline]
 alloc_fdtable+0xf2/0x2b0 fs/file.c:132
 dup_fd+0x668/0x8f0 fs/file.c:336
 copy_files+0x76/0xe0 kernel/fork.c:1739
 copy_process+0x11ff/0x3420 kernel/fork.c:2444
 kernel_clone+0x23a/0x810 kernel/fork.c:2863
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:26 [inline]
 free_pages_prepare mm/page_alloc.c:1545 [inline]
 free_pcp_prepare mm/page_alloc.c:1619 [inline]
 free_unref_page_prepare+0x742/0x750 mm/page_alloc.c:3581
 free_unref_page+0x8f/0x530 mm/page_alloc.c:3677
 free_the_page+0x13/0x20 mm/page_alloc.c:830
 page_frag_free+0x10a/0x120 mm/page_alloc.c:6086
 skb_free_frag include/linux/skbuff.h:3260 [inline]
 skb_free_head net/core/skbuff.c:763 [inline]
 skb_release_data+0x70f/0x890 net/core/skbuff.c:794
 skb_release_all net/core/skbuff.c:859 [inline]
 __kfree_skb net/core/skbuff.c:873 [inline]
 skb_attempt_defer_free+0x10e/0x410 net/core/skbuff.c:6679
 tcp_eat_recv_skb net/ipv4/tcp.c:1643 [inline]
 tcp_recvmsg_locked+0x126f/0x23b0 net/ipv4/tcp.c:2652
 tcp_recvmsg+0x20e/0x810 net/ipv4/tcp.c:2698
 inet_recvmsg+0x13b/0x470 net/ipv4/af_inet.c:875
 sock_recvmsg_nosec net/socket.c:1020 [inline]
 sock_recvmsg net/socket.c:1038 [inline]
 sock_read_iter+0x2d3/0x380 net/socket.c:1111
 call_read_iter include/linux/fs.h:2276 [inline]
 new_sync_read fs/read_write.c:389 [inline]
 vfs_read+0x41e/0x8c0 fs/read_write.c:470
 ksys_read+0x140/0x240 fs/read_write.c:613
 __do_sys_read fs/read_write.c:623 [inline]
 __se_sys_read fs/read_write.c:621 [inline]
 __x64_sys_read+0x7b/0x90 fs/read_write.c:621
 x64_sys_call+0x2f/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:1
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Memory state around the buggy address:
 ffff88811b93cf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88811b93cf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88811b93d000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff88811b93d080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88811b93d100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
general protection fault, probably for non-canonical address 0xfd90650a6a882aa8: 0000 [#1] PREEMPT SMP KASAN
KASAN: maybe wild-memory-access in range [0xec83485354415540-0xec83485354415547]
CPU: 0 PID: 15690 Comm: kworker/u4:79 Tainted: G    B              6.1.145-syzkaller-00015-g87b9d836c3d8 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
Workqueue: netns cleanup_net
RIP: 0010:fib_table_flush+0x40c/0x14c0 net/ipv4/fib_trie.c:2043
Code: ef fe ff ff 44 89 f1 80 e1 07 38 c1 0f 8c 00 ff ff ff 4c 89 f7 e8 c4 ea 7b fd e9 f3 fe ff ff 49 8d 5d 05 48 89 d8 48 c1 e8 03 <42> 0f b6 04 20 84 c0 0f 85 ec 0d 00 00 0f b6 1b 31 ff 89 de e8 1b
RSP: 0018:ffffc90005457740 EFLAGS: 00010a03
RAX: 1d90690a6a882aa8 RBX: ec83485354415546 RCX: ffff88811c622880
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000
RBP: ffffc900054578b8 R08: dffffc0000000000 R09: fffffbfff0f2d4fd
R10: fffffbfff0f2d4fd R11: 1ffffffff0f2d4fc R12: dffffc0000000000
R13: ec83485354415541 R14: ffffffff84337db0 R15: 0000000000000001
FS:  0000000000000000(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055b826ba6000 CR3: 0000000116880000 CR4: 00000000003506b0
Call Trace:
 <TASK>
 fib_flush+0xb5/0x120 net/ipv4/fib_frontend.c:195
 __remove_nexthop_fib+0xab/0x270 net/ipv4/nexthop.c:1855
 __remove_nexthop net/ipv4/nexthop.c:1869 [inline]
 remove_nexthop+0x73/0x500 net/ipv4/nexthop.c:1895
 remove_nh_grp_entry net/ipv4/nexthop.c:1751 [inline]
 remove_nexthop_from_groups+0x22f/0x1210 net/ipv4/nexthop.c:1816
 __remove_nexthop net/ipv4/nexthop.c:1880 [inline]
 remove_nexthop+0x3b6/0x500 net/ipv4/nexthop.c:1895
 flush_all_nexthops net/ipv4/nexthop.c:2404 [inline]
 nexthop_net_exit_batch+0x76/0x110 net/ipv4/nexthop.c:3730
 ops_exit_list net/core/net_namespace.c:177 [inline]
 cleanup_net+0x62d/0xb00 net/core/net_namespace.c:604
 process_one_work+0x71f/0xc40 kernel/workqueue.c:2302
 worker_thread+0xa29/0x11f0 kernel/workqueue.c:2449
 kthread+0x281/0x320 kernel/kthread.c:386
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:fib_table_flush+0x40c/0x14c0 net/ipv4/fib_trie.c:2043
Code: ef fe ff ff 44 89 f1 80 e1 07 38 c1 0f 8c 00 ff ff ff 4c 89 f7 e8 c4 ea 7b fd e9 f3 fe ff ff 49 8d 5d 05 48 89 d8 48 c1 e8 03 <42> 0f b6 04 20 84 c0 0f 85 ec 0d 00 00 0f b6 1b 31 ff 89 de e8 1b
RSP: 0018:ffffc90005457740 EFLAGS: 00010a03
RAX: 1d90690a6a882aa8 RBX: ec83485354415546 RCX: ffff88811c622880
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000
RBP: ffffc900054578b8 R08: dffffc0000000000 R09: fffffbfff0f2d4fd
R10: fffffbfff0f2d4fd R11: 1ffffffff0f2d4fc R12: dffffc0000000000
R13: ec83485354415541 R14: ffffffff84337db0 R15: 0000000000000001
FS:  0000000000000000(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f9cae7e7000 CR3: 0000000116880000 CR4: 00000000003506b0
----------------
Code disassembly (best guess), 3 bytes skipped:
   0:	ff 44 89 f1          	incl   -0xf(%rcx,%rcx,4)
   4:	80 e1 07             	and    $0x7,%cl
   7:	38 c1                	cmp    %al,%cl
   9:	0f 8c 00 ff ff ff    	jl     0xffffff0f
   f:	4c 89 f7             	mov    %r14,%rdi
  12:	e8 c4 ea 7b fd       	call   0xfd7beadb
  17:	e9 f3 fe ff ff       	jmp    0xffffff0f
  1c:	49 8d 5d 05          	lea    0x5(%r13),%rbx
  20:	48 89 d8             	mov    %rbx,%rax
  23:	48 c1 e8 03          	shr    $0x3,%rax
* 27:	42 0f b6 04 20       	movzbl (%rax,%r12,1),%eax <-- trapping instruction
  2c:	84 c0                	test   %al,%al
  2e:	0f 85 ec 0d 00 00    	jne    0xe20
  34:	0f b6 1b             	movzbl (%rbx),%ebx
  37:	31 ff                	xor    %edi,%edi
  39:	89 de                	mov    %ebx,%esi
  3b:	e8                   	.byte 0xe8
  3c:	1b                   	.byte 0x1b

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/08/20 04:59 android14-6.1 87b9d836c3d8 79512909 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-6-1 KASAN: use-after-free Read in fib_flush
* Struck through repros no longer work on HEAD.