syzbot


KASAN: use-after-free Read in macsec_get_iflink

Status: auto-obsoleted due to no activity on 2023/07/24 21:03
Reported-by: syzbot+6d139518e852024c8d2f@syzkaller.appspotmail.com
First crash: 575d, last: 575d
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-10 KASAN: use-after-free Read in macsec_get_iflink (2) C 5 8d04h 18d 0/2 upstream: reported C repro on 2024/11/02 16:17
android-5-10 KASAN: use-after-free Read in macsec_get_iflink syz error 2 173d 299d 0/2 auto-obsoleted due to no activity on 2024/08/30 07:40
upstream KASAN: use-after-free Read in macsec_get_iflink net 1 913d 909d 22/28 fixed on 2023/02/24 13:50

Sample crash report:
device macsec2 entered promiscuous mode
device veth3 entered promiscuous mode
device veth3 left promiscuous mode
==================================================================
BUG: KASAN: use-after-free in macsec_get_iflink+0x70/0x80 drivers/net/macsec.c:3650
Read of size 4 at addr ffff88811b6640d0 by task syz-executor.2/23154

CPU: 0 PID: 23154 Comm: syz-executor.2 Tainted: G        W         5.15.98-syzkaller-00348-g7364b7abbafb #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106
 print_address_description+0x87/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:427 [inline]
 kasan_report+0x179/0x1c0 mm/kasan/report.c:444
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:308
 macsec_get_iflink+0x70/0x80 drivers/net/macsec.c:3650
 dev_get_iflink+0x6f/0xc0 net/core/dev.c:705
 default_operstate net/core/link_watch.c:41 [inline]
 rfc2863_policy+0x127/0x2b0 net/core/link_watch.c:53
 linkwatch_do_dev+0x3c/0x160 net/core/link_watch.c:160
 linkwatch_forget_dev+0x170/0x180 net/core/link_watch.c:238
 netdev_run_todo+0x2ec/0x9f0 net/core/dev.c:10613
 rtnl_unlock net/core/rtnetlink.c:112 [inline]
 rtnetlink_rcv_msg+0x984/0xc40 net/core/rtnetlink.c:5588
 netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2533
 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:5605
 netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline]
 netlink_unicast+0x8df/0xac0 net/netlink/af_netlink.c:1356
 netlink_sendmsg+0xa0a/0xd20 net/netlink/af_netlink.c:1952
 sock_sendmsg_nosec net/socket.c:704 [inline]
 sock_sendmsg net/socket.c:724 [inline]
 ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2412
 ___sys_sendmsg+0x252/0x2e0 net/socket.c:2466
 __sys_sendmsg net/socket.c:2495 [inline]
 __do_sys_sendmsg net/socket.c:2504 [inline]
 __se_sys_sendmsg+0x19a/0x260 net/socket.c:2502
 __x64_sys_sendmsg+0x7b/0x90 net/socket.c:2502
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f58bd2cc169
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f58bc01e168 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f58bd3ec050 RCX: 00007f58bd2cc169
RDX: 0000000000000000 RSI: 0000000020000140 RDI: 000000000000000e
RBP: 00007f58bd327ca1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fffa230501f R14: 00007f58bc01e300 R15: 0000000000022000
 </TASK>

Allocated by task 23154:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:433 [inline]
 ____kasan_kmalloc+0xdb/0x110 mm/kasan/common.c:512
 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:521
 kasan_kmalloc include/linux/kasan.h:227 [inline]
 __kmalloc+0x13a/0x270 mm/slub.c:4425
 __kmalloc_node include/linux/slab.h:474 [inline]
 kmalloc_node include/linux/slab.h:631 [inline]
 kvmalloc_node+0x82/0x130 mm/util.c:623
 kvmalloc include/linux/mm.h:851 [inline]
 kvzalloc include/linux/mm.h:859 [inline]
 alloc_netdev_mqs+0x8c/0xc90 net/core/dev.c:10828
 rtnl_create_link+0x2d2/0x990 net/core/rtnetlink.c:3185
 __rtnl_newlink net/core/rtnetlink.c:3452 [inline]
 rtnl_newlink+0x138a/0x2040 net/core/rtnetlink.c:3510
 rtnetlink_rcv_msg+0x951/0xc40 net/core/rtnetlink.c:5587
 netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2533
 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:5605
 netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline]
 netlink_unicast+0x8df/0xac0 net/netlink/af_netlink.c:1356
 netlink_sendmsg+0xa0a/0xd20 net/netlink/af_netlink.c:1952
 sock_sendmsg_nosec net/socket.c:704 [inline]
 sock_sendmsg net/socket.c:724 [inline]
 ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2412
 ___sys_sendmsg+0x252/0x2e0 net/socket.c:2466
 __sys_sendmsg net/socket.c:2495 [inline]
 __do_sys_sendmsg net/socket.c:2504 [inline]
 __se_sys_sendmsg+0x19a/0x260 net/socket.c:2502
 __x64_sys_sendmsg+0x7b/0x90 net/socket.c:2502
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Freed by task 23152:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:45
 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370
 ____kasan_slab_free+0x126/0x160 mm/kasan/common.c:365
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:373
 kasan_slab_free include/linux/kasan.h:193 [inline]
 slab_free_hook mm/slub.c:1723 [inline]
 slab_free_freelist_hook+0xbd/0x190 mm/slub.c:1749
 slab_free mm/slub.c:3517 [inline]
 kfree+0xc8/0x220 mm/slub.c:4577
 kvfree+0x35/0x40 mm/util.c:658
 netdev_freemem+0x3f/0x60 net/core/dev.c:10782
 netdev_release+0x7f/0xb0 net/core/net-sysfs.c:1903
 device_release+0x95/0x1c0
 kobject_cleanup lib/kobject.c:705 [inline]
 kobject_release lib/kobject.c:736 [inline]
 kref_put include/linux/kref.h:65 [inline]
 kobject_put+0x178/0x260 lib/kobject.c:753
 netdev_run_todo+0x869/0x9f0 net/core/dev.c:10638
 rtnl_unlock net/core/rtnetlink.c:112 [inline]
 rtnetlink_rcv_msg+0x984/0xc40 net/core/rtnetlink.c:5588
 netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2533
 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:5605
 netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline]
 netlink_unicast+0x8df/0xac0 net/netlink/af_netlink.c:1356
 netlink_sendmsg+0xa0a/0xd20 net/netlink/af_netlink.c:1952
 sock_sendmsg_nosec net/socket.c:704 [inline]
 sock_sendmsg net/socket.c:724 [inline]
 ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2412
 ___sys_sendmsg+0x252/0x2e0 net/socket.c:2466
 __sys_sendmsg net/socket.c:2495 [inline]
 __do_sys_sendmsg net/socket.c:2504 [inline]
 __se_sys_sendmsg+0x19a/0x260 net/socket.c:2502
 __x64_sys_sendmsg+0x7b/0x90 net/socket.c:2502
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

