syzbot


KASAN: use-after-free Read in fib_flush

Status: premoderation: reported on 2025/06/08 04:46
Reported-by: syzbot+471e037cf6e8587a411a@syzkaller.appspotmail.com
First crash: 11d, last: 11d

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

CPU: 1 PID: 302 Comm: kworker/u4:3 Tainted: G        W         5.10.238-syzkaller-00282-gd76d4cd0623a #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Workqueue: netns cleanup_net
Call Trace:
 __dump_stack+0x21/0x24 lib/dump_stack.c:77
 dump_stack_lvl+0x169/0x1d8 lib/dump_stack.c:118
 print_address_description+0x7f/0x2c0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:435 [inline]
 kasan_report+0xe2/0x130 mm/kasan/report.c:452
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:309
 fib_flush+0x77/0x120 net/ipv4/fib_frontend.c:193
 __remove_nexthop_fib+0xab/0x260 net/ipv4/nexthop.c:879
 __remove_nexthop net/ipv4/nexthop.c:893 [inline]
 remove_nexthop+0x75/0x4d0 net/ipv4/nexthop.c:919
 remove_nh_grp_entry net/ipv4/nexthop.c:797 [inline]
 remove_nexthop_from_groups+0x193/0xe40 net/ipv4/nexthop.c:846
 __remove_nexthop net/ipv4/nexthop.c:904 [inline]
 remove_nexthop+0x38a/0x4d0 net/ipv4/nexthop.c:919
 flush_all_nexthops net/ipv4/nexthop.c:1237 [inline]
 nexthop_net_exit+0x3a/0xa0 net/ipv4/nexthop.c:2012
 ops_exit_list net/core/net_namespace.c:185 [inline]
 cleanup_net+0x586/0xb70 net/core/net_namespace.c:609
 process_one_work+0x6e1/0xba0 kernel/workqueue.c:2301
 worker_thread+0xa6a/0x13b0 kernel/workqueue.c:2447
 kthread+0x346/0x3d0 kernel/kthread.c:313
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

Allocated by task 25963:
 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 mm/kasan/common.c:509 [inline]
 __kasan_kmalloc+0xda/0x110 mm/kasan/common.c:518
 kasan_kmalloc include/linux/kasan.h:254 [inline]
 kmem_cache_alloc_trace+0x184/0x2e0 mm/slub.c:2974
 kmalloc include/linux/slab.h:552 [inline]
 kzalloc include/linux/slab.h:664 [inline]
 ip_fib_net_init net/ipv4/fib_frontend.c:1547 [inline]
 fib_net_init+0xe0/0x2c0 net/ipv4/fib_frontend.c:1606
 ops_init+0x1ba/0x4a0 net/core/net_namespace.c:144
 setup_net+0x36d/0xb50 net/core/net_namespace.c:345
 copy_net_ns+0x314/0x520 net/core/net_namespace.c:486
 create_new_namespaces+0x3a2/0x650 kernel/nsproxy.c:110
 unshare_nsproxy_namespaces+0x120/0x170 kernel/nsproxy.c:231
 ksys_unshare+0x4ac/0x7d0 kernel/fork.c:3156
 __do_sys_unshare kernel/fork.c:3224 [inline]
 __se_sys_unshare kernel/fork.c:3222 [inline]
 __x64_sys_unshare+0x38/0x40 kernel/fork.c:3222
 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Freed by task 302:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4a/0x70 mm/kasan/common.c:45
 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370
 ____kasan_slab_free+0x125/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+0xc5/0x190 mm/slub.c:1621
 slab_free mm/slub.c:3203 [inline]
 kfree+0xc0/0x270 mm/slub.c:4191
 ip_fib_net_exit+0x32f/0x350 net/ipv4/fib_frontend.c:1595
 fib_net_exit+0x6c/0x80 net/ipv4/fib_frontend.c:1629
 ops_exit_list net/core/net_namespace.c:185 [inline]
 cleanup_net+0x586/0xb70 net/core/net_namespace.c:609
 process_one_work+0x6e1/0xba0 kernel/workqueue.c:2301
 worker_thread+0xa6a/0x13b0 kernel/workqueue.c:2447
 kthread+0x346/0x3d0 kernel/kthread.c:313
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

