================================================================== BUG: KASAN: use-after-free in kill_fasync+0x45e/0x470 fs/fcntl.c:1014 Read of size 8 at addr ffff888046c65968 by task kworker/1:0/7625 CPU: 1 PID: 7625 Comm: kworker/1:0 Not tainted 5.19.0-rc6-syzkaller-00115-g4a57a8400075 #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/0x467 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 11465: 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+0xa6/0xd0 mm/kasan/common.c:524 kasan_kmalloc include/linux/kasan.h:234 [inline] kmem_cache_alloc_trace+0x1ea/0x4a0 mm/slab.c:3569 kmalloc include/linux/slab.h:600 [inline] kzalloc include/linux/slab.h:733 [inline] alloc_pipe_info+0x10e/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 11462: 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+0x13d/0x180 mm/kasan/common.c:328 kasan_slab_free include/linux/kasan.h:200 [inline] __cache_free mm/slab.c:3425 [inline] kfree+0x113/0x310 mm/slab.c:3796 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 The buggy address belongs to the object at ffff888046c65800 which belongs to the cache kmalloc-cg-512 of size 512 The buggy address is located 360 bytes inside of 512-byte region [ffff888046c65800, ffff888046c65a00) The buggy address belongs to the physical page: page:ffffea00011b1940 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888046c65000 pfn:0x46c65 memcg:ffff888056320cc1 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea0001808548 ffffea0001e7f2c8 ffff888011843a00 raw: ffff888046c65000 ffff888046c65000 0000000100000002 ffff888056320cc1 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x3460c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_RETRY_MAYFAIL|__GFP_COMP|__GFP_HARDWALL|__GFP_THISNODE), pid 10515, tgid 10509 (syz-executor.5), ts 2083243373468, free_ts 2083027220555 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_node include/linux/gfp.h:587 [inline] kmem_getpages mm/slab.c:1363 [inline] cache_grow_begin+0x75/0x350 mm/slab.c:2569 cache_alloc_refill+0x27f/0x380 mm/slab.c:2942 ____cache_alloc mm/slab.c:3024 [inline] ____cache_alloc mm/slab.c:3007 [inline] slab_alloc_node mm/slab.c:3227 [inline] kmem_cache_alloc_node_trace+0x518/0x5b0 mm/slab.c:3611 __do_kmalloc_node mm/slab.c:3633 [inline] __kmalloc_node+0x38/0x60 mm/slab.c:3641 kmalloc_node include/linux/slab.h:623 [inline] kvmalloc_node+0x3e/0x190 mm/util.c:613 kvmalloc include/linux/slab.h:750 [inline] kvzalloc include/linux/slab.h:758 [inline] netif_alloc_netdev_queues net/core/dev.c:9910 [inline] alloc_netdev_mqs+0x9ba/0x1180 net/core/dev.c:10639 vti6_init_net+0x213/0x860 net/ipv6/ip6_vti.c:1152 ops_init+0xaf/0x470 net/core/net_namespace.c:134 setup_net+0x5d1/0xc50 net/core/net_namespace.c:325 copy_net_ns+0x318/0x760 net/core/net_namespace.c:471 create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110 unshare_nsproxy_namespaces+0xc1/0x1f0 kernel/nsproxy.c:226 ksys_unshare+0x445/0x920 kernel/fork.c:3165 __do_sys_unshare kernel/fork.c:3236 [inline] __se_sys_unshare kernel/fork.c:3234 [inline] __x64_sys_unshare+0x2d/0x40 kernel/fork.c:3234 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 __put_single_page mm/swap.c:106 [inline] __put_page+0x145/0x280 mm/swap.c:129 folio_put include/linux/mm.h:1200 [inline] put_page include/linux/mm.h:1233 [inline] aio_free_ring+0x58b/0x7b0 fs/aio.c:345 free_ioctx+0x22/0xa0 fs/aio.c:615 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 Memory state around the buggy address: ffff888046c65800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888046c65880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888046c65900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888046c65980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888046c65a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================