================================================================== 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 ffff888072d1ee98 by task syz.0.643/8190 CPU: 3 UID: 0 PID: 8190 Comm: syz.0.643 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+0x54/0x80 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 filename_lookup+0x202/0x590 fs/namei.c:2842 do_fchownat+0xe6/0x1f0 fs/open.c:849 ksys_lchown include/linux/syscalls.h:1288 [inline] __do_sys_lchown16 kernel/uid16.c:30 [inline] __se_sys_lchown16 kernel/uid16.c:28 [inline] __ia32_sys_lchown16+0xe6/0x120 kernel/uid16.c:28 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:79 [inline] __do_fast_syscall_32+0x13a/0x8b0 arch/x86/entry/syscall_32.c:291 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:316 entry_SYSENTER_compat_after_hwframe+0x84/0x8e RIP: 0023:0xf73cefec Code: Unable to access opcode bytes at 0xf73cefc2. RSP: 002b:00000000f53e650c EFLAGS: 00000292 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 0000000080000040 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000292 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 8178: 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] ucma_open+0x4a/0x1f0 drivers/infiniband/core/ucma.c:1901 misc_open+0x26d/0x450 drivers/char/misc.c:163 chrdev_open+0x234/0x6a0 fs/char_dev.c:413 do_dentry_open+0x674/0x1470 fs/open.c:1000 vfs_open_consume+0xcc/0x460 fs/open.c:1131 do_open fs/namei.c:4845 [inline] path_openat+0x1551/0x2430 fs/namei.c:5010 do_file_open+0x20e/0x430 fs/namei.c:5039 do_sys_openat2+0x163/0x1d0 fs/open.c:1442 do_sys_open fs/open.c:1448 [inline] __do_compat_sys_openat fs/open.c:1510 [inline] __se_compat_sys_openat fs/open.c:1508 [inline] __ia32_compat_sys_openat+0x12d/0x210 fs/open.c:1508 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:79 [inline] __do_fast_syscall_32+0x13a/0x8b0 arch/x86/entry/syscall_32.c:291 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:316 entry_SYSENTER_compat_after_hwframe+0x84/0x8e Freed by task 8183: 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 ucma_close+0x1cb/0x240 drivers/infiniband/core/ucma.c:1936 __fput+0x3fb/0xb50 fs/file_table.c:512 fput_close_sync+0x118/0x250 fs/file_table.c:618 filp_close_sync+0x75/0xa0 fs/open.c:1573 __range_close+0x4a6/0x8b0 fs/file.c:919 __do_sys_close_range fs/file.c:1003 [inline] __se_sys_close_range fs/file.c:954 [inline] __ia32_sys_close_range+0x1f8/0x430 fs/file.c:954 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:79 [inline] __do_fast_syscall_32+0x13a/0x8b0 arch/x86/entry/syscall_32.c:291 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:316 entry_SYSENTER_compat_after_hwframe+0x84/0x8e The buggy address belongs to the object at ffff888072d1ee00 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 152 bytes inside of freed 256-byte region [ffff888072d1ee00, ffff888072d1ef00) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888072d1fc00 pfn:0x72d1e head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x4fff00000000240(workingset|head|node=1|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 04fff00000000240 ffff88801d042b40 ffffea0001b25810 ffffea0001404c90 raw: ffff888072d1fc00 000000000010000f 00000000f5000000 0000000000000000 head: 04fff00000000240 ffff88801d042b40 ffffea0001b25810 ffffea0001404c90 head: ffff888072d1fc00 000000000010000f 00000000f5000000 0000000000000000 head: 04fff00000000001 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 7742, tgid 7737 (syz.3.509), ts 144806885547 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+0x2e9/0x32e0 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_noprof+0x677/0x840 mm/slub.c:5439 _kmalloc_noprof include/linux/slab.h:995 [inline] io_cache_alloc_new+0x45/0xe0 io_uring/alloc_cache.c:40 io_cache_alloc io_uring/alloc_cache.h:61 [inline] io_uring_alloc_async_data io_uring/io_uring.h:356 [inline] io_rw_alloc_async io_uring/rw.c:195 [inline] __io_prep_rw+0x21d/0xfb0 io_uring/rw.c:254 io_prep_rw+0x76/0x2c0 io_uring/rw.c:314 io_prep_rwv io_uring/rw.c:336 [inline] io_prep_readv+0x78/0x2e0 io_uring/rw.c:351 io_init_req io_uring/io_uring.c:1835 [inline] io_submit_sqe io_uring/io_uring.c:1882 [inline] io_submit_sqes+0xa03/0x2480 io_uring/io_uring.c:2050 __do_sys_io_uring_enter+0xa88/0x1b10 io_uring/io_uring.c:2640 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:79 [inline] __do_fast_syscall_32+0x13a/0x8b0 arch/x86/entry/syscall_32.c:291 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:316 entry_SYSENTER_compat_after_hwframe+0x84/0x8e page last free pid 7742 tgid 7737 ts 144795701240 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] kmem_cache_alloc_bulk_noprof+0x352/0x890 mm/slub.c:7543 __io_alloc_req_refill+0x9e/0x330 io_uring/io_uring.c:981 io_alloc_req io_uring/io_uring.h:537 [inline] io_submit_sqes.cold+0xf6/0x2f6 io_uring/io_uring.c:2039 __do_sys_io_uring_enter+0xa88/0x1b10 io_uring/io_uring.c:2640 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:79 [inline] __do_fast_syscall_32+0x13a/0x8b0 arch/x86/entry/syscall_32.c:291 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:316 entry_SYSENTER_compat_after_hwframe+0x84/0x8e Memory state around the buggy address: ffff888072d1ed80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888072d1ee00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888072d1ee80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888072d1ef00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888072d1ef80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================