syzbot


KASAN: use-after-free Read in macsec_get_iflink

Status: premoderation: reported syz repro on 2024/01/26 20:14
Reported-by: syzbot+55be8faf66876c6ce8a7@syzkaller.appspotmail.com
First crash: 91d, last: 50d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-15 KASAN: use-after-free Read in macsec_get_iflink 1 367d 367d 0/2 auto-obsoleted due to no activity on 2023/07/24 21:03
upstream KASAN: use-after-free Read in macsec_get_iflink net 1 705d 701d 22/26 fixed on 2023/02/24 13:50
Last patch testing requests (1)
Created Duration User Patch Repo Result
2024/02/09 20:50 14m retest repro android13-5.10-lts OK log
Fix bisection attempts (1)
Created Duration User Patch Repo Result
2024/03/08 01:07 1h20m bisect fix android13-5.10-lts job log (0) log

Sample crash report:
device macsec1 entered promiscuous mode
device team_slave_1 entered promiscuous mode
device team_slave_1 left promiscuous mode
==================================================================
BUG: KASAN: use-after-free in macsec_get_iflink+0x70/0x80 drivers/net/macsec.c:3654
Read of size 4 at addr ffff8881210e0100 by task syz-executor.1/494

CPU: 1 PID: 494 Comm: syz-executor.1 Not tainted 5.10.208-syzkaller-00133-g1a7db4583e18 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118
 print_address_description+0x81/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:435 [inline]
 kasan_report+0x179/0x1c0 mm/kasan/report.c:452
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:308
 macsec_get_iflink+0x70/0x80 drivers/net/macsec.c:3654
 dev_get_iflink+0x6f/0xc0 net/core/dev.c:824
 default_operstate net/core/link_watch.c:41 [inline]
 rfc2863_policy+0x127/0x2b0 net/core/link_watch.c:53
 linkwatch_do_dev+0x3c/0x140 net/core/link_watch.c:160
 linkwatch_forget_dev+0x170/0x180 net/core/link_watch.c:238
 netdev_wait_allrefs net/core/dev.c:10195 [inline]
 netdev_run_todo+0x2ee/0xdc0 net/core/dev.c:10310
 rtnl_unlock net/core/rtnetlink.c:112 [inline]
 rtnetlink_rcv_msg+0x988/0xc50 net/core/rtnetlink.c:5609
 netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2497
 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:5626
 netlink_unicast_kernel net/netlink/af_netlink.c:1322 [inline]
 netlink_unicast+0x8df/0xac0 net/netlink/af_netlink.c:1348
 netlink_sendmsg+0xa46/0xd00 net/netlink/af_netlink.c:1916
 sock_sendmsg_nosec net/socket.c:652 [inline]
 __sock_sendmsg net/socket.c:664 [inline]
 ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2376
 ___sys_sendmsg+0x252/0x2e0 net/socket.c:2430
 __sys_sendmsg net/socket.c:2459 [inline]
 __do_sys_sendmsg net/socket.c:2468 [inline]
 __se_sys_sendmsg+0x1b1/0x280 net/socket.c:2466
 __x64_sys_sendmsg+0x7b/0x90 net/socket.c:2466
 do_syscall_64+0x34/0x70
 entry_SYSCALL_64_after_hwframe+0x61/0xc6
RIP: 0033:0x7f445a576da9
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:00007f445a0f90c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f445a6a5f80 RCX: 00007f445a576da9
RDX: 0000000000000000 RSI: 0000000020000140 RDI: 0000000000000006
RBP: 00007f445a5c347a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000004d R14: 00007f445a6a5f80 R15: 00007ffeafe99da8

Allocated by task 319:
 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:430 [inline]
 ____kasan_kmalloc+0xdb/0x110 mm/kasan/common.c:509
 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:518
 kasan_kmalloc include/linux/kasan.h:254 [inline]
 __kmalloc+0x1aa/0x330 mm/slub.c:4033
 __kmalloc_node include/linux/slab.h:418 [inline]
 kmalloc_node include/linux/slab.h:575 [inline]
 kvmalloc_node+0x82/0x130 mm/util.c:612
 kvmalloc include/linux/mm.h:822 [inline]
 kvzalloc include/linux/mm.h:830 [inline]
 alloc_netdev_mqs+0x8e/0xcd0 net/core/dev.c:10506
 rtnl_create_link+0x240/0x950 net/core/rtnetlink.c:3192
 __rtnl_newlink net/core/rtnetlink.c:3469 [inline]
 rtnl_newlink+0x1399/0x2000 net/core/rtnetlink.c:3527
 rtnetlink_rcv_msg+0x955/0xc50 net/core/rtnetlink.c:5608
 netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2497
 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:5626
 netlink_unicast_kernel net/netlink/af_netlink.c:1322 [inline]
 netlink_unicast+0x8df/0xac0 net/netlink/af_netlink.c:1348
 netlink_sendmsg+0xa46/0xd00 net/netlink/af_netlink.c:1916
 sock_sendmsg_nosec net/socket.c:652 [inline]
 __sock_sendmsg net/socket.c:664 [inline]
 __sys_sendto+0x545/0x700 net/socket.c:2006
 __do_sys_sendto net/socket.c:2018 [inline]
 __se_sys_sendto net/socket.c:2014 [inline]
 __x64_sys_sendto+0xe5/0x100 net/socket.c:2014
 do_syscall_64+0x34/0x70
 entry_SYSCALL_64_after_hwframe+0x61/0xc6

