syzbot


KASAN: slab-out-of-bounds Read in fill_route

Status: closed as invalid on 2024/05/28 18:05
Subsystems: net
[Documentation on labels]
First crash: 271d, last: 271d

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in fill_route+0x5dc/0x650 net/phonet/pn_netlink.c:181
Read of size 4 at addr ffff88807ff63218 by task syz-executor.0/7920

CPU: 1 PID: 7920 Comm: syz-executor.0 Not tainted 6.9.0-rc5-syzkaller-01461-g496bc5861c73 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114
 print_address_description mm/kasan/report.c:377 [inline]
 print_report+0x169/0x550 mm/kasan/report.c:488
 kasan_report+0x143/0x180 mm/kasan/report.c:601
 fill_route+0x5dc/0x650 net/phonet/pn_netlink.c:181
 route_dumpit+0x254/0x410 net/phonet/pn_netlink.c:275
 rtnl_dump_all+0x300/0x520 net/core/rtnetlink.c:4028
 netlink_dump+0x600/0xe50 net/netlink/af_netlink.c:2337
 netlink_recvmsg+0x6bb/0x11d0 net/netlink/af_netlink.c:1987
 sock_recvmsg_nosec+0x18e/0x1d0 net/socket.c:1046
 ____sys_recvmsg+0x3c0/0x470 net/socket.c:2801
 ___sys_recvmsg net/socket.c:2845 [inline]
 do_recvmmsg+0x474/0xae0 net/socket.c:2939
 __sys_recvmmsg net/socket.c:3020 [inline]
 __do_sys_recvmmsg net/socket.c:3041 [inline]
 __se_sys_recvmmsg net/socket.c:3034 [inline]
 __x64_sys_recvmmsg+0x1b8/0x250 net/socket.c:3034
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f1d26c7dea9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f1d27a130c8 EFLAGS: 00000246 ORIG_RAX: 000000000000012b
RAX: ffffffffffffffda RBX: 00007f1d26dabf80 RCX: 00007f1d26c7dea9
RDX: 0400000000000ec0 RSI: 0000000020002ec0 RDI: 0000000000000003
RBP: 00007f1d26cca4a4 R08: 00000000200001c0 R09: 0000000000000000
R10: 0000000000000002 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f1d26dabf80 R15: 00007ffe1190a118
 </TASK>

Allocated by task 7354:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
 poison_kmalloc_redzone mm/kasan/common.c:370 [inline]
 __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:387
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 __do_kmalloc_node mm/slub.c:3966 [inline]
 __kmalloc+0x233/0x4a0 mm/slub.c:3979
 kmalloc include/linux/slab.h:632 [inline]
 kzalloc include/linux/slab.h:749 [inline]
 alloc_workqueue+0x1b0/0x20c0 kernel/workqueue.c:5542
 wg_newlink+0x208/0x640 drivers/net/wireguard/device.c:338
 rtnl_newlink_create net/core/rtnetlink.c:3494 [inline]
 __rtnl_newlink net/core/rtnetlink.c:3714 [inline]
 rtnl_newlink+0x158f/0x20a0 net/core/rtnetlink.c:3727
 rtnetlink_rcv_msg+0x89b/0x10d0 net/core/rtnetlink.c:6594
 netlink_rcv_skb+0x1e3/0x430 net/netlink/af_netlink.c:2564
 netlink_unicast_kernel net/netlink/af_netlink.c:1335 [inline]
 netlink_unicast+0x7ea/0x980 net/netlink/af_netlink.c:1361
 netlink_sendmsg+0x8e1/0xcb0 net/netlink/af_netlink.c:1905
 sock_sendmsg_nosec net/socket.c:730 [inline]
 __sock_sendmsg+0x221/0x270 net/socket.c:745
 __sys_sendto+0x3a4/0x4f0 net/socket.c:2191
 __do_sys_sendto net/socket.c:2203 [inline]
 __se_sys_sendto net/socket.c:2199 [inline]
 __x64_sys_sendto+0xde/0x100 net/socket.c:2199
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff88807ff63000
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 0 bytes to the right of
 allocated 536-byte region [ffff88807ff63000, ffff88807ff63218)

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7ff60
head: order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff80000000840(slab|head|node=0|zone=1|lastcpupid=0xfff)
page_type: 0xffffffff()
raw: 00fff80000000840 ffff888015041dc0 ffffea0001381e00 dead000000000002
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
head: 00fff80000000840 ffff888015041dc0 ffffea0001381e00 dead000000000002
head: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
head: 00fff80000000003 ffffea0001ffd801 dead000000000122 00000000ffffffff
head: 0000000800000000 0000000000000000 00000000ffffffff 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 0xd2820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5106, tgid 1003349914 (syz-executor.0), ts 5106, free_ts 78312055849
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x1ea/0x210 mm/page_alloc.c:1534
 prep_new_page mm/page_alloc.c:1541 [inline]
 get_page_from_freelist+0x3410/0x35b0 mm/page_alloc.c:3317
 __alloc_pages+0x256/0x6c0 mm/page_alloc.c:4575
 __alloc_pages_node include/linux/gfp.h:238 [inline]
 alloc_pages_node include/linux/gfp.h:261 [inline]
 alloc_slab_page+0x5f/0x160 mm/slub.c:2175
 allocate_slab mm/slub.c:2338 [inline]
 new_slab+0x84/0x2f0 mm/slub.c:2391
 ___slab_alloc+0xc73/0x1260 mm/slub.c:3525
 __slab_alloc mm/slub.c:3610 [inline]
 __slab_alloc_node mm/slub.c:3663 [inline]
 slab_alloc_node mm/slub.c:3835 [inline]
 __do_kmalloc_node mm/slub.c:3965 [inline]
 __kmalloc_node_track_caller+0x2d6/0x4e0 mm/slub.c:3986
 kmalloc_reserve+0x111/0x2a0 net/core/skbuff.c:597
 __alloc_skb+0x1f3/0x440 net/core/skbuff.c:666
 alloc_skb include/linux/skbuff.h:1308 [inline]
 nlmsg_new include/net/netlink.h:1015 [inline]
 inet6_rt_notify+0xdf/0x290 net/ipv6/route.c:6175
 fib6_add_rt2node net/ipv6/ip6_fib.c:1262 [inline]
 fib6_add+0x1e33/0x4430 net/ipv6/ip6_fib.c:1491
 __ip6_ins_rt net/ipv6/route.c:1313 [inline]
 ip6_route_add+0x8b/0x160 net/ipv6/route.c:3855
 addrconf_prefix_route net/ipv6/addrconf.c:2485 [inline]
 fixup_permanent_addr net/ipv6/addrconf.c:3600 [inline]
 addrconf_permanent_addr+0x7c4/0xc50 net/ipv6/addrconf.c:3624
 addrconf_notify+0x9f5/0x1020 net/ipv6/addrconf.c:3696
 notifier_call_chain+0x19f/0x3e0 kernel/notifier.c:93
 __dev_notify_flags+0x207/0x400