Last potentially related work creation:
 kasan_save_stack+0x3a/0x60 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xd2/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+0x105/0x1040 kernel/rcu/tree.c:3050
 netlink_release+0x1288/0x1690 net/netlink/af_netlink.c:796
 __sock_release net/socket.c:597 [inline]
 sock_close+0xe0/0x270 net/socket.c:1286
 __fput+0x2fb/0x770 fs/file_table.c:281
 ____fput+0x15/0x20 fs/file_table.c:314
 task_work_run+0x127/0x190 kernel/task_work.c:189
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_user_mode_loop+0xcb/0xe0 kernel/entry/common.c:172
 exit_to_user_mode_prepare kernel/entry/common.c:199 [inline]
 syscall_exit_to_user_mode+0x68/0x90 kernel/entry/common.c:274
 do_syscall_64+0x3d/0x40 arch/x86/entry/common.c:56
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Second to last potentially related work creation:
 kasan_save_stack+0x3a/0x60 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xd2/0x100 mm/kasan/generic.c:348
 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358
 insert_work+0x52/0x310 kernel/workqueue.c:1352
 __queue_work+0x923/0xca0 kernel/workqueue.c:1518
 __queue_delayed_work+0x188/0x200 kernel/workqueue.c:1672
 mod_delayed_work_on+0x7b/0xd0 kernel/workqueue.c:1746
 mod_delayed_work include/linux/workqueue.h:545 [inline]
 wb_shutdown+0x164/0x1b0 mm/backing-dev.c:351
 bdi_unregister+0x15e/0x4f0 mm/backing-dev.c:880
 del_gendisk+0x479/0x9e0 block/genhd.c:929
 loop_remove+0x46/0xb0 drivers/block/loop.c:2210
 loop_control_ioctl+0x487/0x550 drivers/block/loop.c:2309
 vfs_ioctl fs/ioctl.c:48 [inline]
 __do_sys_ioctl fs/ioctl.c:753 [inline]
 __se_sys_ioctl+0x121/0x1a0 fs/ioctl.c:739
 __x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:739
 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

The buggy address belongs to the object at ffff888150088000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 0 bytes inside of
 2048-byte region [ffff888150088000, ffff888150088800)
