ci2 starts bisection 2022-12-07 00:22:57.577205616 +0000 UTC m=+26274.670557375 bisecting cause commit starting from 92f701cae0bceb23abbadfd10945d212ca3efe5e building syzkaller on 045cbb84038cc20246f7ec1ef2b4c901b7bef347 ensuring issue is reproducible on original commit 92f701cae0bceb23abbadfd10945d212ca3efe5e testing commit 92f701cae0bceb23abbadfd10945d212ca3efe5e gcc compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 8adf2f4a9c01f8b5a9211998c59a57a19a41963e9cde9eb24bba2192b72310d5 all runs: crashed: KASAN: use-after-free Read in __mark_inode_dirty testing release v5.15.76 testing commit 4f5365f77018349d64386b202b37e8b737236556 gcc compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: a1b369eea9b0790dc92ef6ff68872660b600a0c581806e5a72e303c01b7e8ad1 all runs: crashed: KASAN: use-after-free Read in __mark_inode_dirty testing release v5.15.75 testing commit bd8a595958a5b02e58cdd6fed82d4ebc77b1988a gcc compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 4d34c86d5df7528696468fc34ac11a6237275de3b4d21a52876e05f8667dbe4b all runs: crashed: KASAN: use-after-free Read in __mark_inode_dirty testing release v5.15.74 testing commit a3f2f5ac9d61e973e383f17a95cf2aa384e2d0c4 gcc compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: b9724620ebe58d2c1be062d7cb2dee103bcf74bb0e129b26f66b4a4d06b006fb all runs: OK # git bisect start bd8a595958a5b02e58cdd6fed82d4ebc77b1988a a3f2f5ac9d61e973e383f17a95cf2aa384e2d0c4 Bisecting: 265 revisions left to test after this (roughly 8 steps) [c5c63736d2a11391c32097fb9dcf2e5550fda8c7] iio: adc: at91-sama5d2_adc: check return status for pressure and touch testing commit c5c63736d2a11391c32097fb9dcf2e5550fda8c7 gcc compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: ffc0c6f74e4ef19680cb08045c817aeb8d3a5cd10be7fe5acb4371ec5c8de28b all runs: crashed: KASAN: use-after-free Read in __mark_inode_dirty # git bisect bad c5c63736d2a11391c32097fb9dcf2e5550fda8c7 Bisecting: 132 revisions left to test after this (roughly 7 steps) [60a5174525609969b710ddd4a68586516cd4b63a] drm/i915: Fix watermark calculations for gen12+ CCS+CC modifier testing commit 60a5174525609969b710ddd4a68586516cd4b63a gcc compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 67caaeefd68f580dabb0cd1c6f749e32850217d36b38c5b2478a0b90fd587fb6 run #0: crashed: KASAN: use-after-free Read in __mark_inode_dirty run #1: crashed: KASAN: use-after-free Read in __mark_inode_dirty run #2: crashed: KASAN: use-after-free Read in __mark_inode_dirty run #3: crashed: KASAN: use-after-free Read in __mark_inode_dirty run #4: crashed: KASAN: use-after-free Read in __mark_inode_dirty run #5: crashed: KASAN: use-after-free Read in __mark_inode_dirty run #6: crashed: KASAN: use-after-free Read in __mark_inode_dirty run #7: crashed: KASAN: use-after-free Read in __mark_inode_dirty run #8: crashed: KASAN: use-after-free Read in move_expired_inodes run #9: crashed: KASAN: use-after-free Read in __mark_inode_dirty # git bisect bad 60a5174525609969b710ddd4a68586516cd4b63a Bisecting: 65 revisions left to test after this (roughly 6 steps) [75d9de25a6f833dd0701ca546ac926cabff2b5af] NFSD: Protect against send buffer overflow in NFSv3 READ testing commit 75d9de25a6f833dd0701ca546ac926cabff2b5af gcc compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 9190ebd2f034e5761dcdf2021bc7d22ed1a832c9aea22ed8dc7654efc6271878 all runs: OK # git bisect good 75d9de25a6f833dd0701ca546ac926cabff2b5af Bisecting: 32 revisions left to test after this (roughly 5 steps) [d29fa1ab4e6261f8dae6ba5b0364c3c9ae849342] ext4: fix dir corruption when ext4_dx_add_entry() fails testing commit d29fa1ab4e6261f8dae6ba5b0364c3c9ae849342 gcc compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: a3808b11221dc55f0e5b15995f1aaacb3c53dafc75c97a46f5457c15b3ee3669 all runs: crashed: KASAN: use-after-free Read in __mark_inode_dirty # git bisect bad d29fa1ab4e6261f8dae6ba5b0364c3c9ae849342 Bisecting: 16 revisions left to test after this (roughly 4 steps) [0035b84223debe8a64ebd626b4e8a9f20b96a008] f2fs: flush pending checkpoints when freezing super testing commit 0035b84223debe8a64ebd626b4e8a9f20b96a008 gcc compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 184e3a589358a5aaa7dad03cff013f55774eb943b46878dbf1285d213c20a37a run #0: crashed: KASAN: use-after-free Read in __mark_inode_dirty run #1: crashed: KASAN: use-after-free Read in move_expired_inodes run #2: crashed: KASAN: use-after-free Read in __mark_inode_dirty run #3: crashed: KASAN: use-after-free Read in __mark_inode_dirty run #4: crashed: KASAN: use-after-free Read in __mark_inode_dirty run #5: crashed: KASAN: use-after-free Read in __mark_inode_dirty run #6: crashed: KASAN: use-after-free Read in __mark_inode_dirty run #7: crashed: KASAN: use-after-free Read in __mark_inode_dirty run #8: crashed: KASAN: use-after-free Read in __mark_inode_dirty run #9: crashed: KASAN: use-after-free Read in __mark_inode_dirty # git bisect bad 0035b84223debe8a64ebd626b4e8a9f20b96a008 Bisecting: 7 revisions left to test after this (roughly 3 steps) [2b0897e33682a332167b7d355eec28693b62119e] fbdev: smscufx: Fix use-after-free in ufx_ops_open() testing commit 2b0897e33682a332167b7d355eec28693b62119e gcc compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 04a738fd279cb25e0296baf76f8e0348a55285e8bab2549490a11c1ada3a1c8c all runs: OK # git bisect good 2b0897e33682a332167b7d355eec28693b62119e Bisecting: 3 revisions left to test after this (roughly 2 steps) [0d942303430824f785ac7ed8434a05d87bf4bb13] fs: record I_DIRTY_TIME even if inode already has I_DIRTY_INODE testing commit 0d942303430824f785ac7ed8434a05d87bf4bb13 gcc compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 6898c54ac28b8732d6c274da62933639a588645c4b5e24cf3567d67ac4930bf9 run #0: crashed: KASAN: use-after-free Read in __mark_inode_dirty run #1: crashed: KASAN: use-after-free Read in __mark_inode_dirty run #2: crashed: KASAN: use-after-free Read in move_expired_inodes run #3: crashed: KASAN: use-after-free Read in __mark_inode_dirty run #4: crashed: KASAN: use-after-free Read in __mark_inode_dirty run #5: crashed: KASAN: use-after-free Read in __mark_inode_dirty run #6: crashed: KASAN: use-after-free Read in __mark_inode_dirty run #7: crashed: KASAN: use-after-free Read in __mark_inode_dirty run #8: crashed: KASAN: use-after-free Read in __mark_inode_dirty run #9: crashed: KASAN: use-after-free Read in __mark_inode_dirty # git bisect bad 0d942303430824f785ac7ed8434a05d87bf4bb13 Bisecting: 1 revision left to test after this (roughly 1 step) [a19f316406ea73b2108ff5108610c01bdf876fac] ksmbd: Fix wrong return value and message length check in smb2_ioctl() testing commit a19f316406ea73b2108ff5108610c01bdf876fac gcc compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 2aac1ddca4efbf0e1c01e36f247c1775bf4972640a8633cf3e1fd12d84cb6b58 all runs: OK # git bisect good a19f316406ea73b2108ff5108610c01bdf876fac Bisecting: 0 revisions left to test after this (roughly 0 steps) [95a520b591c91dd4f78135cecb5eed15707b1a36] ksmbd: Fix user namespace mapping testing commit 95a520b591c91dd4f78135cecb5eed15707b1a36 gcc compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 9fbea2016c1243a7bd51fb8d41116e1214cd27520bca3a2f1af2023b320b8f82 all runs: OK # git bisect good 95a520b591c91dd4f78135cecb5eed15707b1a36 0d942303430824f785ac7ed8434a05d87bf4bb13 is the first bad commit commit 0d942303430824f785ac7ed8434a05d87bf4bb13 Author: Lukas Czerner Date: Thu Aug 25 12:06:57 2022 +0200 fs: record I_DIRTY_TIME even if inode already has I_DIRTY_INODE commit cbfecb927f429a6fa613d74b998496bd71e4438a upstream. Currently the I_DIRTY_TIME will never get set if the inode already has I_DIRTY_INODE with assumption that it supersedes I_DIRTY_TIME. That's true, however ext4 will only update the on-disk inode in ->dirty_inode(), not on actual writeback. As a result if the inode already has I_DIRTY_INODE state by the time we get to __mark_inode_dirty() only with I_DIRTY_TIME, the time was already filled into on-disk inode and will not get updated until the next I_DIRTY_INODE update, which might never come if we crash or get a power failure. The problem can be reproduced on ext4 by running xfstest generic/622 with -o iversion mount option. Fix it by allowing I_DIRTY_TIME to be set even if the inode already has I_DIRTY_INODE. Also make sure that the case is properly handled in writeback_single_inode() as well. Additionally changes in xfs_fs_dirty_inode() was made to accommodate for I_DIRTY_TIME in flag. Thanks Jan Kara for suggestions on how to make this work properly. Cc: Dave Chinner Cc: Christoph Hellwig Cc: stable@kernel.org Signed-off-by: Lukas Czerner Suggested-by: Jan Kara Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220825100657.44217-1-lczerner@redhat.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman Documentation/filesystems/vfs.rst | 3 +++ fs/fs-writeback.c | 37 +++++++++++++++++++++++++------------ fs/xfs/xfs_super.c | 10 ++++++++-- include/linux/fs.h | 9 +++++---- 4 files changed, 41 insertions(+), 18 deletions(-) culprit signature: 6898c54ac28b8732d6c274da62933639a588645c4b5e24cf3567d67ac4930bf9 parent signature: 9fbea2016c1243a7bd51fb8d41116e1214cd27520bca3a2f1af2023b320b8f82 revisions tested: 13, total time: 2h35m44.690443474s (build: 1h17m28.582687802s, test: 1h15m37.333600798s) first bad commit: 0d942303430824f785ac7ed8434a05d87bf4bb13 fs: record I_DIRTY_TIME even if inode already has I_DIRTY_INODE recipients (to): ["gregkh@linuxfoundation.org" "jack@suse.cz" "lczerner@redhat.com" "tytso@mit.edu"] recipients (cc): [] crash: KASAN: use-after-free Read in __mark_inode_dirty loop0: detected capacity change from 0 to 128 ================================================================== BUG: KASAN: use-after-free in __list_add_valid+0x4c/0x100 lib/list_debug.c:27 Read of size 8 at addr ffff8881214bc878 by task syz-executor.0/464 CPU: 1 PID: 464 Comm: syz-executor.0 Not tainted 5.15.74-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x105/0x148 lib/dump_stack.c:106 print_address_description+0x87/0x3c0 mm/kasan/report.c:256 __kasan_report mm/kasan/report.c:442 [inline] kasan_report+0x1a2/0x1f0 mm/kasan/report.c:459 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:309 __list_add_valid+0x4c/0x100 lib/list_debug.c:27 __list_add include/linux/list.h:67 [inline] list_add include/linux/list.h:86 [inline] list_move include/linux/list.h:216 [inline] inode_io_list_move_locked+0x163/0x330 fs/fs-writeback.c:125 __mark_inode_dirty+0x40c/0x700 fs/fs-writeback.c:2512 mark_buffer_dirty+0x152/0x210 fs/buffer.c:1112 fat_set_state+0x1fc/0x2c0 fs/fat/inode.c:708 fat_fill_super+0x30f6/0x4660 fs/fat/inode.c:1885 msdos_fill_super+0x12/0x20 fs/fat/namei_msdos.c:655 mount_bdev+0x22b/0x330 fs/super.c:1368 msdos_mount+0x10/0x20 fs/fat/namei_msdos.c:662 legacy_get_tree+0xe7/0x180 fs/fs_context.c:610 vfs_get_tree+0x7e/0x220 fs/super.c:1498 do_new_mount+0x1df/0x930 fs/namespace.c:2994 path_mount+0x677/0xd00 fs/namespace.c:3324 do_mount fs/namespace.c:3337 [inline] __do_sys_mount fs/namespace.c:3545 [inline] __se_sys_mount+0x24a/0x2e0 fs/namespace.c:3522 __x64_sys_mount+0xba/0xd0 fs/namespace.c:3522 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb RIP: 0033:0x7fdc45f1f60a Code: 48 c7 c2 b8 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff eb d2 e8 b8 04 00 00 0f 1f 84 00 00 00 00 00 49 89 ca b8 a5 00 00 00 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:00007fdc45a90f88 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 000000000000023e RCX: 00007fdc45f1f60a RDX: 0000000020000240 RSI: 0000000020000280 RDI: 00007fdc45a90fe0 RBP: 00007fdc45a91020 R08: 00007fdc45a91020 R09: 0000000002800480 R10: 0000000002800480 R11: 0000000000000246 R12: 0000000020000240 R13: 0000000020000280 R14: 00007fdc45a90fe0 R15: 0000000020000080 Allocated by task 460: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] __kasan_slab_alloc+0xb2/0xe0 mm/kasan/common.c:467 kasan_slab_alloc include/linux/kasan.h:254 [inline] slab_post_alloc_hook mm/slab.h:519 [inline] slab_alloc_node mm/slub.c:3220 [inline] slab_alloc mm/slub.c:3228 [inline] kmem_cache_alloc+0x189/0x2f0 mm/slub.c:3233 fat_alloc_inode+0x18/0x90 fs/fat/inode.c:748 alloc_inode fs/inode.c:236 [inline] new_inode_pseudo+0x5a/0x1d0 fs/inode.c:937 new_inode+0x1d/0x1a0 fs/inode.c:966 fat_build_inode+0xec/0x2f0 fs/fat/inode.c:601 msdos_lookup+0x34a/0x440 fs/fat/namei_msdos.c:216 lookup_open fs/namei.c:3312 [inline] open_last_lookups fs/namei.c:3404 [inline] path_openat+0xe82/0x2620 fs/namei.c:3612 do_filp_open+0x24f/0x4a0 fs/namei.c:3642 do_sys_openat2+0x10b/0x420 fs/open.c:1214 do_sys_open fs/open.c:1230 [inline] __do_sys_openat fs/open.c:1246 [inline] __se_sys_openat fs/open.c:1241 [inline] __x64_sys_openat+0x209/0x250 fs/open.c:1241 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb Freed by task 0: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4c/0x80 mm/kasan/common.c:46 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:360 ____kasan_slab_free+0x126/0x160 mm/kasan/common.c:366 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:1705 [inline] slab_free_freelist_hook+0xc9/0x1a0 mm/slub.c:1731 slab_free mm/slub.c:3499 [inline] kmem_cache_free+0x11a/0x2e0 mm/slub.c:3515 fat_free_inode+0x1a/0x20 fs/fat/inode.c:765 i_callback+0x41/0x60 fs/inode.c:225 rcu_do_batch+0x55b/0xbe0 kernel/rcu/tree.c:2509 rcu_core+0x503/0x1000 kernel/rcu/tree.c:2749 rcu_core_si+0x9/0x10 kernel/rcu/tree.c:2762 __do_softirq+0x24e/0x5ac kernel/softirq.c:558 Last potentially related work creation: kasan_save_stack+0x36/0x60 mm/kasan/common.c:38 kasan_record_aux_stack+0xca/0xf0 mm/kasan/generic.c:348 __call_rcu kernel/rcu/tree.c:2993 [inline] call_rcu+0x140/0x1400 kernel/rcu/tree.c:3073 destroy_inode fs/inode.c:291 [inline] evict+0x563/0x5a0 fs/inode.c:602 iput_final fs/inode.c:1663 [inline] iput+0x484/0x5d0 fs/inode.c:1689 dentry_unlink_inode+0x2d2/0x3c0 fs/dcache.c:376 __dentry_kill+0x329/0x4d0 fs/dcache.c:582 dentry_kill+0xc4/0x1f0 dput+0x10f/0x250 fs/dcache.c:888 __fput+0x438/0x660 fs/file_table.c:293 ____fput+0x9/0x10 fs/file_table.c:313 task_work_run+0xd6/0x150 kernel/task_work.c:164 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop+0xfd/0x110 kernel/entry/common.c:175 exit_to_user_mode_prepare kernel/entry/common.c:207 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline] syscall_exit_to_user_mode+0x79/0xc0 kernel/entry/common.c:300 do_syscall_64+0x50/0xd0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x61/0xcb The buggy address belongs to the object at ffff8881214bc700 which belongs to the cache fat_inode_cache of size 768 The buggy address is located 376 bytes inside of 768-byte region [ffff8881214bc700, ffff8881214bca00) The buggy address belongs to the page: page:ffffea0004852f00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1214bc head:ffffea0004852f00 order:2 compound_mapcount:0 compound_pincount:0 flags: 0x4000000000010200(slab|head|zone=1) raw: 4000000000010200 0000000000000000 dead000000000122 ffff8881035fc280 raw: 0000000000000000 0000000080120012 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Reclaimable, gfp_mask 0x1d2050(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_RECLAIMABLE), pid 460, ts 36407218099, free_ts 0 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x15a/0x160 mm/page_alloc.c:2420 prep_new_page mm/page_alloc.c:2426 [inline] get_page_from_freelist+0x38b/0x400 mm/page_alloc.c:4159 __alloc_pages+0x3bd/0x850 mm/page_alloc.c:5421 allocate_slab+0x62/0x580 mm/slub.c:1912 new_slab mm/slub.c:1975 [inline] ___slab_alloc+0x2e2/0x6f0 mm/slub.c:3008 __slab_alloc+0x4a/0x90 mm/slub.c:3095 slab_alloc_node mm/slub.c:3186 [inline] slab_alloc mm/slub.c:3228 [inline] kmem_cache_alloc+0x205/0x2f0 mm/slub.c:3233 fat_alloc_inode+0x18/0x90 fs/fat/inode.c:748 alloc_inode fs/inode.c:236 [inline] new_inode_pseudo+0x5a/0x1d0 fs/inode.c:937 new_inode+0x1d/0x1a0 fs/inode.c:966 fat_fill_super+0x2e75/0x4660 fs/fat/inode.c:1846 msdos_fill_super+0x12/0x20 fs/fat/namei_msdos.c:655 mount_bdev+0x22b/0x330 fs/super.c:1368 msdos_mount+0x10/0x20 fs/fat/namei_msdos.c:662 legacy_get_tree+0xe7/0x180 fs/fs_context.c:610 vfs_get_tree+0x7e/0x220 fs/super.c:1498 page_owner free stack trace missing Memory state around the buggy address: ffff8881214bc700: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881214bc780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8881214bc800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881214bc880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881214bc900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================