================================================================== BUG: KASAN: use-after-free in kill_fasync+0x45e/0x470 fs/fcntl.c:1014 Read of size 8 at addr ffff8880641ca168 by task kworker/1:17/9794 CPU: 1 PID: 9794 Comm: kworker/1:17 Not tainted 5.19.0-rc6-syzkaller-00111-gb047602d579b #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/29/2022 Workqueue: events key_garbage_collector Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0xeb/0x495 mm/kasan/report.c:313 print_report mm/kasan/report.c:429 [inline] kasan_report.cold+0xf4/0x1c6 mm/kasan/report.c:491 kill_fasync+0x45e/0x470 fs/fcntl.c:1014 post_one_notification.isra.0+0x6e4/0x990 kernel/watch_queue.c:128 remove_watch_from_object+0x35a/0x9d0 kernel/watch_queue.c:527 remove_watch_list include/linux/watch_queue.h:115 [inline] key_gc_unused_keys.constprop.0+0x2e5/0x600 security/keys/gc.c:135 key_garbage_collector+0x3d7/0x920 security/keys/gc.c:297 process_one_work+0x996/0x1610 kernel/workqueue.c:2289 worker_thread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2e9/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 Allocated by task 12918: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:436 [inline] ____kasan_kmalloc mm/kasan/common.c:515 [inline] ____kasan_kmalloc mm/kasan/common.c:474 [inline] __kasan_kmalloc+0xa9/0xd0 mm/kasan/common.c:524 kmalloc include/linux/slab.h:600 [inline] kzalloc include/linux/slab.h:733 [inline] alloc_pipe_info+0x105/0x590 fs/pipe.c:790 get_pipe_inode fs/pipe.c:881 [inline] create_pipe_files+0x8d/0x880 fs/pipe.c:913 __do_pipe_flags fs/pipe.c:962 [inline] do_pipe2+0x96/0x1b0 fs/pipe.c:1010 __do_sys_pipe2 fs/pipe.c:1028 [inline] __se_sys_pipe2 fs/pipe.c:1026 [inline] __x64_sys_pipe2+0x50/0x70 fs/pipe.c:1026 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 12916: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:45 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free+0x166/0x1a0 mm/kasan/common.c:328 kasan_slab_free include/linux/kasan.h:200 [inline] slab_free_hook mm/slub.c:1754 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1780 slab_free mm/slub.c:3536 [inline] kfree+0xd6/0x4d0 mm/slub.c:4584 put_pipe_info fs/pipe.c:711 [inline] pipe_release+0x2b6/0x310 fs/pipe.c:734 __fput+0x277/0x9d0 fs/file_table.c:317 task_work_run+0xdd/0x1a0 kernel/task_work.c:177 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:169 [inline] exit_to_user_mode_prepare+0x23c/0x250 kernel/entry/common.c:201 __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline] syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:294 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd Last potentially related work creation: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 __kasan_record_aux_stack+0xbe/0xd0 mm/kasan/generic.c:348 kvfree_call_rcu+0x74/0x990 kernel/rcu/tree.c:3647 inet6_ifa_finish_destroy+0x153/0x1b0 net/ipv6/addrconf.c:987 in6_ifa_put include/net/addrconf.h:416 [inline] addrconf_ifdown.isra.0+0x14bf/0x1830 net/ipv6/addrconf.c:3882 addrconf_notify+0xeb/0x1ba0 net/ipv6/addrconf.c:3669 notifier_call_chain+0xb5/0x200 kernel/notifier.c:87 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:1945 call_netdevice_notifiers_extack net/core/dev.c:1983 [inline] call_netdevice_notifiers net/core/dev.c:1997 [inline] __dev_notify_flags+0x1da/0x2b0 net/core/dev.c:8573 dev_change_flags+0x112/0x170 net/core/dev.c:8609 do_setlink+0x961/0x3bb0 net/core/rtnetlink.c:2780 rtnl_group_changelink net/core/rtnetlink.c:3302 [inline] __rtnl_newlink+0xb96/0x17e0 net/core/rtnetlink.c:3556 rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3593 rtnetlink_rcv_msg+0x43a/0xc90 net/core/rtnetlink.c:6089 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2501 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline] netlink_unicast+0x543/0x7f0 net/netlink/af_netlink.c:1345 netlink_sendmsg+0x917/0xe10 net/netlink/af_netlink.c:1921 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:734 ____sys_sendmsg+0x6eb/0x810 net/socket.c:2488 ___sys_sendmsg+0xf3/0x170 net/socket.c:2542 __sys_sendmsg net/socket.c:2571 [inline] __do_sys_sendmsg net/socket.c:2580 [inline] __se_sys_sendmsg net/socket.c:2578 [inline] __x64_sys_sendmsg+0x132/0x220 net/socket.c:2578 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Second to last potentially related work creation: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 __kasan_record_aux_stack+0xbe/0xd0 mm/kasan/generic.c:348 insert_work+0x48/0x350 kernel/workqueue.c:1358 __queue_work+0x62f/0x1150 kernel/workqueue.c:1517 call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1474 expire_timers kernel/time/timer.c:1514 [inline] __run_timers.part.0+0x4a3/0xa80 kernel/time/timer.c:1790 __run_timers kernel/time/timer.c:1768 [inline] run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1803 __do_softirq+0x29b/0x9c2 kernel/softirq.c:571 The buggy address belongs to the object at ffff8880641ca000 which belongs to the cache kmalloc-cg-512 of size 512 The buggy address is located 360 bytes inside of 512-byte region [ffff8880641ca000, ffff8880641ca200) The buggy address belongs to the physical page: page:ffffea0001907200 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff8880641cac00 pfn:0x641c8 head:ffffea0001907200 order:2 compound_mapcount:0 compound_pincount:0 memcg:ffff888026101b01 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 dead000000000100 dead000000000122 ffff888011842dc0 raw: ffff8880641cac00 000000008010000c 00000001ffffffff ffff888026101b01 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 2962, tgid 2962 (klogd), ts 149476898035, free_ts 149452105636 prep_new_page mm/page_alloc.c:2456 [inline] get_page_from_freelist+0x1290/0x3b70 mm/page_alloc.c:4198 __alloc_pages+0x1c7/0x510 mm/page_alloc.c:5426 alloc_pages+0x1aa/0x310 mm/mempolicy.c:2272 alloc_slab_page mm/slub.c:1824 [inline] allocate_slab+0x26c/0x3c0 mm/slub.c:1969 new_slab mm/slub.c:2029 [inline] ___slab_alloc+0x9c4/0xe20 mm/slub.c:3031 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3118 slab_alloc_node mm/slub.c:3209 [inline] __kmalloc_node_track_caller+0x2cb/0x360 mm/slub.c:4979 kmalloc_reserve net/core/skbuff.c:354 [inline] __alloc_skb+0xde/0x340 net/core/skbuff.c:426 alloc_skb include/linux/skbuff.h:1426 [inline] alloc_skb_with_frags+0x93/0x730 net/core/skbuff.c:5992 sock_alloc_send_pskb+0x793/0x920 net/core/sock.c:2662 unix_dgram_sendmsg+0x425/0x1ad0 net/unix/af_unix.c:1895 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:734 __sys_sendto+0x21a/0x320 net/socket.c:2119 __do_sys_sendto net/socket.c:2131 [inline] __se_sys_sendto net/socket.c:2127 [inline] __x64_sys_sendto+0xdd/0x1b0 net/socket.c:2127 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1371 [inline] free_pcp_prepare+0x549/0xd20 mm/page_alloc.c:1421 free_unref_page_prepare mm/page_alloc.c:3343 [inline] free_unref_page+0x19/0x6a0 mm/page_alloc.c:3438 __stack_depot_save+0x168/0x500 lib/stackdepot.c:450 kasan_save_stack+0x2e/0x40 mm/kasan/common.c:39 kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:436 [inline] ____kasan_kmalloc mm/kasan/common.c:515 [inline] ____kasan_kmalloc mm/kasan/common.c:474 [inline] __kasan_kmalloc+0xa9/0xd0 mm/kasan/common.c:524 kmalloc include/linux/slab.h:600 [inline] kzalloc include/linux/slab.h:733 [inline] br_multicast_new_group.part.0+0x134/0x6c0 net/bridge/br_multicast.c:1167 br_multicast_new_group net/bridge/br_multicast.c:1375 [inline] __br_multicast_add_group+0x3af/0x610 net/bridge/br_multicast.c:1365 br_multicast_add_group net/bridge/br_multicast.c:1414 [inline] br_ip6_multicast_add_group.part.0+0x190/0x270 net/bridge/br_multicast.c:1466 br_ip6_multicast_add_group net/bridge/br_multicast.c:2801 [inline] br_ip6_multicast_mld2_report net/bridge/br_multicast.c:2800 [inline] br_multicast_ipv6_rcv net/bridge/br_multicast.c:3738 [inline] br_multicast_rcv+0xcbf/0x66f0 net/bridge/br_multicast.c:3796 br_handle_frame_finish+0x6d2/0x1a80 net/bridge/br_input.c:131 br_nf_hook_thresh+0x2f8/0x3d0 net/bridge/br_netfilter_hooks.c:1039 br_nf_pre_routing_finish_ipv6+0x67b/0xdf0 net/bridge/br_netfilter_ipv6.c:206 NF_HOOK include/linux/netfilter.h:307 [inline] br_nf_pre_routing_ipv6+0x42d/0x7b0 net/bridge/br_netfilter_ipv6.c:236 br_nf_pre_routing+0x14ad/0x1f00 net/bridge/br_netfilter_hooks.c:505 nf_hook_entry_hookfn include/linux/netfilter.h:142 [inline] nf_hook_bridge_pre net/bridge/br_input.c:255 [inline] br_handle_frame+0x8df/0x1280 net/bridge/br_input.c:399 __netif_receive_skb_core+0xa13/0x3920 net/core/dev.c:5374 Memory state around the buggy address: ffff8880641ca000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880641ca080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880641ca100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880641ca180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880641ca200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================