syzbot


KASAN: slab-use-after-free Read in __ethtool_get_link_ksettings

Status: upstream: reported on 2024/03/22 20:10
Subsystems: net
[Documentation on labels]
Reported-by: syzbot+5fe14f2ff4ccbace9a26@syzkaller.appspotmail.com
First crash: 103d, last: 1d06h
Discussions (6)
Title Replies (including bot) Last reply
[PATCH v3 net] Subject: [PATCH] RDMA/core: fix UAF with ib_device_get_netdev() 4 (4) 2024/04/08 14:23
[PATCH 5 net] RDMA/core: fix UAF with ib_device_get_netdev() 2 (2) 2024/04/02 18:22
[PATCH 4 net] RDMA/core: fix UAF with ib_device_get_netdev() 3 (3) 2024/04/02 13:05
[PATCH v2 net] RDMA/core: fix UAF in ib_get_eth_speed 5 (5) 2024/03/28 12:18
[PATCH net] RDMA/core: fix UAF in ib_get_eth_speed 3 (3) 2024/03/28 11:24
[syzbot] [net?] KASAN: slab-use-after-free Read in __ethtool_get_link_ksettings 2 (3) 2024/03/25 13:08
Similar bugs (3)
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 750d 786d 0/26 auto-closed as invalid on 2022/07/07 00:01
upstream general protection fault in __ethtool_get_link_ksettings net C error unreliable 298 1017d 1176d 0/26 closed as invalid on 2021/10/06 01:39
upstream KASAN: use-after-free Read in __ethtool_get_link_ksettings (2) net 1 643d 638d 0/26 auto-obsoleted due to no activity on 2022/11/20 15:32

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in __ethtool_get_link_ksettings+0x186/0x190 net/ethtool/ioctl.c:441
Read of size 8 at addr ffff888066f3a308 by task kworker/1:2/2753

CPU: 1 PID: 2753 Comm: kworker/1:2 Not tainted 6.9.0-rc5-syzkaller-00053-ge33c4963bf53 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Workqueue: infiniband ib_cache_event_task
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114
 print_address_description mm/kasan/report.c:377 [inline]
 print_report+0xc3/0x620 mm/kasan/report.c:488
 kasan_report+0xd9/0x110 mm/kasan/report.c:601
 __ethtool_get_link_ksettings+0x186/0x190 net/ethtool/ioctl.c:441
 __ethtool_get_link_ksettings+0xf2/0x190 net/ethtool/ioctl.c:445
 ib_get_eth_speed+0x123/0xb50 drivers/infiniband/core/verbs.c:1984
 siw_query_port+0x3c/0x3e0 drivers/infiniband/sw/siw/siw_verbs.c:179
 iw_query_port drivers/infiniband/core/device.c:2056 [inline]
 ib_query_port drivers/infiniband/core/device.c:2097 [inline]
 ib_query_port+0x3d2/0x8a0 drivers/infiniband/core/device.c:2089
 ib_cache_update.part.0+0xdc/0xa30 drivers/infiniband/core/cache.c:1498
 ib_cache_update drivers/infiniband/core/cache.c:1572 [inline]
 ib_cache_event_task+0x1c2/0x290 drivers/infiniband/core/cache.c:1572
 process_one_work+0x9a9/0x1ac0 kernel/workqueue.c:3254
 process_scheduled_works kernel/workqueue.c:3335 [inline]
 worker_thread+0x6c8/0xf70 kernel/workqueue.c:3416
 kthread+0x2c1/0x3a0 kernel/kthread.c:388
 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
 </TASK>

