syzbot


KASAN: use-after-free Read in __ethtool_get_link_ksettings

Status: upstream: reported on 2024/05/14 07:21
Reported-by: syzbot+74acac05ccd77c27454b@syzkaller.appspotmail.com
First crash: 41d, last: 22d
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in __ethtool_get_link_ksettings net 2 808d 845d 0/27 auto-closed as invalid on 2022/07/07 00:01
upstream KASAN: use-after-free Read in __ethtool_get_link_ksettings (2) net 1 702d 697d 0/27 auto-obsoleted due to no activity on 2022/11/20 15:32
upstream general protection fault in __ethtool_get_link_ksettings net C error unreliable 298 1076d 1235d 0/27 closed as invalid on 2021/10/06 01:39
upstream KASAN: slab-use-after-free Read in __ethtool_get_link_ksettings net 34 8h58m 94d 0/27 upstream: reported on 2024/03/22 20:10

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __ethtool_get_link_ksettings+0x6a/0x130 net/ethtool/ioctl.c:445
Read of size 8 at addr ffff8880756ee208 by task kworker/1:8/4061

CPU: 1 PID: 4061 Comm: kworker/1:8 Not tainted 6.1.90-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
Workqueue: infiniband ib_cache_event_task
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:284 [inline]
 print_report+0x15f/0x4f0 mm/kasan/report.c:395
 kasan_report+0x136/0x160 mm/kasan/report.c:495
 __ethtool_get_link_ksettings+0x6a/0x130 net/ethtool/ioctl.c:445
 ib_get_eth_speed+0x151/0x510 drivers/infiniband/core/verbs.c:1898
 rxe_query_port+0x5a/0x1a0 drivers/infiniband/sw/rxe/rxe_verbs.c:38
 __ib_query_port drivers/infiniband/core/device.c:2067 [inline]
 ib_query_port+0x15f/0x7c0 drivers/infiniband/core/device.c:2099
 ib_cache_update+0x1a8/0xaf0 drivers/infiniband/core/cache.c:1487
 ib_cache_event_task+0xef/0x1e0 drivers/infiniband/core/cache.c:1561
 process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292
 worker_thread+0xa47/0x1200 kernel/workqueue.c:2439
 kthread+0x28d/0x320 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
 </TASK>

Allocated by task 4617:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0x97/0xb0 mm/kasan/common.c:383
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 __do_kmalloc_node mm/slab_common.c:955 [inline]
 __kmalloc_node+0xb3/0x230 mm/slab_common.c:962
 kmalloc_node include/linux/slab.h:582 [inline]
 kvmalloc_node+0x6e/0x180 mm/util.c:581
 kvmalloc include/linux/slab.h:709 [inline]
 kvzalloc include/linux/slab.h:717 [inline]
 alloc_netdev_mqs+0x85/0xeb0 net/core/dev.c:10622
 rtnl_create_link+0x2e9/0xa30 net/core/rtnetlink.c:3263
 rtnl_newlink_create net/core/rtnetlink.c:3380 [inline]
 __rtnl_newlink net/core/rtnetlink.c:3610 [inline]
 rtnl_newlink+0x1403/0x2050 net/core/rtnetlink.c:3623
 rtnetlink_rcv_msg+0x818/0xff0 net/core/rtnetlink.c:6121
 netlink_rcv_skb+0x1cd/0x410 net/netlink/af_netlink.c:2508
 netlink_unicast_kernel net/netlink/af_netlink.c:1326 [inline]
 netlink_unicast+0x7d8/0x970 net/netlink/af_netlink.c:1352
 netlink_sendmsg+0xa26/0xd60 net/netlink/af_netlink.c:1874
 sock_sendmsg_nosec net/socket.c:718 [inline]
 __sock_sendmsg net/socket.c:730 [inline]
 __sys_sendto+0x480/0x600 net/socket.c:2148
 __do_sys_sendto net/socket.c:2160 [inline]
 __se_sys_sendto net/socket.c:2156 [inline]
 __x64_sys_sendto+0xda/0xf0 net/socket.c:2156
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Freed by task 46:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:516
 ____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236
 kasan_slab_free include/linux/kasan.h:177 [inline]
 slab_free_hook mm/slub.c:1724 [inline]
 slab_free_freelist_hook mm/slub.c:1750 [inline]
 slab_free mm/slub.c:3661 [inline]
 __kmem_cache_free+0x25c/0x3c0 mm/slub.c:3674
 device_release+0x91/0x1c0
 kobject_cleanup lib/kobject.c:681 [inline]
 kobject_release lib/kobject.c:712 [inline]
 kref_put include/linux/kref.h:65 [inline]
 kobject_put+0x224/0x460 lib/kobject.c:729
 netdev_run_todo+0xe56/0xf40 net/core/dev.c:10412
 default_device_exit_batch+0x95b/0x9d0 net/core/dev.c:11395
 ops_exit_list net/core/net_namespace.c:174 [inline]
 cleanup_net+0x763/0xb60 net/core/net_namespace.c:601
 process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292
 worker_thread+0xa47/0x1200 kernel/workqueue.c:2439
 kthread+0x28d/0x320 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308