The buggy address belongs to the page:
page:ffffea0005402200 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x150088
head:ffffea0005402200 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head)
raw: 4000000000010200 dead000000000100 dead000000000122 ffff888100042d80
raw: 0000000000000000 0000000000080008 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 12488, ts 516366691264, free_ts 508351038269
 set_page_owner include/linux/page_owner.h:35 [inline]
 post_alloc_hook mm/page_alloc.c:2456 [inline]
 prep_new_page+0x179/0x180 mm/page_alloc.c:2462
 get_page_from_freelist+0x2235/0x23d0 mm/page_alloc.c:4254
 __alloc_pages_nodemask+0x268/0x5f0 mm/page_alloc.c:5357
 alloc_slab_page mm/slub.c:-1 [inline]
 allocate_slab mm/slub.c:1808 [inline]
 new_slab+0x84/0x3f0 mm/slub.c:1869
 new_slab_objects mm/slub.c:2627 [inline]
 ___slab_alloc+0x2a6/0x450 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+0x1ef/0x320 mm/slub.c:4536
 __kmalloc_reserve net/core/skbuff.c:144 [inline]
 __alloc_skb+0xdc/0x520 net/core/skbuff.c:212
 alloc_skb include/linux/skbuff.h:1126 [inline]
 nlmsg_new include/net/netlink.h:953 [inline]
 audit_buffer_alloc kernel/audit.c:1799 [inline]
 audit_log_start+0x3df/0x860 kernel/audit.c:1917
 audit_seccomp+0x62/0x160 kernel/auditsc.c:2675
 seccomp_log kernel/seccomp.c:1004 [inline]
 __seccomp_filter+0xb4c/0x1990 kernel/seccomp.c:1247
 __secure_computing+0xea/0x290 kernel/seccomp.c:1313
 syscall_trace_enter+0xb5/0x170 kernel/entry/common.c:58
 __syscall_enter_from_user_work kernel/entry/common.c:81 [inline]
 syscall_enter_from_user_mode+0x20/0x30 kernel/entry/common.c:99
 do_syscall_64+0x13/0x40 arch/x86/entry/common.c:41
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:28 [inline]
 free_pages_prepare mm/page_alloc.c:1349 [inline]
 __free_pages_ok+0x7fc/0x820 mm/page_alloc.c:1629
 free_the_page mm/page_alloc.c:5418 [inline]
 __free_pages+0xdd/0x380 mm/page_alloc.c:5427
 __free_slab+0xcf/0x190 mm/slub.c:1894
 free_slab mm/slub.c:1909 [inline]
 discard_slab mm/slub.c:1915 [inline]
 unfreeze_partials+0x15f/0x190 mm/slub.c:2410
 put_cpu_partial+0xc1/0x180 mm/slub.c:2446
 __slab_free+0x2c9/0x3a0 mm/slub.c:3095
 do_slab_free mm/slub.c:3191 [inline]
 ___cache_free+0x111/0x130 mm/slub.c:3210
 qlink_free+0x50/0x90 mm/kasan/quarantine.c:157
 qlist_free_all+0x5f/0xb0 mm/kasan/quarantine.c:176
 kasan_quarantine_reduce+0x14a/0x160 mm/kasan/quarantine.c:283
 __kasan_slab_alloc+0x2f/0xf0 mm/kasan/common.c:440
 kasan_slab_alloc include/linux/kasan.h:244 [inline]
 slab_post_alloc_hook+0x5d/0x2f0 mm/slab.h:583
 slab_alloc_node mm/slub.c:2947 [inline]
 slab_alloc mm/slub.c:2955 [inline]
 kmem_cache_alloc+0x165/0x2e0 mm/slub.c:2960
 getname_flags+0xb9/0x500 fs/namei.c:141
 getname+0x19/0x20 fs/namei.c:212
 do_sys_openat2+0xd9/0x6d0 fs/open.c:1211

Memory state around the buggy address:
 ffff888150087f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888150087f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888150088000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff888150088080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888150088100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
