================================================================== BUG: KASAN: slab-out-of-bounds in ecryptfs_write_tag_70_packet+0x117b/0x1410 fs/ecryptfs/keystore.c:742 Read of size 4 at addr ffff8880276adc98 by task syz.0.5/5941 CPU: 3 UID: 0 PID: 5941 Comm: syz.0.5 Not tainted syzkaller #0 PREEMPT(full) 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:1925 lookup_slow+0x54/0x80 fs/namei.c:1942 walk_component fs/namei.c:2288 [inline] lookup_last fs/namei.c:2795 [inline] path_lookupat+0x5e8/0xc40 fs/namei.c:2819 filename_lookup+0x202/0x590 fs/namei.c:2848 filename_removexattr fs/xattr.c:1059 [inline] path_removexattrat+0x1f3/0x5f0 fs/xattr.c:1097 __do_sys_lremovexattr fs/xattr.c:1115 [inline] __se_sys_lremovexattr fs/xattr.c:1112 [inline] __x64_sys_lremovexattr+0x5e/0x80 fs/xattr.c:1112 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:0x7f502839fb19 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:00007f50292a3028 EFLAGS: 00000246 ORIG_RAX: 00000000000000c6 RAX: ffffffffffffffda RBX: 00007f5028625fa0 RCX: 00007f502839fb19 RDX: 0000000000000000 RSI: 0000200000000140 RDI: 0000200000000040 RBP: 00007f5028437b70 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f5028626038 R14: 00007f5028625fa0 R15: 00007ffe9e66f728 The buggy address belongs to the object at ffff8880276adc00 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 152 bytes inside of allocated 256-byte region [ffff8880276adc00, ffff8880276add00) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff8880276adc00 pfn:0x276ac head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000240(workingset|head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000240 ffff88801d442b40 ffffea0000d13d10 ffff88801d440708 raw: ffff8880276adc00 000000000010000e 00000000f5000000 0000000000000000 head: 00fff00000000240 ffff88801d442b40 ffffea0000d13d10 ffff88801d440708 head: ffff8880276adc00 000000000010000e 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 5941, tgid 5940 (syz.0.5), ts 49010403549 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1856 prep_new_page mm/page_alloc.c:1864 [inline] get_page_from_freelist+0x1113/0x35e0 mm/page_alloc.c:3935 __alloc_frozen_pages_noprof+0x2bd/0x3280 mm/page_alloc.c:5444 alloc_slab_page mm/slub.c:3384 [inline] allocate_slab mm/slub.c:3499 [inline] new_slab+0xb1/0x6d0 mm/slub.c:3550 refill_objects+0xe3/0x410 mm/slub.c:7539 refill_sheaf mm/slub.c:2917 [inline] __pcs_replace_empty_main+0x35e/0x650 mm/slub.c:4811 alloc_from_pcs mm/slub.c:4887 [inline] slab_alloc_node mm/slub.c:5021 [inline] __do_kmalloc_node mm/slub.c:5530 [inline] __kmalloc_noprof+0x677/0x840 mm/slub.c:5556 _kmalloc_noprof include/linux/slab.h:995 [inline] user_preparse+0x9b/0x1c0 security/keys/user_defined.c:67 __key_create_or_update+0x3f6/0xe10 security/keys/key.c:861 key_create_or_update+0x42/0x60 security/keys/key.c:1028 __do_sys_add_key+0x2e8/0x460 security/keys/keyctl.c:134 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 page last free pid 0 tgid 0 ts 48967238076 stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] __free_pages_prepare mm/page_alloc.c:1403 [inline] __free_frozen_pages+0x7b4/0x1110 mm/page_alloc.c:2954 rcu_do_batch kernel/rcu/tree.c:2650 [inline] rcu_core+0x5f0/0x1220 kernel/rcu/tree.c:2919 handle_softirqs+0x216/0xa20 kernel/softirq.c:669 __do_softirq kernel/softirq.c:703 [inline] invoke_softirq kernel/softirq.c:542 [inline] __irq_exit_rcu+0x178/0x220 kernel/softirq.c:786 irq_exit_rcu+0x9/0x30 kernel/softirq.c:809 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline] sysvec_apic_timer_interrupt+0xa3/0xc0 arch/x86/kernel/apic/apic.c:1062 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674 Memory state around the buggy address: ffff8880276adb80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880276adc00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8880276adc80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff8880276add00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880276add80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================