The buggy address belongs to the object at ffff8880756ee000
 which belongs to the cache kmalloc-cg-4k of size 4096
The buggy address is located 520 bytes inside of
 4096-byte region [ffff8880756ee000, ffff8880756ef000)

The buggy address belongs to the physical page:
page:ffffea0001d5ba00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x756e8
head:ffffea0001d5ba00 order:3 compound_mapcount:0 compound_pincount:0
memcg:ffff88802a342e01
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 dead000000000001 ffff88801244c280
raw: 0000000000000000 0000000000040004 00000001ffffffff ffff88802a342e01
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 4391, tgid 4391 (syz-executor.0), ts 97758495910, free_ts 97741619921
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2513
 prep_new_page mm/page_alloc.c:2520 [inline]
 get_page_from_freelist+0x31a1/0x3320 mm/page_alloc.c:4279
 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5547
 alloc_slab_page+0x6a/0x150 mm/slub.c:1794
 allocate_slab mm/slub.c:1939 [inline]
 new_slab+0x84/0x2d0 mm/slub.c:1992
 ___slab_alloc+0xc20/0x1270 mm/slub.c:3180
 __slab_alloc mm/slub.c:3279 [inline]
 slab_alloc_node mm/slub.c:3364 [inline]
 __kmem_cache_alloc_node+0x19f/0x260 mm/slub.c:3437
 __do_kmalloc_node mm/slab_common.c:954 [inline]
 __kmalloc_node_track_caller+0xa0/0x220 mm/slab_common.c:975
 kmemdup+0x26/0x60 mm/util.c:129
 __addrconf_sysctl_register+0xad/0x3e0 net/ipv6/addrconf.c:7101
 addrconf_sysctl_register+0x128/0x180 net/ipv6/addrconf.c:7166
 ipv6_add_dev+0xb8e/0x1180 net/ipv6/addrconf.c:451
 addrconf_notify+0x7a6/0xf60 net/ipv6/addrconf.c:3578
 notifier_call_chain kernel/notifier.c:87 [inline]
 raw_notifier_call_chain+0xd0/0x170 kernel/notifier.c:455
 call_netdevice_notifiers_info net/core/dev.c:1970 [inline]
 call_netdevice_notifiers_extack net/core/dev.c:2008 [inline]
 call_netdevice_notifiers+0x145/0x1b0 net/core/dev.c:2022
 register_netdevice+0x12f2/0x1720 net/core/dev.c:10132
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1440 [inline]
 free_pcp_prepare mm/page_alloc.c:1490 [inline]
 free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3358
 free_unref_page+0x33/0x3e0 mm/page_alloc.c:3453
 free_slab mm/slub.c:2031 [inline]
 discard_slab mm/slub.c:2037 [inline]
 __unfreeze_partials+0x1b7/0x210 mm/slub.c:2586
 put_cpu_partial+0x17b/0x250 mm/slub.c:2662
 qlink_free mm/kasan/quarantine.c:168 [inline]
 qlist_free_all+0x76/0xe0 mm/kasan/quarantine.c:187
 kasan_quarantine_reduce+0x156/0x170 mm/kasan/quarantine.c:294
 __kasan_slab_alloc+0x1f/0x70 mm/kasan/common.c:305
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook+0x52/0x3a0 mm/slab.h:737
 slab_alloc_node mm/slub.c:3398 [inline]
 slab_alloc mm/slub.c:3406 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3413 [inline]
 kmem_cache_alloc+0x10c/0x2d0 mm/slub.c:3422
 vm_area_dup+0x23/0x1b0 kernel/fork.c:466
 dup_mmap kernel/fork.c:645 [inline]
 dup_mm kernel/fork.c:1540 [inline]
 copy_mm+0xed2/0x19c0 kernel/fork.c:1589
 copy_process+0x19d5/0x4060 kernel/fork.c:2267
 kernel_clone+0x222/0x920 kernel/fork.c:2682
 __do_sys_clone kernel/fork.c:2823 [inline]
 __se_sys_clone kernel/fork.c:2807 [inline]
 __x64_sys_clone+0x231/0x280 kernel/fork.c:2807
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Memory state around the buggy address:
 ffff8880756ee100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880756ee180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880756ee200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                      ^
 ffff8880756ee280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880756ee300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/05/14 07:20 linux-6.1.y 909ba1f1b414 fdb4c10c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in __ethtool_get_link_ksettings
2024/06/02 07:54 linux-6.1.y 88690811da69 3113787f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in __ethtool_get_link_ksettings
* Struck through repros no longer work on HEAD.