================================================================== 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 ffff88805c548118 by task syz.3.2600/13756 CPU: 1 UID: 0 PID: 13756 Comm: syz.3.2600 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_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+0x57b/0x15b0 fs/ecryptfs/main.c:453 vfs_get_tree+0x92/0x320 fs/super.c:1932 fc_mount fs/namespace.c:1198 [inline] do_new_mount_fc fs/namespace.c:3772 [inline] do_new_mount fs/namespace.c:3848 [inline] path_mount+0x7d0/0x24c0 fs/namespace.c:4168 do_mount fs/namespace.c:4181 [inline] __do_sys_mount fs/namespace.c:4397 [inline] __se_sys_mount fs/namespace.c:4374 [inline] __x64_sys_mount+0x293/0x310 fs/namespace.c:4374 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:0x7f27a2f9e159 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:00007f27a3ecb028 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007f27a3225fa0 RCX: 00007f27a2f9e159 RDX: 0000200000000480 RSI: 0000200000000000 RDI: 0000200000000400 RBP: 00007f27a303506b R08: 0000200000000500 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f27a3226038 R14: 00007f27a3225fa0 R15: 00007ffd5f3dda78 Allocated by task 13756: 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:5414 [inline] __kmalloc_noprof+0x32f/0x840 mm/slub.c:5439 _kmalloc_noprof include/linux/slab.h:995 [inline] user_preparse+0x9b/0x1c0 security/keys/user_defined.c:67 __key_create_or_update+0x463/0xe30 security/keys/key.c:857 key_create_or_update+0x42/0x60 security/keys/key.c:1021 __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 ffff88805c548100 which belongs to the cache kmalloc-32 of size 32 The buggy address is located 24 bytes inside of allocated 25-byte region [ffff88805c548100, ffff88805c548119) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5c548 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000000 ffff88801c042780 dead000000000100 dead000000000122 raw: 0000000000000000 0000000000400040 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 0xd2cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5732, tgid 5732 (syz-executor), ts 62135573725 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] __kmalloc_cache_noprof+0x4f4/0x6d0 mm/slub.c:5559 _kmalloc_noprof include/linux/slab.h:991 [inline] _kzalloc_noprof include/linux/slab.h:1312 [inline] ref_tracker_alloc+0x190/0x590 lib/ref_tracker.c:270 __netns_tracker_alloc include/net/net_namespace.h:370 [inline] netns_tracker_alloc include/net/net_namespace.h:379 [inline] get_net_track include/net/net_namespace.h:396 [inline] sk_alloc+0x2e9/0xe80 net/core/sock.c:2325 inet6_create net/ipv6/af_inet6.c:178 [inline] inet6_create+0x385/0x12b0 net/ipv6/af_inet6.c:105 __sock_create+0x339/0x860 net/socket.c:1676 sock_create net/socket.c:1734 [inline] __sys_socket_create net/socket.c:1771 [inline] __sys_socket+0x14d/0x260 net/socket.c:1818 __do_sys_socket net/socket.c:1832 [inline] __se_sys_socket net/socket.c:1830 [inline] __x64_sys_socket+0x72/0xb0 net/socket.c:1830 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 5732 tgid 5732 ts 62135421676 stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] __free_pages_prepare mm/page_alloc.c:1418 [inline] free_pages_prepare+0x586/0xe00 mm/page_alloc.c:1463 __free_contig_range_common+0x14f/0x250 mm/page_alloc.c:7072 __free_contig_range mm/page_alloc.c:7117 [inline] free_pages_bulk+0x12a/0x200 mm/page_alloc.c:5322 vm_area_free_pages+0xb2/0x2a0 mm/vmalloc.c:3461 vfree mm/vmalloc.c:3510 [inline] vfree+0xf7/0x6d0 mm/vmalloc.c:3484 copy_entries_to_user net/ipv4/netfilter/ip_tables.c:864 [inline] get_entries net/ipv4/netfilter/ip_tables.c:1020 [inline] do_ipt_get_ctl+0x9d7/0xbf0 net/ipv4/netfilter/ip_tables.c:1669 nf_getsockopt+0x7c/0xe0 net/netfilter/nf_sockopt.c:116 ip_getsockopt+0x192/0x1e0 net/ipv4/ip_sockglue.c:1777 tcp_getsockopt+0xa1/0x110 net/ipv4/tcp.c:4873 do_sock_getsockopt+0x50a/0x6e0 net/socket.c:2503 __sys_getsockopt+0x148/0x260 net/socket.c:2534 __do_sys_getsockopt net/socket.c:2541 [inline] __se_sys_getsockopt net/socket.c:2538 [inline] __x64_sys_getsockopt+0xbd/0x160 net/socket.c:2538 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: ffff88805c548000: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc ffff88805c548080: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc >ffff88805c548100: 00 00 00 01 fc fc fc fc fa fb fb fb fc fc fc fc ^ ffff88805c548180: 00 00 00 00 fc fc fc fc 00 00 00 00 fc fc fc fc ffff88805c548200: 00 00 00 00 fc fc fc fc fa fb fb fb fc fc fc fc ==================================================================