================================================================== BUG: KASAN: slab-use-after-free in smk_access+0xae/0x4e0 security/smack/smack_access.c:147 Read of size 8 at addr ffff88804f806f60 by task syz.1.1657/12271 CPU: 0 UID: 0 PID: 12271 Comm: syz.1.1657 Not tainted 6.11.0-syzkaller-07262-g839c4f596f89 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 Call Trace: __dump_stack lib/dump_stack.c:93 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:119 print_address_description mm/kasan/report.c:377 [inline] print_report+0x169/0x550 mm/kasan/report.c:488 kasan_report+0x143/0x180 mm/kasan/report.c:601 smk_access+0xae/0x4e0 security/smack/smack_access.c:147 smack_watch_key+0x2f4/0x3a0 security/smack/smack_lsm.c:4656 security_watch_key+0x86/0x250 security/security.c:4448 keyctl_watch_key+0x2b7/0x480 security/keys/keyctl.c:1813 __do_sys_keyctl security/keys/keyctl.c:2021 [inline] __se_sys_keyctl+0x106/0xa50 security/keys/keyctl.c:1874 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f394197def9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f3942818038 EFLAGS: 00000246 ORIG_RAX: 00000000000000fa RAX: ffffffffffffffda RBX: 00007f3941b35f80 RCX: 00007f394197def9 RDX: 0000000000000009 RSI: 000000002995cac5 RDI: 0000000000000020 RBP: 00007f39419f0b76 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f3941b35f80 R15: 00007ffd6c9958d8 Allocated by task 12239: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:394 kasan_kmalloc include/linux/kasan.h:257 [inline] __do_kmalloc_node mm/slub.c:4265 [inline] __kmalloc_node_track_caller_noprof+0x225/0x440 mm/slub.c:4284 kstrdup+0x3a/0x80 mm/util.c:64 __kernfs_new_node+0x9d/0x870 fs/kernfs/dir.c:620 kernfs_new_node+0x137/0x240 fs/kernfs/dir.c:700 __kernfs_create_file+0x49/0x2e0 fs/kernfs/file.c:1034 sysfs_add_file_mode_ns+0x24a/0x310 fs/sysfs/file.c:307 create_files fs/sysfs/group.c:76 [inline] internal_create_group+0x7a7/0x11d0 fs/sysfs/group.c:180 internal_create_groups fs/sysfs/group.c:220 [inline] sysfs_create_groups+0x56/0x120 fs/sysfs/group.c:246 setup_gid_attrs drivers/infiniband/core/sysfs.c:1173 [inline] ib_setup_port_attrs+0x16a4/0x2440 drivers/infiniband/core/sysfs.c:1450 add_one_compat_dev+0x51a/0x710 drivers/infiniband/core/device.c:975 rdma_dev_init_net+0x1f1/0x280 drivers/infiniband/core/device.c:1191 ops_init+0x31e/0x590 net/core/net_namespace.c:139 setup_net+0x287/0x9e0 net/core/net_namespace.c:356 copy_net_ns+0x33f/0x570 net/core/net_namespace.c:494 create_new_namespaces+0x425/0x7b0 kernel/nsproxy.c:110 copy_namespaces+0x41a/0x490 kernel/nsproxy.c:179 copy_process+0x1938/0x3d80 kernel/fork.c:2376 kernel_clone+0x223/0x880 kernel/fork.c:2780 __do_sys_clone kernel/fork.c:2923 [inline] __se_sys_clone kernel/fork.c:2907 [inline] __x64_sys_clone+0x258/0x2a0 kernel/fork.c:2907 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 24: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:579 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x59/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:2343 [inline] slab_free mm/slub.c:4580 [inline] kfree+0x1a1/0x440 mm/slub.c:4728 kernfs_free_rcu+0x3f/0x100 fs/kernfs/dir.c:536 rcu_do_batch kernel/rcu/tree.c:2567 [inline] rcu_core+0xaaa/0x17a0 kernel/rcu/tree.c:2823 handle_softirqs+0x2c5/0x980 kernel/softirq.c:554 run_ksoftirqd+0xca/0x130 kernel/softirq.c:927 smpboot_thread_fn+0x544/0xa30 kernel/smpboot.c:164 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 The buggy address belongs to the object at ffff88804f806f60 which belongs to the cache kmalloc-8 of size 8 The buggy address is located 0 bytes inside of freed 8-byte region [ffff88804f806f60, ffff88804f806f68) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x4f806 anon flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: 0xfdffffff(slab) raw: 00fff00000000000 ffff88801ac41500 0000000000000000 dead000000000001 raw: 0000000000000000 0000000080800080 00000001fdffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x52cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 8351, tgid 8345 (syz.0.675), ts 402287381338, free_ts 396618283394 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1500 prep_new_page mm/page_alloc.c:1508 [inline] get_page_from_freelist+0x2e4c/0x2f10 mm/page_alloc.c:3446 __alloc_pages_noprof+0x256/0x6c0 mm/page_alloc.c:4702 alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2263 alloc_slab_page+0x6a/0x130 mm/slub.c:2413 allocate_slab+0x5a/0x2f0 mm/slub.c:2579 new_slab mm/slub.c:2632 [inline] ___slab_alloc+0xcd1/0x14b0 mm/slub.c:3819 __slab_alloc+0x58/0xa0 mm/slub.c:3909 __slab_alloc_node mm/slub.c:3962 [inline] slab_alloc_node mm/slub.c:4123 [inline] __do_kmalloc_node mm/slub.c:4264 [inline] __kmalloc_node_track_caller_noprof+0x281/0x440 mm/slub.c:4284 kstrdup+0x3a/0x80 mm/util.c:64 __kernfs_new_node+0x9d/0x870 fs/kernfs/dir.c:620 kernfs_new_node+0x137/0x240 fs/kernfs/dir.c:700 __kernfs_create_file+0x49/0x2e0 fs/kernfs/file.c:1034 sysfs_add_file_mode_ns+0x24a/0x310 fs/sysfs/file.c:307 create_files fs/sysfs/group.c:76 [inline] internal_create_group+0x7a7/0x11d0 fs/sysfs/group.c:180 internal_create_groups fs/sysfs/group.c:220 [inline] sysfs_create_groups+0x56/0x120 fs/sysfs/group.c:246 page last free pid 141 tgid 141 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1101 [inline] free_unref_page+0xd19/0xea0 mm/page_alloc.c:2619 __slab_free+0x31b/0x3d0 mm/slub.c:4491 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x9e/0x140 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x14f/0x170 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x23/0x80 mm/kasan/common.c:329 kasan_slab_alloc include/linux/kasan.h:247 [inline] slab_post_alloc_hook mm/slub.c:4086 [inline] slab_alloc_node mm/slub.c:4135 [inline] __kmalloc_cache_noprof+0x132/0x2c0 mm/slub.c:4291 kmalloc_noprof include/linux/slab.h:878 [inline] kzalloc_noprof include/linux/slab.h:1004 [inline] ref_tracker_alloc+0x14b/0x490 lib/ref_tracker.c:203 __netns_tracker_alloc include/net/net_namespace.h:331 [inline] netlink_release+0x1614/0x1b10 net/netlink/af_netlink.c:820 __sock_release net/socket.c:659 [inline] sock_release+0x82/0x150 net/socket.c:687 uevent_net_exit+0xc4/0x1e0 lib/kobject_uevent.c:812 ops_exit_list net/core/net_namespace.c:173 [inline] cleanup_net+0x802/0xcc0 net/core/net_namespace.c:626 process_one_work kernel/workqueue.c:3229 [inline] process_scheduled_works+0xa63/0x1850 kernel/workqueue.c:3310 worker_thread+0x870/0xd30 kernel/workqueue.c:3391 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Memory state around the buggy address: ffff88804f806e00: fa fc fc fc fa fc fc fc 05 fc fc fc 05 fc fc fc ffff88804f806e80: fa fc fc fc 05 fc fc fc fa fc fc fc fa fc fc fc >ffff88804f806f00: fa fc fc fc fa fc fc fc 00 fc fc fc fa fc fc fc ^ ffff88804f806f80: fa fc fc fc fa fc fc fc fa fc fc fc fa fc fc fc ffff88804f807000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ==================================================================