================================================================== BUG: KASAN: slab-out-of-bounds in watch_queue_set_filter+0x78d/0x810 kernel/watch_queue.c:343 Write of size 4 at addr ffff88805b66422c by task syz-executor.5/1369 CPU: 1 PID: 1369 Comm: syz-executor.5 Not tainted 5.17.0-rc6-next-20220303-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0xeb/0x495 mm/kasan/report.c:313 print_report mm/kasan/report.c:429 [inline] kasan_report.cold+0xf4/0x1c6 mm/kasan/report.c:491 watch_queue_set_filter+0x78d/0x810 kernel/watch_queue.c:343 pipe_ioctl+0x25b/0x2b0 fs/pipe.c:637 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl fs/ioctl.c:856 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f6f2ce89049 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f6f2e073168 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f6f2cf9bf60 RCX: 00007f6f2ce89049 RDX: 0000000020000140 RSI: 0000000000005761 RDI: 0000000000000003 RBP: 00007f6f2cee308d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffcc5172e2f R14: 00007f6f2e073300 R15: 0000000000022000 Allocated by task 1369: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:436 [inline] ____kasan_kmalloc mm/kasan/common.c:515 [inline] ____kasan_kmalloc mm/kasan/common.c:474 [inline] __kasan_kmalloc+0xa9/0xd0 mm/kasan/common.c:524 kmalloc include/linux/slab.h:589 [inline] kzalloc include/linux/slab.h:717 [inline] watch_queue_set_filter+0x2f2/0x810 kernel/watch_queue.c:332 pipe_ioctl+0x25b/0x2b0 fs/pipe.c:637 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl fs/ioctl.c:856 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff88805b664200 which belongs to the cache kmalloc-64 of size 64 The buggy address is located 44 bytes inside of 64-byte region [ffff88805b664200, ffff88805b664240) The buggy address belongs to the physical page: page:ffffea00016d9900 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88805b664b00 pfn:0x5b664 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea000078e300 dead000000000006 ffff888010c41640 raw: ffff88805b664b00 000000008020001f 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 0x112c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL), pid 2962, tgid 2962 (udevd), ts 71075984359, free_ts 71066482628 prep_new_page mm/page_alloc.c:2438 [inline] get_page_from_freelist+0xa7f/0x3ec0 mm/page_alloc.c:4182 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5400 alloc_pages+0x1aa/0x310 mm/mempolicy.c:2268 alloc_slab_page mm/slub.c:1799 [inline] allocate_slab+0x26c/0x3c0 mm/slub.c:1944 new_slab mm/slub.c:2004 [inline] ___slab_alloc+0x8d0/0xf30 mm/slub.c:3018 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3105 slab_alloc_node mm/slub.c:3196 [inline] slab_alloc mm/slub.c:3238 [inline] __kmalloc+0x318/0x350 mm/slub.c:4434 kmalloc include/linux/slab.h:589 [inline] kzalloc include/linux/slab.h:717 [inline] tomoyo_encode2.part.0+0xe9/0x3a0 security/tomoyo/realpath.c:45 tomoyo_encode2 security/tomoyo/realpath.c:31 [inline] tomoyo_encode+0x28/0x50 security/tomoyo/realpath.c:80 tomoyo_realpath_from_path+0x186/0x620 security/tomoyo/realpath.c:288 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x21b/0x400 security/tomoyo/file.c:822 security_inode_getattr+0xcf/0x140 security/security.c:1350 vfs_getattr fs/stat.c:157 [inline] vfs_statx+0x16a/0x390 fs/stat.c:232 vfs_fstatat+0x8c/0xb0 fs/stat.c:255 __do_sys_newfstatat+0x91/0x110 fs/stat.c:426 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1353 [inline] free_pcp_prepare+0x549/0xd20 mm/page_alloc.c:1403 free_unref_page_prepare mm/page_alloc.c:3325 [inline] free_unref_page+0x19/0x690 mm/page_alloc.c:3420 __put_single_page mm/swap.c:107 [inline] __put_page+0x145/0x280 mm/swap.c:130 folio_put include/linux/mm.h:1200 [inline] put_page include/linux/mm.h:1233 [inline] anon_pipe_buf_release+0x362/0x4b0 fs/pipe.c:138 pipe_buf_release include/linux/pipe_fs_i.h:203 [inline] pipe_read+0x5ba/0x13f0 fs/pipe.c:323 call_read_iter include/linux/fs.h:2076 [inline] new_sync_read+0x5c2/0x6e0 fs/read_write.c:401 vfs_read+0x49b/0x5e0 fs/read_write.c:482 ksys_read+0x1ee/0x250 fs/read_write.c:620 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Memory state around the buggy address: ffff88805b664100: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff88805b664180: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc >ffff88805b664200: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc ^ ffff88805b664280: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff88805b664300: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc ==================================================================