Allocated by task 6897:
 kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
 kasan_save_track+0x14/0x30 mm/kasan/common.c:68
 poison_kmalloc_redzone mm/kasan/common.c:370 [inline]
 __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:387
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 __do_kmalloc_node mm/slub.c:3966 [inline]
 __kmalloc_node+0x226/0x480 mm/slub.c:3973
 kmalloc_node include/linux/slab.h:648 [inline]
 kvmalloc_node+0x9d/0x1a0 mm/util.c:634
 kvmalloc include/linux/slab.h:766 [inline]
 kvzalloc include/linux/slab.h:774 [inline]
 alloc_netdev_mqs+0xb3/0x12b0 net/core/dev.c:10849
 rtnl_create_link+0xc88/0xfa0 net/core/rtnetlink.c:3358
 rtnl_newlink_create net/core/rtnetlink.c:3484 [inline]
 __rtnl_newlink+0x10ae/0x1960 net/core/rtnetlink.c:3714
 rtnl_newlink+0x67/0xa0 net/core/rtnetlink.c:3727
 rtnetlink_rcv_msg+0x3c7/0xe60 net/core/rtnetlink.c:6595
 netlink_rcv_skb+0x16b/0x440 net/netlink/af_netlink.c:2559
 netlink_unicast_kernel net/netlink/af_netlink.c:1335 [inline]
 netlink_unicast+0x542/0x820 net/netlink/af_netlink.c:1361
 netlink_sendmsg+0x8b8/0xd70 net/netlink/af_netlink.c:1905
 sock_sendmsg_nosec net/socket.c:730 [inline]
 __sock_sendmsg net/socket.c:745 [inline]
 __sys_sendto+0x47f/0x4e0 net/socket.c:2191
 __do_sys_sendto net/socket.c:2203 [inline]
 __se_sys_sendto net/socket.c:2199 [inline]
 __x64_sys_sendto+0xe0/0x1c0 net/socket.c:2199
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcf/0x260 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Freed by task 129:
 kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
 kasan_save_track+0x14/0x30 mm/kasan/common.c:68
 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:579
 poison_slab_object mm/kasan/common.c:240 [inline]
 __kasan_slab_free+0x11d/0x1a0 mm/kasan/common.c:256
 kasan_slab_free include/linux/kasan.h:184 [inline]
 slab_free_hook mm/slub.c:2106 [inline]
 slab_free mm/slub.c:4280 [inline]
 kfree+0x129/0x390 mm/slub.c:4390
 kvfree+0x47/0x50 mm/util.c:680
 device_release+0xa1/0x240 drivers/base/core.c:2580
 kobject_cleanup lib/kobject.c:689 [inline]
 kobject_release lib/kobject.c:720 [inline]
 kref_put include/linux/kref.h:65 [inline]
 kobject_put+0x1fa/0x5b0 lib/kobject.c:737
 netdev_run_todo+0x7d1/0x1260 net/core/dev.c:10600
 default_device_exit_batch+0x860/0xae0 net/core/dev.c:11641
 ops_exit_list+0x128/0x180 net/core/net_namespace.c:175
 cleanup_net+0x5b7/0xbf0 net/core/net_namespace.c:637
 process_one_work+0x9a9/0x1ac0 kernel/workqueue.c:3254
 process_scheduled_works kernel/workqueue.c:3335 [inline]
 worker_thread+0x6c8/0xf70 kernel/workqueue.c:3416
 kthread+0x2c1/0x3a0 kernel/kthread.c:388
 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

The buggy address belongs to the object at ffff888066f3a000
 which belongs to the cache kmalloc-cg-4k of size 4096
The buggy address is located 776 bytes inside of
 freed 4096-byte region [ffff888066f3a000, ffff888066f3b000)

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x66f38
head: order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
memcg:ffff88802a4dfcc1
flags: 0xfff80000000840(slab|head|node=0|zone=1|lastcpupid=0xfff)
page_type: 0xffffffff()
raw: 00fff80000000840 ffff88801504f500 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000040004 00000001ffffffff ffff88802a4dfcc1
head: 00fff80000000840 ffff88801504f500 dead000000000122 0000000000000000
head: 0000000000000000 0000000000040004 00000001ffffffff ffff88802a4dfcc1
head: 00fff80000000003 ffffea00019bce01 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 6897, tgid 1736326760 (syz-executor.1), ts 6897, free_ts 241426434670
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x2d4/0x350 mm/page_alloc.c:1534
 prep_new_page mm/page_alloc.c:1541 [inline]
 get_page_from_freelist+0xa28/0x3780 mm/page_alloc.c:3317
 __alloc_pages+0x22b/0x2460 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 mm/slub.c:2175 [inline]
 allocate_slab mm/slub.c:2338 [inline]
 new_slab+0xcc/0x3a0 mm/slub.c:2391
 ___slab_alloc+0x66d/0x1790 mm/slub.c:3525
 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3610
 __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+0x367/0x470 mm/slub.c:3986
 kmemdup+0x29/0x60 mm/util.c:131
 kmemdup include/linux/fortify-string.h:738 [inline]
 __addrconf_sysctl_register+0xc2/0x3f0 net/ipv6/addrconf.c:7198
 addrconf_sysctl_register net/ipv6/addrconf.c:7264 [inline]
 addrconf_sysctl_register+0x15f/0x1f0 net/ipv6/addrconf.c:7253
 ipv6_add_dev+0x9d5/0x1400 net/ipv6/addrconf.c:455
 addrconf_notify+0x546/0x19e0 net/ipv6/addrconf.c:3651
 notifier_call_chain+0xb9/0x410 kernel/notifier.c:93
 call_netdevice_notifiers_info+0xbe/0x140 net/core/dev.c:1950
 call_netdevice_notifiers_extack net/core/dev.c:1988 [inline]
 call_netdevice_notifiers net/core/dev.c:2002 [inline]
 register_netdevice+0x15f5/0x1ca0 net/core/dev.c:10316
 virt_wifi_newlink+0x3ed/0x970 drivers/net/wireless/virtual/virt_wifi.c:553