Freed by task 500:
 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+0x121/0x160 mm/kasan/common.c:362
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:370
 kasan_slab_free include/linux/kasan.h:220 [inline]
 slab_free_hook mm/slub.c:1595 [inline]
 slab_free_freelist_hook+0xc0/0x190 mm/slub.c:1621
 slab_free mm/slub.c:3203 [inline]
 kfree+0xc3/0x270 mm/slub.c:4191
 kvfree+0x35/0x40 mm/util.c:647
 netdev_freemem+0x3f/0x60 net/core/dev.c:10460
 netdev_release+0x7f/0xb0 net/core/net-sysfs.c:1886
 device_release+0x95/0x1c0
 kobject_cleanup lib/kobject.c:713 [inline]
 kobject_release lib/kobject.c:744 [inline]
 kref_put include/linux/kref.h:65 [inline]
 kobject_put+0x178/0x260 lib/kobject.c:761
 netdev_run_todo+0xc26/0xdc0 net/core/dev.c:10331
 rtnl_unlock net/core/rtnetlink.c:112 [inline]
 rtnetlink_rcv_msg+0x988/0xc50 net/core/rtnetlink.c:5609
 netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2497
 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:5626
 netlink_unicast_kernel net/netlink/af_netlink.c:1322 [inline]
 netlink_unicast+0x8df/0xac0 net/netlink/af_netlink.c:1348
 netlink_sendmsg+0xa46/0xd00 net/netlink/af_netlink.c:1916
 sock_sendmsg_nosec net/socket.c:652 [inline]
 __sock_sendmsg net/socket.c:664 [inline]
 ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2376
 ___sys_sendmsg+0x252/0x2e0 net/socket.c:2430
 __sys_sendmsg net/socket.c:2459 [inline]
 __do_sys_sendmsg net/socket.c:2468 [inline]
 __se_sys_sendmsg+0x1b1/0x280 net/socket.c:2466
 __x64_sys_sendmsg+0x7b/0x90 net/socket.c:2466
 do_syscall_64+0x34/0x70
 entry_SYSCALL_64_after_hwframe+0x61/0xc6

The buggy address belongs to the object at ffff8881210e0000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 256 bytes inside of
 4096-byte region [ffff8881210e0000, ffff8881210e1000)
The buggy address belongs to the page:
page:ffffea0004843800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1210e0
head:ffffea0004843800 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head)
raw: 4000000000010200 dead000000000100 dead000000000122 ffff888100042c00
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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 319, ts 38981947947, free_ts 0
 set_page_owner include/linux/page_owner.h:35 [inline]
 post_alloc_hook mm/page_alloc.c:2456 [inline]
 prep_new_page+0x166/0x180 mm/page_alloc.c:2462
 get_page_from_freelist+0x2d8c/0x2f30 mm/page_alloc.c:4254
 __alloc_pages_nodemask+0x435/0xaf0 mm/page_alloc.c:5346
 allocate_slab mm/slub.c:1808 [inline]
 new_slab+0x80/0x400 mm/slub.c:1869
 new_slab_objects mm/slub.c:2627 [inline]
 ___slab_alloc+0x302/0x4b0 mm/slub.c:2791
 __slab_alloc+0x63/0xa0 mm/slub.c:2831
 slab_alloc_node mm/slub.c:2913 [inline]
 slab_alloc mm/slub.c:2955 [inline]
 kmem_cache_alloc_trace+0x1bd/0x2e0 mm/slub.c:2972
 kmalloc include/linux/slab.h:552 [inline]
 kzalloc include/linux/slab.h:664 [inline]
 snmp6_alloc_dev net/ipv6/addrconf.c:352 [inline]
 ipv6_add_dev+0x579/0x10b0 net/ipv6/addrconf.c:401
 addrconf_notify+0x58e/0xe90 net/ipv6/addrconf.c:3545
 notifier_call_chain kernel/notifier.c:83 [inline]
 raw_notifier_call_chain+0x8c/0xf0 kernel/notifier.c:410
 call_netdevice_notifiers_info net/core/dev.c:2054 [inline]
 call_netdevice_notifiers_extack net/core/dev.c:2066 [inline]
 call_netdevice_notifiers+0x145/0x1b0 net/core/dev.c:2080
 register_netdevice+0x1066/0x13f0 net/core/dev.c:10067
 veth_newlink+0x835/0xb50 drivers/net/veth.c:1387
 __rtnl_newlink net/core/rtnetlink.c:3479 [inline]
 rtnl_newlink+0x1516/0x2000 net/core/rtnetlink.c:3527
 rtnetlink_rcv_msg+0x955/0xc50 net/core/rtnetlink.c:5608
 netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2497
page_owner free stack trace missing

Memory state around the buggy address:
 ffff8881210e0000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881210e0080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8881210e0100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff8881210e0180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881210e0200: 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/01/26 20:43 android13-5.10-lts 1a7db4583e18 cc4a4020 .config console log report syz [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Read in macsec_get_iflink
2024/01/26 20:13 android13-5.10-lts 1a7db4583e18 cc4a4020 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Read in macsec_get_iflink
* Struck through repros no longer work on HEAD.