syzbot


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

Status: upstream: reported on 2025/04/23 07:33
Reported-by: syzbot+[email protected]
First crash: 44d, last: 44d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 KASAN: use-after-free Read in devlink_notify 11 400d 488d 0/3 auto-obsoleted due to no activity on 2024/08/10 04:33

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in genlmsg_multicast_netns include/net/genetlink.h:314 [inline]
BUG: KASAN: use-after-free in devlink_notify+0xf0/0x150 net/core/devlink.c:756
Read of size 8 at addr ffff8880746081d8 by task syz-executor/6346

CPU: 0 PID: 6346 Comm: syz-executor Not tainted 5.15.180-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106
 print_address_description+0x63/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
 genlmsg_multicast_netns include/net/genetlink.h:314 [inline]
 devlink_notify+0xf0/0x150 net/core/devlink.c:756
 devlink_unregister+0x13e/0x1d0 net/core/devlink.c:8987
 nsim_dev_remove+0xdf/0x100 drivers/net/netdevsim/dev.c:1583
 __device_release_driver drivers/base/dd.c:1227 [inline]
 device_release_driver_internal+0x4cb/0x7f0 drivers/base/dd.c:1262
 bus_remove_device+0x2e5/0x400 drivers/base/bus.c:531
 device_del+0x6e2/0xbd0 drivers/base/core.c:3600
 device_unregister+0x1c/0xc0 drivers/base/core.c:3633
 nsim_bus_dev_del drivers/net/netdevsim/bus.c:454 [inline]
 del_device_store+0x321/0x470 drivers/net/netdevsim/bus.c:354
 kernfs_fop_write_iter+0x3a2/0x4f0 fs/kernfs/file.c:296
 call_write_iter include/linux/fs.h:2172 [inline]
 new_sync_write fs/read_write.c:507 [inline]
 vfs_write+0xacd/0xe50 fs/read_write.c:594
 ksys_write+0x1a2/0x2c0 fs/read_write.c:647
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0x80 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f00c3b0fc1f
Code: 89 54 24 18 48 89 74 24 10 89 7c 24 08 e8 f9 92 02 00 48 8b 54 24 18 48 8b 74 24 10 41 89 c0 8b 7c 24 08 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 31 44 89 c7 48 89 44 24 08 e8 4c 93 02 00 48
RSP: 002b:00007ffdcaa8b3d0 EFLAGS: 00000293 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 00007f00c3b0fc1f
RDX: 0000000000000001 RSI: 00007ffdcaa8b420 RDI: 0000000000000005
RBP: 00007f00c3b94cc5 R08: 0000000000000000 R09: 00007ffdcaa8b227
R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000001
R13: 00007ffdcaa8b420 R14: 00007f00c4867620 R15: 0000000000000003
 </TASK>

Allocated by task 4167:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 __kasan_slab_alloc+0x8e/0xc0 mm/kasan/common.c:467
 kasan_slab_alloc include/linux/kasan.h:254 [inline]
 slab_post_alloc_hook+0x53/0x380 mm/slab.h:519
 slab_alloc_node mm/slub.c:3220 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc+0xf3/0x280 mm/slub.c:3233
 kmem_cache_zalloc include/linux/slab.h:725 [inline]
 net_alloc net/core/net_namespace.c:418 [inline]
 copy_net_ns+0x140/0x5d0 net/core/net_namespace.c:473
 create_new_namespaces+0x425/0x7a0 kernel/nsproxy.c:110
 unshare_nsproxy_namespaces+0x11e/0x170 kernel/nsproxy.c:226
 ksys_unshare+0x531/0xa40 kernel/fork.c:3099
 __do_sys_unshare kernel/fork.c:3173 [inline]
 __se_sys_unshare kernel/fork.c:3171 [inline]
 __x64_sys_unshare+0x34/0x40 kernel/fork.c:3171
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0x80 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Freed by task 3015:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x80 mm/kasan/common.c:46
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
 ____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:366
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1705 [inline]
 slab_free_freelist_hook+0xdd/0x160 mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kmem_cache_free+0x91/0x1f0 mm/slub.c:3515
 net_free net/core/net_namespace.c:447 [inline]
 cleanup_net+0xbd8/0xc90 net/core/net_namespace.c:639
 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
 kthread+0x3f6/0x4f0 kernel/kthread.c:334
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

The buggy address belongs to the object at ffff888074608000
 which belongs to the cache net_namespace of size 6528
The buggy address is located 472 bytes inside of
 6528-byte region [ffff888074608000, ffff888074609980)
The buggy address belongs to the page:
page:ffffea0001d18200 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88807460b500 pfn:0x74608
head:ffffea0001d18200 order:3 compound_mapcount:0 compound_pincount:0
memcg:ffff888024e7cac1
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 dead000000000122 ffff8880175ea3c0
raw: ffff88807460b500 0000000080040002 00000001ffffffff ffff888024e7cac1
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 4167, ts 83301764456, free_ts 82856989337
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x3b78/0x3d40 mm/page_alloc.c:4192
 __alloc_pages+0x272/0x700 mm/page_alloc.c:5466
 alloc_slab_page mm/slub.c:1775 [inline]
 allocate_slab mm/slub.c:1912 [inline]
 new_slab+0xbb/0x4b0 mm/slub.c:1975
 ___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
 __slab_alloc mm/slub.c:3095 [inline]
 slab_alloc_node mm/slub.c:3186 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc+0x18e/0x280 mm/slub.c:3233
 kmem_cache_zalloc include/linux/slab.h:725 [inline]
 net_alloc net/core/net_namespace.c:418 [inline]
 copy_net_ns+0x140/0x5d0 net/core/net_namespace.c:473
 create_new_namespaces+0x425/0x7a0 kernel/nsproxy.c:110
 unshare_nsproxy_namespaces+0x11e/0x170 kernel/nsproxy.c:226
 ksys_unshare+0x531/0xa40 kernel/fork.c:3099
 __do_sys_unshare kernel/fork.c:3173 [inline]
 __se_sys_unshare kernel/fork.c:3171 [inline]
 __x64_sys_unshare+0x34/0x40 kernel/fork.c:3171
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0x80 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1340 [inline]
 free_pcp_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
 free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
 put_page include/linux/mm.h:1247 [inline]
 __skb_frag_unref include/linux/skbuff.h:3231 [inline]
 skb_release_data+0x411/0x8a0 net/core/skbuff.c:672
 skb_release_all net/core/skbuff.c:742 [inline]
 __kfree_skb+0x4c/0x60 net/core/skbuff.c:756
 sk_eat_skb include/net/sock.h:2732 [inline]
 tcp_recvmsg_locked+0x1629/0x29b0 net/ipv4/tcp.c:2517
 tcp_recvmsg+0x24e/0x7f0 net/ipv4/tcp.c:2563
 inet_recvmsg+0x157/0x280 net/ipv4/af_inet.c:868
 sock_recvmsg_nosec net/socket.c:966 [inline]
 sock_recvmsg net/socket.c:984 [inline]
 sock_read_iter+0x353/0x480 net/socket.c:1057
 call_read_iter include/linux/fs.h:2166 [inline]
 new_sync_read fs/read_write.c:404 [inline]
 vfs_read+0xa93/0xe10 fs/read_write.c:485
 ksys_read+0x1a2/0x2c0 fs/read_write.c:623
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0x80 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Memory state around the buggy address:
 ffff888074608080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888074608100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888074608180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                    ^
 ffff888074608200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888074608280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/04/23 07:33 linux-5.15.y f7347f400572 53a8b9bd .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in devlink_notify
* Struck through repros no longer work on HEAD.
OSZAR »