page last free pid 60 tgid 60 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+0x527/0xb10 mm/page_alloc.c:2347
 free_unref_page+0x33/0x3c0 mm/page_alloc.c:2487
 __folio_put_large+0x10d/0x1c0 mm/swap.c:132
 __folio_put+0x1c0/0x1f0 mm/swap.c:140
 folio_put include/linux/mm.h:1506 [inline]
 put_page include/linux/mm.h:1578 [inline]
 napi_frag_unref include/linux/skbuff.h:3540 [inline]
 skb_release_data+0x5db/0x990 net/core/skbuff.c:1130
 skb_release_all net/core/skbuff.c:1202 [inline]
 __kfree_skb net/core/skbuff.c:1216 [inline]
 kfree_skb_reason+0x12d/0x210 net/core/skbuff.c:1252
 __skb_queue_purge_reason include/linux/skbuff.h:3242 [inline]
 skb_queue_purge_reason+0x2a9/0x410 net/core/skbuff.c:3886
 skb_queue_purge include/linux/skbuff.h:3255 [inline]
 rds_tcp_inc_purge net/rds/tcp_recv.c:48 [inline]
 rds_tcp_inc_free+0x1e/0x30 net/rds/tcp_recv.c:55
 rds_inc_put+0x13f/0x1a0 net/rds/recv.c:83
 rds_tcp_conn_path_shutdown+0x239/0x410 net/rds/tcp_connect.c:224
 rds_conn_shutdown+0x258/0xa10 net/rds/connection.c:398
 process_one_work+0x9a9/0x1ac0 kernel/workqueue.c:3254
 process_scheduled_works kernel/workqueue.c:3335 [inline]
 worker_thread+0x6c8/0xf70 kernel/workqueue.c:3416
 kthread+0x2c1/0x3a0 kernel/kthread.c:388
 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

Memory state around the buggy address:
 ffff888066f3a200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888066f3a280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888066f3a300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                      ^
 ffff888066f3a380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888066f3a400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (14):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/04/25 23:12 upstream e33c4963bf53 8bdc0f22 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root KASAN: slab-use-after-free Read in __ethtool_get_link_ksettings
2024/04/14 07:10 upstream fe46a7dd189e c8349e48 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root KASAN: slab-use-after-free Read in __ethtool_get_link_ksettings
2024/04/13 11:13 upstream fe46a7dd189e c8349e48 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root KASAN: slab-use-after-free Read in __ethtool_get_link_ksettings
2024/04/12 17:31 upstream fe46a7dd189e 27de0a5c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root KASAN: slab-use-after-free Read in __ethtool_get_link_ksettings
2024/04/11 08:38 upstream fe46a7dd189e 56086b24 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root KASAN: slab-use-after-free Read in __ethtool_get_link_ksettings
2024/03/13 22:25 upstream 61387b8dcf1d f919f202 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root KASAN: slab-use-after-free Read in __ethtool_get_link_ksettings
2024/02/26 15:15 upstream d206a76d7d27 edd6a5e9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root KASAN: slab-use-after-free Read in __ethtool_get_link_ksettings
2024/04/23 05:10 upstream a2c63a3f3d68 21339d7b .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-arm64 KASAN: slab-use-after-free Read in __ethtool_get_link_ksettings
2024/01/16 11:52 upstream 052d534373b7 2a7bcc7f .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-arm64-compat KASAN: slab-use-after-free Read in __ethtool_get_link_ksettings
2024/01/14 06:32 upstream 052d534373b7 551587c1 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-arm64-compat KASAN: slab-use-after-free Read in __ethtool_get_link_ksettings
2024/03/22 20:09 net f99c5f563c17 7a239ce7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce KASAN: slab-use-after-free Read in __ethtool_get_link_ksettings
2024/03/27 05:12 net-next 237bb5f7f7f5 454571b6 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: slab-use-after-free Read in __ethtool_get_link_ksettings
2024/04/08 12:41 linux-next 11cb68ad52ac ca620dd8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in __ethtool_get_link_ksettings
2024/04/07 12:33 linux-next 8568bb2ccc27 ca620dd8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in __ethtool_get_link_ksettings
* Struck through repros no longer work on HEAD.