================================================================== BUG: KASAN: slab-out-of-bounds in get_max_inline_xattr_value_size+0x369/0x510 fs/ext4/inline.c:62 Read of size 4 at addr ffff8880212db0b4 by task syz-executor.3/6587 CPU: 0 PID: 6587 Comm: syz-executor.3 Not tainted 6.3.0-rc7-syzkaller-00191-g622322f53c6d #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:319 [inline] print_report+0x163/0x540 mm/kasan/report.c:430 kasan_report+0x176/0x1b0 mm/kasan/report.c:536 get_max_inline_xattr_value_size+0x369/0x510 fs/ext4/inline.c:62 ext4_update_inline_dir fs/ext4/inline.c:1109 [inline] ext4_try_add_inline_entry+0x34b/0xb70 fs/ext4/inline.c:1306 ext4_add_entry+0x535/0x1010 fs/ext4/namei.c:2384 ext4_mkdir+0x553/0xce0 fs/ext4/namei.c:3006 vfs_mkdir+0x29d/0x450 fs/namei.c:4038 do_mkdirat+0x264/0x520 fs/namei.c:4061 __do_sys_mkdir fs/namei.c:4081 [inline] __se_sys_mkdir fs/namei.c:4079 [inline] __x64_sys_mkdir+0x6e/0x80 fs/namei.c:4079 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f123528c169 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f1235fbf168 EFLAGS: 00000246 ORIG_RAX: 0000000000000053 RAX: ffffffffffffffda RBX: 00007f12353abf80 RCX: 00007f123528c169 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00000000200000c0 RBP: 00007f12352e7ca1 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fff7a2e4aff R14: 00007f1235fbf300 R15: 0000000000022000 Allocated by task 1: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4f/0x70 mm/kasan/common.c:52 __kasan_slab_alloc+0x66/0x70 mm/kasan/common.c:328 kasan_slab_alloc include/linux/kasan.h:186 [inline] slab_post_alloc_hook+0x68/0x3a0 mm/slab.h:769 slab_alloc_node mm/slub.c:3452 [inline] slab_alloc mm/slub.c:3460 [inline] __kmem_cache_alloc_lru mm/slub.c:3467 [inline] kmem_cache_alloc+0x11f/0x2e0 mm/slub.c:3476 kmem_cache_zalloc include/linux/slab.h:710 [inline] __kernfs_new_node+0xdf/0x740 fs/kernfs/dir.c:611 kernfs_new_node+0x99/0x170 fs/kernfs/dir.c:673 __kernfs_create_file+0x49/0x2e0 fs/kernfs/file.c:1047 sysfs_add_file_mode_ns+0x24a/0x300 fs/sysfs/file.c:294 create_files fs/sysfs/group.c:64 [inline] internal_create_group+0x549/0xed0 fs/sysfs/group.c:148 internal_create_groups fs/sysfs/group.c:188 [inline] sysfs_create_groups+0x56/0x110 fs/sysfs/group.c:214 device_add_groups drivers/base/core.c:2678 [inline] device_add_attrs+0x199/0x600 drivers/base/core.c:2798 device_add+0x68a/0x1060 drivers/base/core.c:3543 usb_add_gadget+0x2a4/0x5b0 drivers/usb/gadget/udc/core.c:1305 usb_add_gadget_udc_release drivers/usb/gadget/udc/core.c:1360 [inline] usb_add_gadget_udc+0x14c/0x180 drivers/usb/gadget/udc/core.c:1407 dummy_udc_probe+0x6d4/0x7d0 drivers/usb/gadget/udc/dummy_hcd.c:1095 platform_probe+0x135/0x1b0 drivers/base/platform.c:1404 really_probe+0x2af/0xc80 drivers/base/dd.c:631 __driver_probe_device+0x1c3/0x3f0 drivers/base/dd.c:768 driver_probe_device+0x50/0x420 drivers/base/dd.c:798 __device_attach_driver+0x2d3/0x520 drivers/base/dd.c:926 bus_for_each_drv+0x24a/0x2d0 drivers/base/bus.c:457 __device_attach+0x32f/0x510 drivers/base/dd.c:998 bus_probe_device+0x185/0x260 drivers/base/bus.c:532 device_add+0xbcf/0x1060 drivers/base/core.c:3589 platform_device_add+0x472/0x7d0 drivers/base/platform.c:717 dummy_hcd_init+0xb5f/0x1070 drivers/usb/gadget/udc/dummy_hcd.c:2850 do_one_initcall+0x23d/0x7d0 init/main.c:1310 do_initcall_level+0x157/0x210 init/main.c:1383 do_initcalls+0x3f/0x80 init/main.c:1399 kernel_init_freeable+0x477/0x630 init/main.c:1638 kernel_init+0x1d/0x2a0 init/main.c:1526 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 The buggy address belongs to the object at ffff8880212db000 which belongs to the cache kernfs_node_cache of size 168 The buggy address is located 12 bytes to the right of allocated 168-byte region [ffff8880212db000, ffff8880212db0a8) The buggy address belongs to the physical page: page:ffffea000084b6c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x212db flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffff888140008dc0 dead000000000122 0000000000000000 raw: 0000000000000000 0000000000110011 00000001ffffffff 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 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 1, tgid 1 (swapper/0), ts 10414092712, free_ts 10412284695 prep_new_page mm/page_alloc.c:2553 [inline] get_page_from_freelist+0x3246/0x33c0 mm/page_alloc.c:4326 __alloc_pages+0x255/0x670 mm/page_alloc.c:5592 alloc_page_interleave+0x22/0x1d0 mm/mempolicy.c:2110 alloc_slab_page+0x6a/0x160 mm/slub.c:1851 allocate_slab mm/slub.c:1998 [inline] new_slab+0x84/0x2f0 mm/slub.c:2051 ___slab_alloc+0xa85/0x10a0 mm/slub.c:3193 __slab_alloc mm/slub.c:3292 [inline] __slab_alloc_node mm/slub.c:3345 [inline] slab_alloc_node mm/slub.c:3442 [inline] slab_alloc mm/slub.c:3460 [inline] __kmem_cache_alloc_lru mm/slub.c:3467 [inline] kmem_cache_alloc+0x1b9/0x2e0 mm/slub.c:3476 kmem_cache_zalloc include/linux/slab.h:710 [inline] __kernfs_new_node+0xdf/0x740 fs/kernfs/dir.c:611 kernfs_new_node+0x99/0x170 fs/kernfs/dir.c:673 __kernfs_create_file+0x49/0x2e0 fs/kernfs/file.c:1047 sysfs_add_file_mode_ns+0x24a/0x300 fs/sysfs/file.c:294 create_files fs/sysfs/group.c:64 [inline] internal_create_group+0x549/0xed0 fs/sysfs/group.c:148 internal_create_groups fs/sysfs/group.c:188 [inline] sysfs_create_groups+0x56/0x110 fs/sysfs/group.c:214 device_add_groups drivers/base/core.c:2678 [inline] device_add_attrs+0x199/0x600 drivers/base/core.c:2798 device_add+0x68a/0x1060 drivers/base/core.c:3543 usb_add_gadget+0x2a4/0x5b0 drivers/usb/gadget/udc/core.c:1305 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1454 [inline] free_pcp_prepare mm/page_alloc.c:1504 [inline] free_unref_page_prepare+0xe2f/0xe70 mm/page_alloc.c:3388 free_unref_page_list+0x596/0x830 mm/page_alloc.c:3529 release_pages+0x219e/0x2470 mm/swap.c:1042 tlb_batch_pages_flush mm/mmu_gather.c:97 [inline] tlb_flush_mmu_free mm/mmu_gather.c:292 [inline] tlb_flush_mmu+0x100/0x210 mm/mmu_gather.c:299 tlb_finish_mmu+0xd4/0x1f0 mm/mmu_gather.c:391 exit_mmap+0x3ce/0x9d0 mm/mmap.c:3081 __mmput+0x115/0x3c0 kernel/fork.c:1208 free_bprm+0x144/0x320 fs/exec.c:1489 kernel_execve+0x8f5/0xa10 fs/exec.c:2022 call_usermodehelper_exec_async+0x233/0x370 kernel/umh.c:110 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 Memory state around the buggy address: ffff8880212daf80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8880212db000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff8880212db080: 00 00 00 00 00 fc fc fc fc fc fc fc fc 00 00 00 ^ ffff8880212db100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8880212db180: 00 00 fc fc fc fc fc fc fc fc 00 00 00 00 00 00 ==================================================================