================================================================== BUG: KASAN: slab-out-of-bounds in ecryptfs_verify_auth_tok_from_key+0x3b7/0x400 fs/ecryptfs/keystore.c:465 Read of size 2 at addr ffff88803d316098 by task syz.0.55/6122 CPU: 1 UID: 0 PID: 6122 Comm: syz.0.55 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_verify_auth_tok_from_key+0x3b7/0x400 fs/ecryptfs/keystore.c:465 ecryptfs_keyring_auth_tok_for_sig+0x9e/0x1f0 fs/ecryptfs/keystore.c:1606 ecryptfs_init_global_auth_toks fs/ecryptfs/main.c:194 [inline] ecryptfs_validate_options fs/ecryptfs/main.c:420 [inline] ecryptfs_get_tree+0x584/0x1580 fs/ecryptfs/main.c:453 vfs_get_tree+0x92/0x320 fs/super.c:1943 fc_mount fs/namespace.c:1282 [inline] do_new_mount_fc fs/namespace.c:3910 [inline] do_new_mount fs/namespace.c:3986 [inline] path_mount+0x7d0/0x2850 fs/namespace.c:4337 do_mount fs/namespace.c:4350 [inline] __do_sys_mount fs/namespace.c:4565 [inline] __se_sys_mount fs/namespace.c:4542 [inline] __x64_sys_mount+0x293/0x310 fs/namespace.c:4542 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:0x7faa5879f559 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:00007faa5966a028 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007faa58a25fa0 RCX: 00007faa5879f559 RDX: 0000200000000480 RSI: 0000200000000000 RDI: 0000200000000400 RBP: 00007faa58836b20 R08: 0000200000000500 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007faa58a26038 R14: 00007faa58a25fa0 R15: 00007ffd5abaffb8 Allocated by task 6122: 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] __do_kmalloc_node mm/slub.c:5531 [inline] __kmalloc_noprof+0x32f/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 The buggy address belongs to the object at ffff88803d316080 which belongs to the cache kmalloc-32 of size 32 The buggy address is located 24 bytes inside of allocated 25-byte region [ffff88803d316080, ffff88803d316099) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff88803d316c80 pfn:0x3d316 flags: 0xfff00000000200(workingset|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000200 ffff88801d442780 ffffea0000b52ed0 ffffea0000f43950 raw: ffff88803d316c80 000000000040003f 00000000f5000000 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 0xd2800(GFP_NOWAIT|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5720, tgid 5720 (dhcpcd), ts 37103338740 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] __kmalloc_cache_noprof+0x4ef/0x6d0 mm/slub.c:5676 _kmalloc_noprof include/linux/slab.h:991 [inline] slab_free_hook mm/slub.c:2732 [inline] slab_free mm/slub.c:6630 [inline] kmem_cache_free+0x40f/0x6c0 mm/slub.c:6757 anon_vma_free mm/rmap.c:137 [inline] __put_anon_vma+0x10f/0x3a0 mm/rmap.c:2960 put_anon_vma mm/internal.h:300 [inline] unlink_anon_vmas+0x5e4/0x8d0 mm/rmap.c:538 free_pgtables+0x2e7/0xd80 mm/memory.c:414 exit_mmap+0x44c/0xa40 mm/mmap.c:1327 __mmput+0x12a/0x410 kernel/fork.c:1192 mmput+0x62/0x70 kernel/fork.c:1215 exit_mm kernel/exit.c:586 [inline] do_exit+0x80c/0x2a00 kernel/exit.c:967 do_group_exit+0xd5/0x2a0 kernel/exit.c:1123 page last free pid 23 tgid 23 ts 19808113984 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 __pagetable_free include/linux/mm.h:3959 [inline] pagetable_free include/linux/mm.h:3983 [inline] pagetable_dtor_free include/linux/mm.h:4082 [inline] __tlb_remove_table include/asm-generic/tlb.h:205 [inline] __tlb_remove_table_free mm/mmu_gather.c:226 [inline] tlb_remove_table_rcu+0x2cf/0x380 mm/mmu_gather.c:287 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 run_ksoftirqd kernel/softirq.c:1133 [inline] run_ksoftirqd+0x38/0x60 kernel/softirq.c:1125 smpboot_thread_fn+0x41f/0xb90 kernel/smpboot.c:162 kthread+0x373/0x450 kernel/kthread.c:436 ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Memory state around the buggy address: ffff88803d315f80: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc ffff88803d316000: fa fb fb fb fc fc fc fc 00 00 00 02 fc fc fc fc >ffff88803d316080: 00 00 00 01 fc fc fc fc fa fb fb fb fc fc fc fc ^ ffff88803d316100: fa fb fb fb fc fc fc fc 00 00 00 00 fc fc fc fc ffff88803d316180: 00 00 00 00 fc fc fc fc 00 00 00 00 fc fc fc fc ==================================================================