ntfs3: loop3: Failed to load $Extend. ================================================================== BUG: KASAN: use-after-free in hdr_find_e+0x279/0x5b0 fs/ntfs3/index.c:689 Read of size 2 at addr ffff888037249820 by task syz-executor.3/12103 CPU: 0 PID: 12103 Comm: syz-executor.3 Not tainted 6.0.0-syzkaller-09589-g55be6084c8e0 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 print_address_description+0x65/0x4b0 mm/kasan/report.c:317 print_report+0x108/0x220 mm/kasan/report.c:433 kasan_report+0xfb/0x130 mm/kasan/report.c:495 hdr_find_e+0x279/0x5b0 fs/ntfs3/index.c:689 indx_find+0x4ff/0xb20 fs/ntfs3/index.c:1085 dir_search_u+0x1b2/0x390 fs/ntfs3/dir.c:254 ntfs_lookup+0x112/0x1b0 fs/ntfs3/namei.c:83 lookup_open fs/namei.c:3391 [inline] open_last_lookups fs/namei.c:3481 [inline] path_openat+0x10f8/0x2e00 fs/namei.c:3688 do_filp_open+0x275/0x500 fs/namei.c:3718 do_sys_openat2+0x13b/0x500 fs/open.c:1310 do_sys_open fs/open.c:1326 [inline] __do_sys_creat fs/open.c:1402 [inline] __se_sys_creat fs/open.c:1396 [inline] __x64_sys_creat+0x11f/0x160 fs/open.c:1396 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f582a88b5a9 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f582b917168 EFLAGS: 00000246 ORIG_RAX: 0000000000000055 RAX: ffffffffffffffda RBX: 00007f582a9abf80 RCX: 00007f582a88b5a9 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00000000200001c0 RBP: 00007f582a8e6580 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffdc4a552af R14: 00007f582b917300 R15: 0000000000022000 Allocated by task 3790: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:437 [inline] ____kasan_kmalloc+0xdc/0x110 mm/kasan/common.c:516 kasan_kmalloc include/linux/kasan.h:234 [inline] __kmalloc_node+0x26f/0x420 mm/slub.c:4477 kmalloc_node include/linux/slab.h:623 [inline] kvmalloc_node+0x6e/0x180 mm/util.c:613 kvmalloc include/linux/slab.h:750 [inline] xt_alloc_table_info+0x39/0xa0 net/netfilter/x_tables.c:1192 do_replace net/ipv6/netfilter/ip6_tables.c:1142 [inline] do_ip6t_set_ctl+0xa95/0x3ed0 net/ipv6/netfilter/ip6_tables.c:1639 nf_setsockopt+0x29f/0x2d0 net/netfilter/nf_sockopt.c:101 __sys_setsockopt+0x65d/0xa00 net/socket.c:2252 __do_sys_setsockopt net/socket.c:2263 [inline] __se_sys_setsockopt net/socket.c:2260 [inline] __x64_sys_setsockopt+0xb1/0xc0 net/socket.c:2260 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 3790: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4c/0x70 mm/kasan/common.c:45 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:370 ____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:367 kasan_slab_free include/linux/kasan.h:200 [inline] slab_free_hook mm/slub.c:1759 [inline] slab_free_freelist_hook+0x12e/0x1a0 mm/slub.c:1785 slab_free mm/slub.c:3539 [inline] kfree+0xda/0x210 mm/slub.c:4567 check_copy_size include/linux/thread_info.h:233 [inline] copy_to_user include/linux/uaccess.h:159 [inline] __do_replace+0x829/0xaf0 net/ipv4/netfilter/ip_tables.c:1088 do_replace net/ipv6/netfilter/ip6_tables.c:1157 [inline] do_ip6t_set_ctl+0x2d0c/0x3ed0 net/ipv6/netfilter/ip6_tables.c:1639 nf_setsockopt+0x29f/0x2d0 net/netfilter/nf_sockopt.c:101 __sys_setsockopt+0x65d/0xa00 net/socket.c:2252 __do_sys_setsockopt net/socket.c:2263 [inline] __se_sys_setsockopt net/socket.c:2260 [inline] __x64_sys_setsockopt+0xb1/0xc0 net/socket.c:2260 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38 __kasan_record_aux_stack+0xaf/0xc0 mm/kasan/generic.c:348 insert_work+0x54/0x3e0 kernel/workqueue.c:1358 __queue_work+0xa31/0xce0 kernel/workqueue.c:1517 queue_work_on+0x137/0x240 kernel/workqueue.c:1545 bpf_map_put_with_uref kernel/bpf/syscall.c:657 [inline] bpf_map_release+0x10d/0x120 kernel/bpf/syscall.c:667 __fput+0x3ba/0x880 fs/file_table.c:320 task_work_run+0x146/0x1c0 kernel/task_work.c:177 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0x134/0x160 kernel/entry/common.c:169 exit_to_user_mode_prepare+0xad/0x110 kernel/entry/common.c:201 __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline] syscall_exit_to_user_mode+0x2e/0x60 kernel/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x63/0xcd Second to last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38 __kasan_record_aux_stack+0xaf/0xc0 mm/kasan/generic.c:348 insert_work+0x54/0x3e0 kernel/workqueue.c:1358 __queue_work+0xa31/0xce0 kernel/workqueue.c:1517 queue_work_on+0x137/0x240 kernel/workqueue.c:1545 bpf_map_put_with_uref kernel/bpf/syscall.c:657 [inline] bpf_map_release+0x10d/0x120 kernel/bpf/syscall.c:667 __fput+0x3ba/0x880 fs/file_table.c:320 task_work_run+0x146/0x1c0 kernel/task_work.c:177 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0x134/0x160 kernel/entry/common.c:169 exit_to_user_mode_prepare+0xad/0x110 kernel/entry/common.c:201 __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline] syscall_exit_to_user_mode+0x2e/0x60 kernel/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff888037249800 which belongs to the cache kmalloc-cg-1k of size 1024 The buggy address is located 32 bytes inside of 1024-byte region [ffff888037249800, ffff888037249c00) The buggy address belongs to the physical page: page:ffffea0000dc9200 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88803724c000 pfn:0x37248 head:ffffea0000dc9200 order:3 compound_mapcount:0 compound_pincount:0 memcg:ffff888027c3e901 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea0000e67608 ffffea0000e9f208 ffff88801204c000 raw: ffff88803724c000 000000000010000d 00000001ffffffff ffff888027c3e901 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 3790, tgid 3790 (syz-executor.4), ts 214148138576, free_ts 214138920623 prep_new_page mm/page_alloc.c:2532 [inline] get_page_from_freelist+0x72b/0x7a0 mm/page_alloc.c:4283 __alloc_pages+0x259/0x560 mm/page_alloc.c:5549 alloc_slab_page+0x70/0xf0 mm/slub.c:1829 allocate_slab+0x5e/0x520 mm/slub.c:1974 new_slab mm/slub.c:2034 [inline] ___slab_alloc+0x42e/0xce0 mm/slub.c:3036 __slab_alloc mm/slub.c:3123 [inline] slab_alloc_node mm/slub.c:3214 [inline] __kmalloc_node+0x2cd/0x420 mm/slub.c:4473 kmalloc_node include/linux/slab.h:623 [inline] kvmalloc_node+0x6e/0x180 mm/util.c:613 kvmalloc include/linux/slab.h:750 [inline] xt_alloc_table_info+0x39/0xa0 net/netfilter/x_tables.c:1192 do_replace net/ipv6/netfilter/ip6_tables.c:1142 [inline] do_ip6t_set_ctl+0xa95/0x3ed0 net/ipv6/netfilter/ip6_tables.c:1639 nf_setsockopt+0x29f/0x2d0 net/netfilter/nf_sockopt.c:101 __sys_setsockopt+0x65d/0xa00 net/socket.c:2252 __do_sys_setsockopt net/socket.c:2263 [inline] __se_sys_setsockopt net/socket.c:2260 [inline] __x64_sys_setsockopt+0xb1/0xc0 net/socket.c:2260 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 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:1449 [inline] free_pcp_prepare+0x812/0x900 mm/page_alloc.c:1499 free_unref_page_prepare mm/page_alloc.c:3380 [inline] free_unref_page+0x7d/0x630 mm/page_alloc.c:3476 qlist_free_all+0x2b/0x70 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x169/0x180 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x2f/0xe0 mm/kasan/common.c:447 kasan_slab_alloc include/linux/kasan.h:224 [inline] slab_post_alloc_hook mm/slab.h:727 [inline] slab_alloc_node mm/slub.c:3248 [inline] slab_alloc mm/slub.c:3256 [inline] __kmem_cache_alloc_lru mm/slub.c:3263 [inline] kmem_cache_alloc+0x1a6/0x310 mm/slub.c:3273 getname_flags+0xb8/0x4e0 fs/namei.c:139 user_path_at_empty+0x2a/0x1a0 fs/namei.c:2875 do_readlinkat+0x11b/0x3b0 fs/stat.c:468 __do_sys_readlink fs/stat.c:501 [inline] __se_sys_readlink fs/stat.c:498 [inline] __x64_sys_readlink+0x7b/0x90 fs/stat.c:498 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff888037249700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888037249780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888037249800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888037249880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888037249900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================