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: 92d, last: 1d11h
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 738d 774d 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 1006d 1165d 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 632d 627d 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 ffff88802df70308 by task kworker/0:1/8

CPU: 0 PID: 8 Comm: kworker/0:1 Not tainted 6.8.0-syzkaller-08951-gfe46a7dd189e #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Workqueue: events smc_ib_port_event_work
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
 rxe_query_port+0x72/0x200 drivers/infiniband/sw/rxe/rxe_verbs.c:55
 __ib_query_port drivers/infiniband/core/device.c:2060 [inline]
 ib_query_port drivers/infiniband/core/device.c:2092 [inline]
 ib_query_port+0x43e/0x8a0 drivers/infiniband/core/device.c:2082
 smc_ib_remember_port_attr net/smc/smc_ib.c:359 [inline]
 smc_ib_port_event_work+0x130/0xc00 net/smc/smc_ib.c:383
 process_one_work+0x9a9/0x1a60 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:243
 </TASK>

Allocated by task 5090:
 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:10840
 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+0xd2/0x260 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x6d/0x75

Freed by task 50:
 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/0x370 mm/slub.c:4390
 kvfree+0x47/0x50 mm/util.c:680
 device_release+0xa1/0x240 drivers/base/core.c:2499
 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:10591
 default_device_exit_batch+0x860/0xae0 net/core/dev.c:11632
 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/0x1a60 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:243

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

The buggy address belongs to the physical page:
page:ffffea0000b7dc00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2df70
head:ffffea0000b7dc00 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000840 ffff88801504f500 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000040004 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 0xd60c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_RETRY_MAYFAIL|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5090, tgid 5090 (syz-executor.4), ts 102232163636, free_ts 102184458669
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x2d4/0x350 mm/page_alloc.c:1533
 prep_new_page mm/page_alloc.c:1540 [inline]
 get_page_from_freelist+0xa28/0x3780 mm/page_alloc.c:3311
 __alloc_pages+0x22b/0x2410 mm/page_alloc.c:4569
 __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+0x36e/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:10840
 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
page last free pid 5082 tgid 5082 stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1140 [inline]
 free_unref_page_prepare+0x527/0xb10 mm/page_alloc.c:2346
 free_unref_page+0x33/0x3c0 mm/page_alloc.c:2486
 qlink_free mm/kasan/quarantine.c:163 [inline]
 qlist_free_all+0x4e/0x140 mm/kasan/quarantine.c:179
 kasan_quarantine_reduce+0x192/0x1e0 mm/kasan/quarantine.c:286
 __kasan_slab_alloc+0x69/0x90 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+0x147/0x330 mm/slub.c:3992
 kmalloc include/linux/slab.h:628 [inline]
 kzalloc include/linux/slab.h:749 [inline]
 ref_tracker_alloc+0x17c/0x5b0 lib/ref_tracker.c:203
 __netdev_tracker_alloc include/linux/netdevice.h:4064 [inline]
 netdev_hold include/linux/netdevice.h:4093 [inline]
 netdev_hold include/linux/netdevice.h:4088 [inline]
 register_netdevice+0x14a0/0x1ca0 net/core/dev.c:10294
 ipvlan_link_new+0x354/0xbf0 drivers/net/ipvlan/ipvlan_main.c:588
 rtnl_newlink_create net/core/rtnetlink.c:3494 [inline]
 __rtnl_newlink+0x1197/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

Memory state around the buggy address:
 ffff88802df70200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88802df70280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88802df70300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                      ^
 ffff88802df70380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88802df70400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (12):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
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/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.