general protection fault, probably for non-canonical address 0xfef7fc2840000025: 0000 [#1] PREEMPT SMP KASAN
KASAN: maybe wild-memory-access in range [0xf7c0014200000128-0xf7c001420000012f]
CPU: 0 PID: 302 Comm: kworker/u4:3 Tainted: G    B   W         5.10.238-syzkaller-00282-gd76d4cd0623a #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Workqueue: netns cleanup_net
RIP: 0010:fib_flush+0x96/0x120 net/ipv4/fib_frontend.c:193
Code: 00 74 08 4c 89 e7 e8 99 1c c4 fd 4d 8b 3c 24 4d 85 ff 75 0f e8 2b 2c 8a fd eb 3b e8 24 2c 8a fd 4d 89 e7 4c 89 f8 48 c1 e8 03 <42> 80 3c 28 00 74 08 4c 89 ff e8 6b 1c c4 fd 4d 8b 27 48 89 df 4c
RSP: 0018:ffffc900079e79d0 EFLAGS: 00010a03
RAX: 1ef8002840000025 RBX: ffff888110812680 RCX: 0000000000000286
RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffff888150088008
RBP: ffffc900079e7a10 R08: 0000000000000004 R09: 0000000000000003
R10: fffffbfff0d8e448 R11: 1ffffffff0d8e448 R12: ffff888150088008
R13: dffffc0000000000 R14: 0000000000000000 R15: f7c001420000012e
FS:  0000000000000000(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f62838acf98 CR3: 0000000123feb000 CR4: 00000000003506b0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 __remove_nexthop_fib+0xab/0x260 net/ipv4/nexthop.c:879
 __remove_nexthop net/ipv4/nexthop.c:893 [inline]
 remove_nexthop+0x75/0x4d0 net/ipv4/nexthop.c:919
 remove_nh_grp_entry net/ipv4/nexthop.c:797 [inline]
 remove_nexthop_from_groups+0x193/0xe40 net/ipv4/nexthop.c:846
 __remove_nexthop net/ipv4/nexthop.c:904 [inline]
 remove_nexthop+0x38a/0x4d0 net/ipv4/nexthop.c:919
 flush_all_nexthops net/ipv4/nexthop.c:1237 [inline]
 nexthop_net_exit+0x3a/0xa0 net/ipv4/nexthop.c:2012
 ops_exit_list net/core/net_namespace.c:185 [inline]
 cleanup_net+0x586/0xb70 net/core/net_namespace.c:609
 process_one_work+0x6e1/0xba0 kernel/workqueue.c:2301
 worker_thread+0xa6a/0x13b0 kernel/workqueue.c:2447
 kthread+0x346/0x3d0 kernel/kthread.c:313
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298
Modules linked in:
---[ end trace 90baa47f4bc1d019 ]---
RIP: 0010:fib_flush+0x96/0x120 net/ipv4/fib_frontend.c:193
Code: 00 74 08 4c 89 e7 e8 99 1c c4 fd 4d 8b 3c 24 4d 85 ff 75 0f e8 2b 2c 8a fd eb 3b e8 24 2c 8a fd 4d 89 e7 4c 89 f8 48 c1 e8 03 <42> 80 3c 28 00 74 08 4c 89 ff e8 6b 1c c4 fd 4d 8b 27 48 89 df 4c
RSP: 0018:ffffc900079e79d0 EFLAGS: 00010a03
RAX: 1ef8002840000025 RBX: ffff888110812680 RCX: 0000000000000286
RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffff888150088008
RBP: ffffc900079e7a10 R08: 0000000000000004 R09: 0000000000000003
R10: fffffbfff0d8e448 R11: 1ffffffff0d8e448 R12: ffff888150088008
R13: dffffc0000000000 R14: 0000000000000000 R15: f7c001420000012e
FS:  0000000000000000(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f62838acf98 CR3: 000000012a16e000 CR4: 00000000003506b0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	00 74 08 4c          	add    %dh,0x4c(%rax,%rcx,1)
   4:	89 e7                	mov    %esp,%edi
   6:	e8 99 1c c4 fd       	call   0xfdc41ca4
   b:	4d 8b 3c 24          	mov    (%r12),%r15
   f:	4d 85 ff             	test   %r15,%r15
  12:	75 0f                	jne    0x23
  14:	e8 2b 2c 8a fd       	call   0xfd8a2c44
  19:	eb 3b                	jmp    0x56
  1b:	e8 24 2c 8a fd       	call   0xfd8a2c44
  20:	4d 89 e7             	mov    %r12,%r15
  23:	4c 89 f8             	mov    %r15,%rax
  26:	48 c1 e8 03          	shr    $0x3,%rax
* 2a:	42 80 3c 28 00       	cmpb   $0x0,(%rax,%r13,1) <-- trapping instruction
  2f:	74 08                	je     0x39
  31:	4c 89 ff             	mov    %r15,%rdi
  34:	e8 6b 1c c4 fd       	call   0xfdc41ca4
  39:	4d 8b 27             	mov    (%r15),%r12
  3c:	48 89 df             	mov    %rbx,%rdi
  3f:	4c                   	rex.WR

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/06/08 04:45 android13-5.10-lts d76d4cd0623a 4826c28e .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Read in fib_flush
* Struck through repros no longer work on HEAD.