================================================================== BUG: KASAN: slab-use-after-free in smk_access+0x54/0x148 security/smack/smack_access.c:147 Read at addr f6f000000893ee90 by task syz.0.4284/16981 Pointer tag: [f6], memory tag: [fe] CPU: 0 UID: 0 PID: 16981 Comm: syz.0.4284 Not tainted 6.11.0-syzkaller-05319-g4a39ac5b7d62 #0 Hardware name: linux,dummy-virt (DT) Call trace: dump_backtrace+0x94/0xec arch/arm64/kernel/stacktrace.c:319 show_stack+0x18/0x24 arch/arm64/kernel/stacktrace.c:326 __dump_stack lib/dump_stack.c:93 [inline] dump_stack_lvl+0x78/0x90 lib/dump_stack.c:119 print_address_description mm/kasan/report.c:377 [inline] print_report+0x108/0x618 mm/kasan/report.c:488 kasan_report+0x88/0xac mm/kasan/report.c:601 report_tag_fault arch/arm64/mm/fault.c:332 [inline] do_tag_recovery arch/arm64/mm/fault.c:344 [inline] __do_kernel_fault+0x170/0x1c8 arch/arm64/mm/fault.c:386 do_bad_area arch/arm64/mm/fault.c:486 [inline] do_tag_check_fault+0x78/0x8c arch/arm64/mm/fault.c:803 do_mem_abort+0x44/0x94 arch/arm64/mm/fault.c:879 el1_abort+0x40/0x60 arch/arm64/kernel/entry-common.c:432 el1h_64_sync_handler+0xd8/0xe4 arch/arm64/kernel/entry-common.c:492 el1h_64_sync+0x64/0x68 arch/arm64/kernel/entry.S:593 smk_access+0x54/0x148 security/smack/smack_access.c:147 smack_watch_key+0xe0/0xf8 security/smack/smack_lsm.c:4656 security_watch_key+0x58/0x148 security/security.c:4448 keyctl_watch_key+0xb0/0x1cc security/keys/keyctl.c:1813 __do_sys_keyctl security/keys/keyctl.c:2021 [inline] __se_sys_keyctl security/keys/keyctl.c:1874 [inline] __arm64_sys_keyctl+0x50/0x290 security/keys/keyctl.c:1874 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x48/0x110 arch/arm64/kernel/syscall.c:49 el0_svc_common.constprop.0+0x40/0xe0 arch/arm64/kernel/syscall.c:132 do_el0_svc+0x1c/0x28 arch/arm64/kernel/syscall.c:151 el0_svc+0x34/0xec arch/arm64/kernel/entry-common.c:712 el0t_64_sync_handler+0x100/0x12c arch/arm64/kernel/entry-common.c:730 el0t_64_sync+0x19c/0x1a0 arch/arm64/kernel/entry.S:598 Allocated by task 8868: kasan_save_stack+0x3c/0x64 mm/kasan/common.c:47 save_stack_info+0x40/0x158 mm/kasan/tags.c:106 kasan_save_alloc_info+0x14/0x20 mm/kasan/tags.c:142 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] poison_kmalloc_redzone mm/kasan/common.c:350 [inline] __kasan_kmalloc+0xb4/0xb8 mm/kasan/common.c:394 kasan_kmalloc include/linux/kasan.h:257 [inline] __do_kmalloc_node mm/slub.c:4265 [inline] __kmalloc_node_noprof+0x1c8/0x37c mm/slub.c:4271 kmalloc_node_noprof include/linux/slab.h:905 [inline] __vmalloc_area_node mm/vmalloc.c:3642 [inline] __vmalloc_node_range_noprof+0x1a8/0x858 mm/vmalloc.c:3837 __vmalloc_node_noprof mm/vmalloc.c:3902 [inline] vzalloc_noprof+0x94/0xa4 mm/vmalloc.c:3975 alloc_counters.isra.0+0x20/0x140 net/ipv4/netfilter/ip_tables.c:799 copy_entries_to_user net/ipv4/netfilter/ip_tables.c:821 [inline] get_entries net/ipv4/netfilter/ip_tables.c:1022 [inline] do_ipt_get_ctl+0x27c/0x49c net/ipv4/netfilter/ip_tables.c:1668 nf_getsockopt+0x60/0x8c net/netfilter/nf_sockopt.c:116 ip_getsockopt+0xe8/0x16c net/ipv4/ip_sockglue.c:1777 tcp_getsockopt+0x20/0x48 net/ipv4/tcp.c:4670 sock_common_getsockopt+0x1c/0x28 net/core/sock.c:3776 do_sock_getsockopt+0x148/0x288 net/socket.c:2392 __sys_getsockopt+0x78/0xd0 net/socket.c:2421 __do_sys_getsockopt net/socket.c:2431 [inline] __se_sys_getsockopt net/socket.c:2428 [inline] __arm64_sys_getsockopt+0x24/0x34 net/socket.c:2428 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x48/0x110 arch/arm64/kernel/syscall.c:49 el0_svc_common.constprop.0+0x40/0xe0 arch/arm64/kernel/syscall.c:132 do_el0_svc+0x1c/0x28 arch/arm64/kernel/syscall.c:151 el0_svc+0x34/0xec arch/arm64/kernel/entry-common.c:712 el0t_64_sync_handler+0x100/0x12c arch/arm64/kernel/entry-common.c:730 el0t_64_sync+0x19c/0x1a0 arch/arm64/kernel/entry.S:598 Freed by task 8868: kasan_save_stack+0x3c/0x64 mm/kasan/common.c:47 save_stack_info+0x40/0x158 mm/kasan/tags.c:106 kasan_save_free_info+0x18/0x24 mm/kasan/tags.c:147 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x74/0x8c 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+0x108/0x2fc mm/slub.c:4728 kvfree+0x3c/0x4c mm/util.c:696 vfree+0xf0/0x34c mm/vmalloc.c:3371 copy_entries_to_user net/ipv4/netfilter/ip_tables.c:866 [inline] get_entries net/ipv4/netfilter/ip_tables.c:1022 [inline] do_ipt_get_ctl+0x3c0/0x49c net/ipv4/netfilter/ip_tables.c:1668 nf_getsockopt+0x60/0x8c net/netfilter/nf_sockopt.c:116 ip_getsockopt+0xe8/0x16c net/ipv4/ip_sockglue.c:1777 tcp_getsockopt+0x20/0x48 net/ipv4/tcp.c:4670 sock_common_getsockopt+0x1c/0x28 net/core/sock.c:3776 do_sock_getsockopt+0x148/0x288 net/socket.c:2392 __sys_getsockopt+0x78/0xd0 net/socket.c:2421 __do_sys_getsockopt net/socket.c:2431 [inline] __se_sys_getsockopt net/socket.c:2428 [inline] __arm64_sys_getsockopt+0x24/0x34 net/socket.c:2428 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x48/0x110 arch/arm64/kernel/syscall.c:49 el0_svc_common.constprop.0+0x40/0xe0 arch/arm64/kernel/syscall.c:132 do_el0_svc+0x1c/0x28 arch/arm64/kernel/syscall.c:151 el0_svc+0x34/0xec arch/arm64/kernel/entry-common.c:712 el0t_64_sync_handler+0x100/0x12c arch/arm64/kernel/entry-common.c:730 el0t_64_sync+0x19c/0x1a0 arch/arm64/kernel/entry.S:598 The buggy address belongs to the object at fff000000893ee90 which belongs to the cache kmalloc-16 of size 16 The buggy address is located 0 bytes inside of 16-byte region [fff000000893ee90, fff000000893eea0) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xf4f000000893ee90 pfn:0x4893e flags: 0x1ffc00000000000(node=0|zone=0|lastcpupid=0x7ff|kasantag=0x0) page_type: 0xfdffffff(slab) raw: 01ffc00000000000 f6f0000003001400 dead000000000122 0000000000000000 raw: f4f000000893ee90 00000000810000c0 00000001fdffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: fff000000893ec00: f5 fe fe f1 fe fb fe fe fe f7 fb fe fe f1 fb f3 fff000000893ed00: fe f3 fe fc f4 f5 fe f1 fd fb fe fe fc fe f2 f3 >fff000000893ee00: fe f0 f7 fe fa f3 f6 f6 fc fe f9 fc fb fc f0 fe ^ fff000000893ef00: fe fa f7 fe fe f9 fe f8 fe f6 fe fe fe fe f0 fe fff000000893f000: fe fe fe fe fe fe fe fe fe fe fd fd fd fd fd fe ==================================================================