page last free pid 5106 tgid 5106 stack trace:
 reset_page_owner include/linux/page_owner.h:25 [inline]
 free_pages_prepare mm/page_alloc.c:1141 [inline]
 free_unref_page_prepare+0x986/0xab0 mm/page_alloc.c:2347
 free_unref_page+0x37/0x3f0 mm/page_alloc.c:2487
 discard_slab mm/slub.c:2437 [inline]
 __put_partials+0xeb/0x130 mm/slub.c:2906
 put_cpu_partial+0x17c/0x250 mm/slub.c:2981
 __slab_free+0x2ea/0x3d0 mm/slub.c:4151
 qlink_free mm/kasan/quarantine.c:163 [inline]
 qlist_free_all+0x5e/0xc0 mm/kasan/quarantine.c:179
 kasan_quarantine_reduce+0x14f/0x170 mm/kasan/quarantine.c:286
 __kasan_slab_alloc+0x23/0x80 mm/kasan/common.c:322
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook mm/slub.c:3798 [inline]
 slab_alloc_node mm/slub.c:3845 [inline]
 kmalloc_trace+0x16f/0x360 mm/slub.c:3992
 kmalloc include/linux/slab.h:628 [inline]
 netdevice_queue_work drivers/infiniband/core/roce_gid_mgmt.c:643 [inline]
 netdevice_event+0x37d/0x950 drivers/infiniband/core/roce_gid_mgmt.c:802
 notifier_call_chain+0x19f/0x3e0 kernel/notifier.c:93
 __dev_notify_flags+0x207/0x400
 dev_change_flags+0xf0/0x1a0 net/core/dev.c:8839
 do_setlink+0xccd/0x41f0 net/core/rtnetlink.c:2884
 __rtnl_newlink net/core/rtnetlink.c:3680 [inline]
 rtnl_newlink+0x180b/0x20a0 net/core/rtnetlink.c:3727
 rtnetlink_rcv_msg+0x89b/0x10d0 net/core/rtnetlink.c:6594

Memory state around the buggy address:
 ffff88807ff63100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88807ff63180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88807ff63200: 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc
                            ^
 ffff88807ff63280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88807ff63300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/05/02 06:44 net-next 496bc5861c73 3ba885bc .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: slab-out-of-bounds Read in fill_route
* Struck through repros no longer work on HEAD.