================================================================== 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 ffff8880595504d8 by task syz.1.47/6069 CPU: 3 UID: 0 PID: 6069 Comm: syz.1.47 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/0x1590 fs/ecryptfs/main.c:453 vfs_get_tree+0x92/0x320 fs/super.c:1881 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:0x7f82dc39fb19 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:00007f82dd1e5028 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007f82dc626090 RCX: 00007f82dc39fb19 RDX: 0000200000000200 RSI: 00002000000001c0 RDI: 0000200000000180 RBP: 00007f82dc437af8 R08: 0000200000000240 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f82dc626128 R14: 00007f82dc626090 R15: 00007ffdac1e0c08 Allocated by task 6069: 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 ffff8880595504c0 which belongs to the cache kmalloc-32 of size 32 The buggy address is located 24 bytes inside of allocated 25-byte region [ffff8880595504c0, ffff8880595504d9) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888059550540 pfn:0x59550 flags: 0xfff00000000200(workingset|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000200 ffff88801d442780 ffff88801d4404c8 ffff88801d4404c8 raw: ffff888059550540 0000000000400015 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 0xd2c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 6069, tgid 6059 (syz.1.47), ts 41238504251 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] _kzalloc_noprof include/linux/slab.h:1312 [inline] tomoyo_encode2+0xfb/0x3c0 security/tomoyo/realpath.c:45 tomoyo_encode+0x29/0x50 security/tomoyo/realpath.c:80 tomoyo_realpath_from_path+0x18c/0x690 security/tomoyo/realpath.c:283 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_number_perm+0x23c/0x580 security/tomoyo/file.c:728 security_file_ioctl+0xd3/0x230 security/security.c:2533 __do_sys_ioctl fs/ioctl.c:591 [inline] __se_sys_ioctl fs/ioctl.c:583 [inline] __x64_sys_ioctl+0xb7/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 page last free pid 50 tgid 50 ts 41197524782 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 do_softirq kernel/softirq.c:569 [inline] do_softirq+0xaf/0xf0 kernel/softirq.c:556 __local_bh_enable_ip+0xff/0x120 kernel/softirq.c:473 local_bh_enable include/linux/bottom_half.h:33 [inline] __alloc_skb+0x5db/0x710 net/core/skbuff.c:700 alloc_skb include/linux/skbuff.h:1390 [inline] mld_newpack.isra.0+0x18e/0xa30 net/ipv6/mcast.c:1810 add_grhead+0x299/0x340 net/ipv6/mcast.c:1921 add_grec+0x13a3/0x1940 net/ipv6/mcast.c:2060 mld_send_initial_cr+0x156/0x320 net/ipv6/mcast.c:2305 mld_dad_work+0x32/0x1f0 net/ipv6/mcast.c:2331 process_one_work+0xac7/0x1b10 kernel/workqueue.c:3495 process_scheduled_works kernel/workqueue.c:3578 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3659 kthread+0x373/0x450 kernel/kthread.c:436 ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158 Memory state around the buggy address: ffff888059550380: 00 00 00 00 fc fc fc fc 00 00 00 00 fc fc fc fc ffff888059550400: 00 00 00 00 fc fc fc fc 00 00 00 00 fc fc fc fc >ffff888059550480: 00 00 00 00 fc fc fc fc 00 00 00 01 fc fc fc fc ^ ffff888059550500: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc ffff888059550580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================