================================================================== BUG: KASAN: slab-use-after-free in ecryptfs_write_tag_70_packet+0x117b/0x1410 fs/ecryptfs/keystore.c:742 Read of size 4 at addr ffff8880386f6c98 by task syz.2.527/7934 CPU: 0 UID: 0 PID: 7934 Comm: syz.2.527 Tainted: G L syzkaller #0 PREEMPT(full) Tainted: [L]=SOFTLOCKUP Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x13d/0x4b0 mm/kasan/report.c:482 kasan_report+0xdf/0x1c0 mm/kasan/report.c:595 ecryptfs_write_tag_70_packet+0x117b/0x1410 fs/ecryptfs/keystore.c:742 ecryptfs_encrypt_filename fs/ecryptfs/crypto.c:1378 [inline] ecryptfs_encrypt_and_encode_filename+0x428/0xa60 fs/ecryptfs/crypto.c:1789 ecryptfs_lookup+0x1f7/0x830 fs/ecryptfs/inode.c:402 __lookup_slow+0x155/0x320 fs/namei.c:1919 lookup_slow+0x50/0x70 fs/namei.c:1936 walk_component fs/namei.c:2282 [inline] lookup_last fs/namei.c:2789 [inline] path_lookupat+0x5e8/0xc40 fs/namei.c:2813 do_o_path fs/namei.c:4971 [inline] path_openat+0x1766/0x2440 fs/namei.c:4993 do_file_open+0x20e/0x430 fs/namei.c:5029 do_sys_openat2+0x10f/0x1e0 fs/open.c:1417 do_sys_open fs/open.c:1423 [inline] __do_sys_open fs/open.c:1431 [inline] __se_sys_open fs/open.c:1427 [inline] __x64_sys_open+0xfe/0x1d0 fs/open.c:1427 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x123/0x790 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f49d0b9e199 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f49d1aae028 EFLAGS: 00000246 ORIG_RAX: 0000000000000002 RAX: ffffffffffffffda RBX: 00007f49d0e25fa0 RCX: 00007f49d0b9e199 RDX: 000000000000002f RSI: 000000000061e000 RDI: 0000200000000340 RBP: 00007f49d0c35888 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f49d0e26038 R14: 00007f49d0e25fa0 R15: 00007ffdcbdd1248 Allocated by task 7785: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 poison_kmalloc_redzone mm/kasan/common.c:409 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:426 kasan_kmalloc include/linux/kasan.h:263 [inline] __kmalloc_cache_noprof+0x2f8/0x6d0 mm/slub.c:5563 _kmalloc_noprof include/linux/slab.h:991 [inline] _kzalloc_noprof include/linux/slab.h:1312 [inline] snd_seq_timer_new+0x44/0x1a0 sound/core/seq/seq_timer.c:46 queue_new sound/core/seq/seq_queue.c:104 [inline] snd_seq_queue_alloc+0x177/0x540 sound/core/seq/seq_queue.c:164 snd_seq_ioctl_create_queue+0xa9/0x370 sound/core/seq/seq_clientmgr.c:1572 snd_seq_ioctl+0x219/0x410 sound/core/seq/seq_clientmgr.c:2297 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl fs/ioctl.c:583 [inline] __x64_sys_ioctl+0x18e/0x210 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x123/0x790 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 7784: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 kasan_save_free_info+0x3b/0x70 mm/kasan/generic.c:584 poison_slab_object mm/kasan/common.c:264 [inline] __kasan_slab_free+0x5f/0x80 mm/kasan/common.c:296 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:2748 [inline] slab_free mm/slub.c:6509 [inline] kfree+0x22b/0x6d0 mm/slub.c:6802 snd_seq_timer_delete+0x235/0x340 sound/core/seq/seq_timer.c:87 queue_delete+0x83/0xa0 sound/core/seq/seq_queue.c:133 snd_seq_queue_client_leave+0x3d/0x270 sound/core/seq/seq_queue.c:524 seq_free_client1.part.0+0x10a/0x260 sound/core/seq/seq_clientmgr.c:265 seq_free_client1 sound/core/seq/seq_clientmgr.c:258 [inline] seq_free_client+0x72/0xe0 sound/core/seq/seq_clientmgr.c:292 snd_seq_release+0x4a/0xe0 sound/core/seq/seq_clientmgr.c:367 __fput+0x3ff/0xb50 fs/file_table.c:512 task_work_run+0x150/0x240 kernel/task_work.c:233 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] __exit_to_user_mode_loop kernel/entry/common.c:70 [inline] exit_to_user_mode_loop+0x1d8/0x700 kernel/entry/common.c:101 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline] syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:230 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:343 [inline] do_syscall_64+0x661/0x790 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff8880386f6c00 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 152 bytes inside of freed 256-byte region [ffff8880386f6c00, ffff8880386f6d00) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x386f6 head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff88801d042b40 dead000000000100 dead000000000122 raw: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000 head: 00fff00000000040 ffff88801d042b40 dead000000000100 dead000000000122 head: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000 head: 00fff00000000001 ffffffffffffff81 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000002 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 1, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5922, tgid 5922 (syz.0.16), ts 49341909174 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1871 prep_new_page mm/page_alloc.c:1879 [inline] get_page_from_freelist+0x110d/0x35d0 mm/page_alloc.c:3943 __alloc_frozen_pages_noprof+0x2eb/0x3300 mm/page_alloc.c:5436 alloc_slab_page mm/slub.c:3347 [inline] allocate_slab mm/slub.c:3462 [inline] new_slab+0xa9/0x6e0 mm/slub.c:3513 refill_objects+0xe3/0x410 mm/slub.c:7418 refill_sheaf mm/slub.c:2885 [inline] __pcs_replace_empty_main+0x35e/0x650 mm/slub.c:4774 alloc_from_pcs mm/slub.c:4850 [inline] slab_alloc_node mm/slub.c:4984 [inline] __do_kmalloc_node mm/slub.c:5413 [inline] __kmalloc_flags_noprof+0x6a9/0x8e0 mm/slub.c:5602 _kmalloc_flags_noprof mm/slab.h:55 [inline] alloc_slab_obj_exts+0x6a/0x170 mm/slub.c:2186 __memcg_slab_post_alloc_hook+0x3fc/0x10c0 mm/memcontrol.c:3649 memcg_slab_post_alloc_hook mm/slub.c:2517 [inline] slab_post_alloc_hook mm/slub.c:4702 [inline] slab_alloc_node mm/slub.c:4996 [inline] kmem_cache_alloc_noprof+0x4fa/0x6a0 mm/slub.c:5010 anon_vma_alloc mm/rmap.c:94 [inline] __anon_vma_prepare+0x35a/0x690 mm/rmap.c:201 __vmf_anon_prepare+0x11f/0x250 mm/memory.c:3961 vmf_anon_prepare mm/internal.h:569 [inline] do_anonymous_page+0x47d/0x2050 mm/memory.c:5478 do_pte_missing mm/memory.c:4698 [inline] handle_pte_fault mm/memory.c:6558 [inline] __handle_mm_fault+0x1ff3/0x2f60 mm/memory.c:6707 handle_mm_fault+0x363/0xa20 mm/memory.c:6876 do_user_addr_fault+0x59c/0x12f0 arch/x86/mm/fault.c:1343 page last free pid 5729 tgid 5729 ts 49286282375 stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] __free_pages_prepare mm/page_alloc.c:1418 [inline] __free_frozen_pages+0x79f/0x10f0 mm/page_alloc.c:2962 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x47/0xf0 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x1a0/0x1f0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:361 kasan_slab_alloc include/linux/kasan.h:253 [inline] slab_post_alloc_hook mm/slub.c:4683 [inline] slab_alloc_node mm/slub.c:4996 [inline] kmem_cache_alloc_noprof+0x269/0x6a0 mm/slub.c:5010 vm_area_dup+0x27/0x9d0 mm/vma_init.c:128 dup_mmap+0x72d/0x2370 mm/mmap.c:1763 dup_mm kernel/fork.c:1543 [inline] copy_mm kernel/fork.c:1595 [inline] copy_process+0x4821/0x8380 kernel/fork.c:2311 kernel_clone+0x176/0x9d0 kernel/fork.c:2771 __do_sys_clone+0xd9/0x120 kernel/fork.c:2913 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x123/0x790 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff8880386f6b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880386f6c00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880386f6c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880386f6d00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880386f6d80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================