================================================================== BUG: KASAN: out-of-bounds in ext4_xattr_set_entry+0x9c1/0x1e20 fs/ext4/xattr.c:1756 Read of size 18446744073709551600 at addr ffff88804210a124 by task syz.0.0/5322 CPU: 0 UID: 0 PID: 5322 Comm: syz.0.0 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Call Trace: dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xca/0x240 mm/kasan/report.c:482 kasan_report+0x118/0x150 mm/kasan/report.c:595 check_region_inline mm/kasan/generic.c:-1 [inline] kasan_check_range+0x2b0/0x2c0 mm/kasan/generic.c:200 __asan_memmove+0x29/0x70 mm/kasan/shadow.c:94 ext4_xattr_set_entry+0x9c1/0x1e20 fs/ext4/xattr.c:1756 ext4_xattr_ibody_set+0x254/0x6a0 fs/ext4/xattr.c:2268 ext4_destroy_inline_data_nolock+0x214/0x5b0 fs/ext4/inline.c:463 ext4_destroy_inline_data+0x83/0xe0 fs/ext4/inline.c:1788 ext4_do_writepages+0x526/0x4610 fs/ext4/inode.c:2810 ext4_writepages+0x205/0x350 fs/ext4/inode.c:3025 do_writepages+0x32e/0x550 mm/page-writeback.c:2604 filemap_fdatawrite_wbc mm/filemap.c:389 [inline] __filemap_fdatawrite_range mm/filemap.c:422 [inline] __filemap_fdatawrite mm/filemap.c:428 [inline] filemap_flush+0x191/0x230 mm/filemap.c:473 ext4_release_file+0x82/0x310 fs/ext4/file.c:169 __fput+0x44c/0xa70 fs/file_table.c:468 task_work_run+0x1d4/0x260 kernel/task_work.c:227 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] exit_to_user_mode_loop+0xe9/0x130 kernel/entry/common.c:43 exit_to_user_mode_prepare include/linux/irq-entry-common.h:225 [inline] syscall_exit_to_user_mode_work include/linux/entry-common.h:175 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:210 [inline] do_syscall_64+0x2bd/0xfa0 arch/x86/entry/syscall_64.c:100 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f127018f749 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffd2e3724b8 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4 RAX: 0000000000000000 RBX: 00000000000137c5 RCX: 00007f127018f749 RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003 RBP: 00007f12703e7da0 R08: 0000000000000001 R09: 0000000b2e3727af R10: 00007f126ffff02c R11: 0000000000000246 R12: 00007f12703e5fac R13: 00007f12703e5fa0 R14: ffffffffffffffff R15: 00007ffd2e3725d0 The buggy address belongs to the physical page: page: refcount:2 mapcount:0 mapping:ffff88803234cd80 index:0x3 pfn:0x4210a memcg:ffff888030ad8d00 aops:def_blk_aops ino:700000 dentry name(?):"" flags: 0x4fff5800000423c(referenced|uptodate|dirty|lru|workingset|private|node=1|zone=1|lastcpupid=0x7ff) raw: 04fff5800000423c ffffea00010f2208 ffff888030ae8a80 ffff88803234cd80 raw: 0000000000000003 ffff8880320fce80 00000002ffffffff ffff888030ad8d00 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x140cc0(GFP_USER|__GFP_COMP), pid 5323, tgid 5322 (syz.0.0), ts 80309715043, free_ts 80303811691 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x234/0x290 mm/page_alloc.c:1845 prep_new_page mm/page_alloc.c:1853 [inline] get_page_from_freelist+0x2365/0x2440 mm/page_alloc.c:3879 __alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:5178 alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2416 alloc_frozen_pages_noprof mm/mempolicy.c:2487 [inline] alloc_pages_noprof+0xa9/0x190 mm/mempolicy.c:2507 folio_alloc_noprof+0x1e/0x30 mm/mempolicy.c:2517 filemap_alloc_folio_noprof+0xdf/0x470 mm/filemap.c:1020 do_read_cache_folio+0x2da/0x590 mm/filemap.c:3998 read_mapping_folio include/linux/pagemap.h:999 [inline] read_part_sector+0xb6/0x2b0 block/partitions/core.c:722 ultrix_partition+0xab/0x8b0 block/partitions/ultrix.c:29 check_partition block/partitions/core.c:141 [inline] blk_add_partitions block/partitions/core.c:589 [inline] bdev_disk_changed+0x75f/0x14b0 block/partitions/core.c:693 loop_reread_partitions drivers/block/loop.c:449 [inline] loop_set_status+0x918/0xd60 drivers/block/loop.c:1278 lo_ioctl+0x9ef/0x1c50 drivers/block/loop.c:-1 blkdev_ioctl+0x5af/0x6d0 block/ioctl.c:705 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xfa0 arch/x86/entry/syscall_64.c:94 page last free pid 5330 tgid 5330 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1394 [inline] __free_frozen_pages+0xbc4/0xd30 mm/page_alloc.c:2901 discard_slab mm/slub.c:3330 [inline] __put_partials+0x146/0x170 mm/slub.c:3876 put_cpu_partial+0x1f2/0x2e0 mm/slub.c:3951 __slab_free+0x2b9/0x390 mm/slub.c:5929 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x97/0x140 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x148/0x160 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x22/0x80 mm/kasan/common.c:352 kasan_slab_alloc include/linux/kasan.h:252 [inline] slab_post_alloc_hook mm/slub.c:4978 [inline] slab_alloc_node mm/slub.c:5288 [inline] __do_kmalloc_node mm/slub.c:5649 [inline] __kmalloc_noprof+0x3c3/0x7f0 mm/slub.c:5662 kmalloc_noprof include/linux/slab.h:961 [inline] tomoyo_realpath_from_path+0xe3/0x5d0 security/tomoyo/realpath.c:251 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x213/0x4b0 security/tomoyo/file.c:822 security_file_truncate+0xb1/0x270 security/security.c:3215 handle_truncate fs/namei.c:3594 [inline] do_open fs/namei.c:3979 [inline] path_openat+0x3022/0x3830 fs/namei.c:4134 do_filp_open+0x1fa/0x410 fs/namei.c:4161 do_sys_openat2+0x121/0x1c0 fs/open.c:1437 do_sys_open fs/open.c:1452 [inline] __do_sys_openat fs/open.c:1468 [inline] __se_sys_openat fs/open.c:1463 [inline] __x64_sys_openat+0x138/0x170 fs/open.c:1463 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xfa0 arch/x86/entry/syscall_64.c:94 Memory state around the buggy address: ffff88804210a000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88804210a080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff88804210a100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^ ffff88804210a180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88804210a200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ==================================================================