================================================================== BUG: KASAN: use-after-free in ntfs_trim_fs+0x84f/0x950 fs/ntfs3/bitmap.c:1434 Read of size 2 at addr ffff888024ba6980 by task syz-executor.1/6522 CPU: 0 PID: 6522 Comm: syz-executor.1 Not tainted 6.1.0-rc8-syzkaller-00152-g3ecc37918c80 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:284 [inline] print_report+0x15e/0x461 mm/kasan/report.c:395 kasan_report+0xbf/0x1f0 mm/kasan/report.c:495 ntfs_trim_fs+0x84f/0x950 fs/ntfs3/bitmap.c:1434 ntfs_ioctl_fitrim+0x23e/0x340 fs/ntfs3/file.c:40 ntfs_ioctl+0xa0/0xe0 fs/ntfs3/file.c:57 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl fs/ioctl.c:856 [inline] __x64_sys_ioctl+0x197/0x210 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fdad1a8c0d9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fdad2761168 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007fdad1babf80 RCX: 00007fdad1a8c0d9 RDX: 0000000020000040 RSI: 00000000c0185879 RDI: 0000000000000004 RBP: 00007fdad1ae7ae9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffc5b2fa62f R14: 00007fdad2761300 R15: 0000000000022000 Allocated by task 3765: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:371 [inline] ____kasan_kmalloc mm/kasan/common.c:330 [inline] __kasan_kmalloc+0xa3/0xb0 mm/kasan/common.c:380 kasan_kmalloc include/linux/kasan.h:211 [inline] __do_kmalloc_node mm/slab_common.c:955 [inline] __kmalloc_node_track_caller+0x5b/0xc0 mm/slab_common.c:975 kstrdup+0x3f/0x70 mm/util.c:61 security_netlbl_sid_to_secattr+0x1d2/0x460 security/selinux/ss/services.c:3973 selinux_netlbl_sock_genattr+0xf0/0x4b0 security/selinux/netlabel.c:80 selinux_netlbl_socket_post_create+0x77/0x160 security/selinux/netlabel.c:401 selinux_socket_post_create+0x2e7/0x800 security/selinux/hooks.c:4605 security_socket_post_create+0x68/0xc0 security/security.c:2198 __sock_create+0x650/0x790 net/socket.c:1531 sock_create net/socket.c:1566 [inline] __sys_socket_create net/socket.c:1603 [inline] __sys_socket_create net/socket.c:1588 [inline] __sys_socket+0x133/0x250 net/socket.c:1636 __do_sys_socket net/socket.c:1649 [inline] __se_sys_socket net/socket.c:1647 [inline] __x64_sys_socket+0x73/0xb0 net/socket.c:1647 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 3765: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:511 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x13b/0x1a0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:177 [inline] __cache_free mm/slab.c:3389 [inline] __do_kmem_cache_free mm/slab.c:3585 [inline] __kmem_cache_free+0xcd/0x3b0 mm/slab.c:3592 netlbl_secattr_destroy include/net/netlabel.h:364 [inline] netlbl_secattr_free include/net/netlabel.h:395 [inline] selinux_netlbl_sk_security_free+0x213/0x390 security/selinux/netlabel.c:159 selinux_sk_free_security+0x46/0x60 security/selinux/hooks.c:5208 security_sk_free+0x42/0x80 security/security.c:2291 sk_prot_free net/core/sock.c:2062 [inline] __sk_destruct+0x4c3/0x710 net/core/sock.c:2152 sk_destruct net/core/sock.c:2167 [inline] __sk_free+0x175/0x460 net/core/sock.c:2178 sk_free+0x7c/0xa0 net/core/sock.c:2189 sock_put include/net/sock.h:1987 [inline] tcp_close+0x9c/0xc0 net/ipv4/tcp.c:3034 inet_release+0x132/0x270 net/ipv4/af_inet.c:428 __sock_release+0xcd/0x280 net/socket.c:650 sock_close+0x1c/0x20 net/socket.c:1365 __fput+0x27c/0xa90 fs/file_table.c:320 task_work_run+0x16f/0x270 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x23c/0x250 kernel/entry/common.c:203 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:296 do_syscall_64+0x46/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff888024ba6980 which belongs to the cache kmalloc-32 of size 32 The buggy address is located 0 bytes inside of 32-byte region [ffff888024ba6980, ffff888024ba69a0) The buggy address belongs to the physical page: page:ffffea000092e980 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888024ba6fc1 pfn:0x24ba6 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea00009b4f88 ffffea00006ede08 ffff888012040100 raw: ffff888024ba6fc1 ffff888024ba6000 0000000100000036 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 0x2420c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_COMP|__GFP_THISNODE), pid 3758, tgid 3758 (syz-executor.3), ts 271325983745, free_ts 271166456833 prep_new_page mm/page_alloc.c:2539 [inline] get_page_from_freelist+0x10b5/0x2d50 mm/page_alloc.c:4291 __alloc_pages_slowpath.constprop.0+0x36b/0x23d0 mm/page_alloc.c:5092 __alloc_pages+0x4aa/0x5b0 mm/page_alloc.c:5571 __alloc_pages_node include/linux/gfp.h:237 [inline] kmem_getpages mm/slab.c:1363 [inline] cache_grow_begin+0x94/0x390 mm/slab.c:2570 cache_alloc_refill+0x27f/0x380 mm/slab.c:2943 ____cache_alloc mm/slab.c:3019 [inline] ____cache_alloc mm/slab.c:3002 [inline] __do_cache_alloc mm/slab.c:3202 [inline] slab_alloc_node mm/slab.c:3250 [inline] __kmem_cache_alloc_node+0x44a/0x510 mm/slab.c:3549 kmalloc_trace+0x26/0x60 mm/slab_common.c:1045 kmalloc include/linux/slab.h:553 [inline] kzalloc include/linux/slab.h:689 [inline] ref_tracker_alloc+0x150/0x550 lib/ref_tracker.c:85 netns_tracker_alloc include/net/net_namespace.h:327 [inline] get_net_track include/net/net_namespace.h:343 [inline] sk_alloc+0x202/0x780 net/core/sock.c:2095 inet_create net/ipv4/af_inet.c:319 [inline] inet_create+0x399/0xea0 net/ipv4/af_inet.c:245 __sock_create+0x359/0x790 net/socket.c:1515 sock_create net/socket.c:1566 [inline] __sys_socket_create net/socket.c:1603 [inline] __sys_socket_create net/socket.c:1588 [inline] __sys_socket+0x133/0x250 net/socket.c:1636 __do_sys_socket net/socket.c:1649 [inline] __se_sys_socket net/socket.c:1647 [inline] __x64_sys_socket+0x73/0xb0 net/socket.c:1647 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/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:1459 [inline] free_pcp_prepare+0x65c/0xd90 mm/page_alloc.c:1509 free_unref_page_prepare mm/page_alloc.c:3387 [inline] free_unref_page+0x1d/0x4d0 mm/page_alloc.c:3483 __folio_put_small mm/swap.c:105 [inline] __folio_put+0xc5/0x140 mm/swap.c:128 folio_put include/linux/mm.h:1159 [inline] put_page include/linux/mm.h:1211 [inline] free_page_and_swap_cache+0x257/0x2c0 mm/swap_state.c:299 __tlb_remove_table arch/x86/include/asm/tlb.h:34 [inline] __tlb_remove_table_free mm/mmu_gather.c:115 [inline] tlb_remove_table_rcu+0x89/0xe0 mm/mmu_gather.c:170 rcu_do_batch kernel/rcu/tree.c:2250 [inline] rcu_core+0x81f/0x1980 kernel/rcu/tree.c:2510 __do_softirq+0x1fb/0xadc kernel/softirq.c:571 Memory state around the buggy address: ffff888024ba6880: 00 fc fc fc fc fc fc fc fa fb fb fb fc fc fc fc ffff888024ba6900: fa fb fb fb fc fc fc fc 02 fc fc fc fc fc fc fc >ffff888024ba6980: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc ^ ffff888024ba6a00: 00 00 fc fc fc fc fc fc fa fb fb fb fc fc fc fc ffff888024ba6a80: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc ==================================================================