The buggy address belongs to the object at ffff88811b664000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 208 bytes inside of
 4096-byte region [ffff88811b664000, ffff88811b665000)
The buggy address belongs to the page:
page:ffffea00046d9800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11b660
head:ffffea00046d9800 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head|zone=1)
raw: 4000000000010200 ffffea00042dd800 0000000200000002 ffff888100043380
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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 28307, ts 2893964039779, free_ts 2892574028045
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x1a3/0x1b0 mm/page_alloc.c:2502
 prep_new_page mm/page_alloc.c:2508 [inline]
 get_page_from_freelist+0x2c14/0x2cf0 mm/page_alloc.c:4291
 __alloc_pages+0x386/0x7b0 mm/page_alloc.c:5569
 allocate_slab mm/slub.c:1930 [inline]
 new_slab+0x92/0x490 mm/slub.c:1993
 ___slab_alloc+0x39e/0x830 mm/slub.c:3026
 __slab_alloc+0x4a/0x90 mm/slub.c:3113
 slab_alloc_node mm/slub.c:3204 [inline]
 slab_alloc mm/slub.c:3246 [inline]
 kmem_cache_alloc_trace+0x142/0x210 mm/slub.c:3263
 kmalloc include/linux/slab.h:608 [inline]
 kzalloc include/linux/slab.h:738 [inline]
 kobject_uevent_env+0x269/0x700 lib/kobject_uevent.c:524
 kobject_uevent+0x1f/0x30 lib/kobject_uevent.c:642
 netdev_queue_add_kobject net/core/net-sysfs.c:1677 [inline]
 netdev_queue_update_kobjects+0x1c0/0x400 net/core/net-sysfs.c:1711
 register_queue_kobjects net/core/net-sysfs.c:1772 [inline]
 netdev_register_kobject+0x270/0x320 net/core/net-sysfs.c:2018
 register_netdevice+0xda5/0x1350 net/core/dev.c:10332
 register_netdev+0x3c/0x50 net/core/dev.c:10456
 sit_init_net+0x244/0x480 net/ipv6/sit.c:1923
 ops_init+0x1cf/0x4a0 net/core/net_namespace.c:135
 setup_net+0x34b/0xb50 net/core/net_namespace.c:329
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:26 [inline]
 free_pages_prepare mm/page_alloc.c:1370 [inline]
 free_pcp_prepare mm/page_alloc.c:1442 [inline]
 free_unref_page_prepare+0x7c8/0x7d0 mm/page_alloc.c:3441
 free_unref_page+0xac/0x2c0 mm/page_alloc.c:3521
 free_the_page mm/page_alloc.c:711 [inline]
 __free_pages+0x61/0xf0 mm/page_alloc.c:5645
 __free_slab+0xec/0x1d0 mm/slub.c:2018
 free_slab mm/slub.c:2033 [inline]
 discard_slab mm/slub.c:2039 [inline]
 __unfreeze_partials+0x165/0x1a0 mm/slub.c:2525
 put_cpu_partial+0xc4/0x120 mm/slub.c:2605
 __slab_free+0x1c8/0x290 mm/slub.c:3386
 do_slab_free mm/slub.c:3505 [inline]
 ___cache_free+0x109/0x120 mm/slub.c:3524
 qlink_free+0x4d/0x90 mm/kasan/quarantine.c:157
 qlist_free_all+0x44/0xb0 mm/kasan/quarantine.c:176
 kasan_quarantine_reduce+0x15a/0x180 mm/kasan/quarantine.c:283
 __kasan_slab_alloc+0x2f/0xe0 mm/kasan/common.c:443
 kasan_slab_alloc include/linux/kasan.h:217 [inline]
 slab_post_alloc_hook+0x53/0x2c0 mm/slab.h:550
 slab_alloc_node mm/slub.c:3238 [inline]
 slab_alloc mm/slub.c:3246 [inline]
 kmem_cache_alloc+0xf5/0x200 mm/slub.c:3251
 getname_flags+0xba/0x520 fs/namei.c:138
 getname+0x19/0x20 fs/namei.c:217

Memory state around the buggy address:
 ffff88811b663f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88811b664000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88811b664080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                 ^
 ffff88811b664100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88811b664180: 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
2023/04/25 20:55 android13-5.15-lts 7364b7abbafb 65320f8e .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in macsec_get_iflink
* Struck through repros no longer work on HEAD.