| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/10/28 04:24 | flow | patch-triage |
1mArgs:null Results: {
"EnableConfigs": [
"OVERLAY_FS",
"EXT4_FS",
"BTRFS_FS",
"XFS_FS"
],
"FocusSymbols": [
"ovl_write_inode",
"ovl_sync_fs",
"ovl_drop_inode",
"ovl_sync_lazytime",
"ovl_mmap",
"ovl_copyattr",
"ovl_update_time",
"ovl_copy_up_meta_inode_data",
"ovl_inode_update"
],
"KMSANReasoning": "The patch series optimizes overlayfs dirty inode tracking and synchronization for underlying filesystems supporting SB_I_OVL_USE_SYNC_FS (btrfs, ext4, xfs). It introduces dirty tracking operations (ovl_tracks_dirty, ovl_mark_inode_dirty, ovl_sync_lazytime, ovl_write_inode, ovl_drop_inode), sets up backing device info on the overlay superblock when dirty tracking is enabled, and adjusts sync_fs behavior.\n\nThese changes alter filesystem internal state machines, inode writeback, and synchronization flags. They do not introduce or modify any kernel-to-user copies (such as copy_to_user, put_user, ioctl outputs, netlink attributes, or BPF helpers), nor do they create or modify any uninitialized memory allocations or conditionally branch on uninitialized variables. Any potential bugs introduced by these changes would be related to locking, inode reference lifecycle, or concurrency/data corruption, which are covered by standard bug detectors (KASAN, LOCKDEP) rather than KMSAN. Therefore, a dedicated KMSAN fuzzing session is not warranted.",
"NeedsKMSAN": false,
"Reasoning": "The patch modifies OverlayFS dirty inode tracking and writeback handling when backed by filesystems supporting SB_I_OVL_USE_SYNC_FS (ext4, btrfs, xfs). It introduces custom .write_inode, .drop_inode, and .sync_lazytime superblock and inode operations, adjusts sync_fs behavior, and marks overlay inodes dirty across copy-up, mmap, and attribute updates. These changes significantly alter inode lifecycle and writeback state machines and are directly exercisable via standard VFS syscalls (mount, syncfs, mmap, fsync).",
"WorthFuzzing": true
} |
| 1/1 | 2026/10/28 04:24 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit 64ab42f83b206b4de0e9c6266eb7828ce82e6263\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Wed Oct 28 04:24:44 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/fs/btrfs/super.c b/fs/btrfs/super.c\nindex 7fabb775d4e3f6..cdecf90bdae0cd 100644\n--- a/fs/btrfs/super.c\n+++ b/fs/btrfs/super.c\n@@ -981,7 +981,7 @@ static int btrfs_fill_super(struct super_block *sb,\n #endif\n \tsb-\u003es_xattr = btrfs_xattr_handlers;\n \tsb-\u003es_time_gran = 1;\n-\tsb-\u003es_iflags |= SB_I_CGROUPWB | SB_I_ALLOW_HSM;\n+\tsb-\u003es_iflags |= SB_I_CGROUPWB | SB_I_ALLOW_HSM | SB_I_OVL_USE_SYNC_FS;\n \n \tret = super_setup_bdi(sb);\n \tif (ret) {\ndiff --git a/fs/ext4/super.c b/fs/ext4/super.c\nindex 3ace06b4f9e3a1..037e274dca8aa8 100644\n--- a/fs/ext4/super.c\n+++ b/fs/ext4/super.c\n@@ -5542,6 +5542,7 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)\n \t\terr = ext4_load_and_init_journal(sb, es, ctx);\n \t\tif (err)\n \t\t\tgoto failed_mount3a;\n+\t\tsb-\u003es_iflags |= SB_I_OVL_USE_SYNC_FS;\n \t\tif (bdev_read_only(sb-\u003es_bdev))\n \t\t needs_recovery = 0;\n \t} else if (test_opt(sb, NOLOAD) \u0026\u0026 !sb_rdonly(sb) \u0026\u0026\ndiff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c\nindex e963701b4c8775..12ad3ada551709 100644\n--- a/fs/overlayfs/copy_up.c\n+++ b/fs/overlayfs/copy_up.c\n@@ -1122,6 +1122,8 @@ static int ovl_copy_up_meta_inode_data(struct ovl_copy_up_ctx *c)\n \tovl_clear_flag(OVL_HAS_DIGEST, d_inode(c-\u003edentry));\n \tovl_clear_flag(OVL_VERIFIED_DIGEST, d_inode(c-\u003edentry));\n \tovl_set_upperdata(d_inode(c-\u003edentry));\n+\t/* The data is in the upper inode now, and nobody may ever write to it */\n+\tovl_mark_inode_dirty(d_inode(c-\u003edentry));\n out_free:\n \tkfree(capability);\n out:\ndiff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c\nindex 1194ccf981c37b..fc47beffa67e27 100644\n--- a/fs/overlayfs/dir.c\n+++ b/fs/overlayfs/dir.c\n@@ -1489,6 +1489,7 @@ const struct inode_operations ovl_dir_inode_operations = {\n \t.get_acl\t= ovl_get_acl,\n \t.set_acl\t= ovl_set_acl,\n \t.update_time\t= ovl_update_time,\n+\t.sync_lazytime\t= ovl_sync_lazytime,\n \t.fileattr_get\t= ovl_fileattr_get,\n \t.fileattr_set\t= ovl_fileattr_set,\n \t.tmpfile\t= ovl_tmpfile,\ndiff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c\nindex 7433220d4ad6c4..cdc552c76878ef 100644\n--- a/fs/overlayfs/file.c\n+++ b/fs/overlayfs/file.c\n@@ -473,7 +473,13 @@ static int ovl_mmap(struct file *file, struct vm_area_struct *vma)\n \t\t.accessed = ovl_file_accessed,\n \t};\n \n-\treturn backing_file_mmap(of-\u003erealfile, vma, \u0026ctx);\n+\tint err;\n+\n+\terr = backing_file_mmap(of-\u003erealfile, vma, \u0026ctx);\n+\t/* Stores through the mapping go straight to the upper inode */\n+\tif (!err \u0026\u0026 vma_is_shared_maywrite(vma))\n+\t\tovl_mark_inode_dirty(file_inode(file));\n+\treturn err;\n }\n \n static long ovl_fallocate(struct file *file, int mode, loff_t offset, loff_t len)\ndiff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c\nindex 63906b3dafcbc6..85880296901742 100644\n--- a/fs/overlayfs/inode.c\n+++ b/fs/overlayfs/inode.c\n@@ -587,6 +587,7 @@ int ovl_update_time(struct inode *inode, enum fs_update_time type,\n \t\t\ttouch_atime(\u0026upperpath);\n \t\t\tinode_set_atime_to_ts(inode,\n \t\t\t\t\t inode_get_atime(d_inode(upperpath.dentry)));\n+\t\t\tovl_mark_inode_dirty(inode);\n \t\t}\n \t}\n \treturn 0;\n@@ -742,6 +743,20 @@ int ovl_fileattr_get(struct dentry *dentry, struct file_kattr *fa)\n \treturn err;\n }\n \n+/*\n+ * The overlay inode has I_DIRTY_TIME because the upper inode has, see\n+ * ovl_park_inode(). Pass it on, and keep track of the upper inode until that\n+ * has been written.\n+ */\n+void ovl_sync_lazytime(struct inode *inode)\n+{\n+\tstruct inode *upper = ovl_inode_upper(inode);\n+\n+\tif (upper \u0026\u0026 (inode_state_read_once(upper) \u0026 I_DIRTY_TIME))\n+\t\tmark_inode_dirty_sync(upper);\n+\tovl_mark_inode_dirty(inode);\n+}\n+\n static const struct inode_operations ovl_file_inode_operations = {\n \t.setattr\t= ovl_setattr,\n \t.permission\t= ovl_permission,\n@@ -751,6 +766,7 @@ static const struct inode_operations ovl_file_inode_operations = {\n \t.get_acl\t= ovl_get_acl,\n \t.set_acl\t= ovl_set_acl,\n \t.update_time\t= ovl_update_time,\n+\t.sync_lazytime\t= ovl_sync_lazytime,\n \t.fiemap\t\t= ovl_fiemap,\n \t.fileattr_get\t= ovl_fileattr_get,\n \t.fileattr_set\t= ovl_fileattr_set,\n@@ -762,6 +778,7 @@ static const struct inode_operations ovl_symlink_inode_operations = {\n \t.getattr\t= ovl_getattr,\n \t.listxattr\t= ovl_listxattr,\n \t.update_time\t= ovl_update_time,\n+\t.sync_lazytime\t= ovl_sync_lazytime,\n };\n \n static const struct inode_operations ovl_special_inode_operations = {\n@@ -773,6 +790,7 @@ static const struct inode_operations ovl_special_inode_operations = {\n \t.get_acl\t= ovl_get_acl,\n \t.set_acl\t= ovl_set_acl,\n \t.update_time\t= ovl_update_time,\n+\t.sync_lazytime\t= ovl_sync_lazytime,\n };\n \n static const struct address_space_operations ovl_aops = {\n@@ -898,7 +916,8 @@ void ovl_inode_init(struct inode *inode, struct ovl_inode_params *oip,\n \toi-\u003elowerdata_redirect = oip-\u003elowerdata_redirect;\n \n \trealinode = ovl_inode_real(inode);\n-\tovl_copyattr(inode);\n+\t/* Nothing was changed, the inode is only being looked up */\n+\t__ovl_copyattr(inode);\n \tovl_copyflags(realinode, inode);\n \tovl_map_ino(inode, ino, fsid);\n }\ndiff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h\nindex 92da556598da5e..ad1084be6191db 100644\n--- a/fs/overlayfs/overlayfs.h\n+++ b/fs/overlayfs/overlayfs.h\n@@ -663,6 +663,32 @@ static inline bool ovl_should_sync(struct ovl_fs *ofs)\n \treturn ofs-\u003econfig.fsync_mode != OVL_FSYNC_VOLATILE;\n }\n \n+/*\n+ * Does this overlay keep track of the upper inodes which are changed through\n+ * it, to sync only those? It knows where it wrote data. It does not know of\n+ * every inode which the upper filesystem dirtied on its behalf, so that has to\n+ * be a filesystem where -\u003esync_fs() takes care of all metadata. With any other\n+ * one syncfs() and unmount sync the whole upper filesystem.\n+ */\n+static inline bool ovl_tracks_dirty(struct ovl_fs *ofs)\n+{\n+\treturn ovl_upper_mnt(ofs) \u0026\u0026 ovl_should_sync(ofs) \u0026\u0026\n+\t (ovl_upper_mnt(ofs)-\u003emnt_sb-\u003es_iflags \u0026 SB_I_OVL_USE_SYNC_FS);\n+}\n+\n+/*\n+ * The upper inode was changed through this overlay. Put the overlay inode on\n+ * the dirty list of the overlay, for syncfs and unmount to find.\n+ *\n+ * Do not look at the state of the upper inode here. Its dirty flags are\n+ * cleared when its writeback starts, not when it is done.\n+ */\n+static inline void ovl_mark_inode_dirty(struct inode *inode)\n+{\n+\tif (ovl_tracks_dirty(OVL_FS(inode-\u003ei_sb)))\n+\t\tmark_inode_dirty(inode);\n+}\n+\n static inline bool ovl_should_sync_metadata(struct ovl_fs *ofs)\n {\n \treturn ofs-\u003econfig.fsync_mode == OVL_FSYNC_STRICT;\n@@ -841,6 +867,7 @@ static inline struct posix_acl *ovl_get_acl_path(const struct path *path,\n \n int ovl_update_time(struct inode *inode, enum fs_update_time type,\n \t\tunsigned int flags);\n+void ovl_sync_lazytime(struct inode *inode);\n bool ovl_is_private_xattr(struct super_block *sb, const char *name);\n \n struct ovl_inode_params {\n@@ -860,6 +887,7 @@ bool ovl_lookup_trap_inode(struct super_block *sb, struct dentry *dir);\n struct inode *ovl_get_trap_inode(struct super_block *sb, struct dentry *dir);\n struct inode *ovl_get_inode(struct super_block *sb,\n \t\t\t struct ovl_inode_params *oip);\n+void __ovl_copyattr(struct inode *to);\n void ovl_copyattr(struct inode *to);\n \n /* vfs fileattr flags read from overlay.protattr xattr to ovl inode */\ndiff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c\nindex 19b6d54c4500b7..c570bf7103f843 100644\n--- a/fs/overlayfs/super.c\n+++ b/fs/overlayfs/super.c\n@@ -15,6 +15,9 @@\n #include \u003clinux/seq_file.h\u003e\n #include \u003clinux/posix_acl_xattr.h\u003e\n #include \u003clinux/exportfs.h\u003e\n+#include \u003clinux/blkdev.h\u003e\n+#include \u003clinux/pagemap.h\u003e\n+#include \u003clinux/writeback.h\u003e\n #include \u003clinux/file.h\u003e\n #include \u003clinux/fs_context.h\u003e\n #include \u003clinux/fs_parser.h\u003e\n@@ -267,18 +270,45 @@ static int ovl_sync_fs(struct super_block *sb, int wait)\n \t/*\n \t * Not called for sync(2) call or an emergency sync (SB_I_SKIP_SYNC).\n \t * All the super blocks will be iterated, including upper_sb.\n-\t *\n-\t * If this is a syncfs(2) call, then we do need to call\n-\t * sync_filesystem() on upper_sb, but enough if we do it when being\n-\t * called with wait == 1.\n \t */\n-\tif (!wait)\n-\t\treturn 0;\n-\n \tupper_sb = ovl_upper_mnt(ofs)-\u003emnt_sb;\n \n+\tif (!ovl_tracks_dirty(ofs)) {\n+\t\t/*\n+\t\t * If this is a syncfs(2) call, then we do need to call\n+\t\t * sync_filesystem() on upper_sb, but enough if we do it when\n+\t\t * being called with wait == 1.\n+\t\t */\n+\t\tif (!wait)\n+\t\t\treturn 0;\n+\n+\t\tdown_read(\u0026upper_sb-\u003es_umount);\n+\t\tret = sync_filesystem(upper_sb);\n+\t\tup_read(\u0026upper_sb-\u003es_umount);\n+\n+\t\treturn ret;\n+\t}\n+\n+\t/*\n+\t * For syncfs(2) and for unmount, sync_filesystem() has written the\n+\t * dirty inodes of this overlay by now, see ovl_write_inode(). What is\n+\t * left is for the upper filesystem to commit its metadata. The dirty\n+\t * inodes of everybody else on the upper filesystem are none of our\n+\t * business.\n+\t */\n \tdown_read(\u0026upper_sb-\u003es_umount);\n-\tret = sync_filesystem(upper_sb);\n+\t/* As in sync_filesystem(): -\u003esync_fs() doesn't expect to be called then */\n+\tret = 0;\n+\tif (sb_rdonly(upper_sb))\n+\t\tgoto out;\n+\n+\tif (upper_sb-\u003es_op-\u003esync_fs)\n+\t\tret = upper_sb-\u003es_op-\u003esync_fs(upper_sb, wait);\n+\tif (!ret \u0026\u0026 wait)\n+\t\tret = sync_blockdev(upper_sb-\u003es_bdev);\n+\telse if (!ret)\n+\t\tret = sync_blockdev_nowait(upper_sb-\u003es_bdev);\n+out:\n \tup_read(\u0026upper_sb-\u003es_umount);\n \n \treturn ret;\n@@ -313,12 +343,102 @@ static int ovl_statfs(struct dentry *dentry, struct kstatfs *buf)\n \treturn err;\n }\n \n+/*\n+ * Could there be anything left to write or to wait for on @upper?\n+ *\n+ * Whoever has it open for writing may have it mapped, and stores through a\n+ * mapping go unnoticed. The mapping holds the file open.\n+ *\n+ * Writeback which was only started, by us or by the flusher of the upper\n+ * filesystem, shows in the page cache tags until it is done. The dirty flags\n+ * of the inode do not, they are cleared at the start.\n+ *\n+ * Metadata is not looked at. The upper filesystem logs it, see\n+ * ovl_tracks_dirty(), and ovl_sync_fs() has the log committed.\n+ *\n+ * Nothing orders these reads. The one order which matters is to not see\n+ * i_writecount at zero and miss the tag of a page which was dirtied through\n+ * the mapping. The tag is set when the mapping goes away at the latest, the\n+ * count drops when the file is released after that, with the locks of\n+ * unmapping and of the final fput in between.\n+ */\n+static bool ovl_upper_unfinished(struct inode *upper)\n+{\n+\tstruct address_space *mapping = upper-\u003ei_mapping;\n+\n+\treturn inode_is_open_for_write(upper) ||\n+\t mapping_tagged(mapping, PAGECACHE_TAG_DIRTY) ||\n+\t mapping_tagged(mapping, PAGECACHE_TAG_WRITEBACK) ||\n+\t (inode_state_read_once(upper) \u0026 I_SYNC);\n+}\n+\n+/*\n+ * All that is left of @inode are timestamps which lazytime holds back on the\n+ * upper filesystem. A pass which does not wait leaves them alone, for up to 12\n+ * hours. Do to the overlay inode what was done to the upper inode: with\n+ * I_DIRTY_TIME it is off the list which the flusher walks, syncfs() still gets\n+ * to it, and ovl_sync_lazytime() is told when the time has come.\n+ *\n+ * One such time is when the last reference goes away, which it never does for\n+ * the upper inode as long as the overlay inode is there. It may have gone away\n+ * already. iput() looks for I_DIRTY_TIME under i_lock before it drops the last\n+ * reference, so either it sees the flag or the count is zero here.\n+ */\n+static void ovl_park_inode(struct inode *inode)\n+{\n+\tif (!ovl_tracks_dirty(OVL_FS(inode-\u003ei_sb)))\n+\t\treturn;\n+\n+\t__mark_inode_dirty(inode, I_DIRTY_TIME);\n+\tif (!icount_read_once(inode))\n+\t\tmark_inode_dirty_sync(inode);\n+}\n+\n+static int ovl_write_inode(struct inode *inode, struct writeback_control *wbc)\n+{\n+\tstruct inode *upper = ovl_inode_upper(inode);\n+\tint ret;\n+\n+\tif (!upper)\n+\t\treturn 0;\n+\n+\t/*\n+\t * Go through writeback_single_inode(), I_SYNC is what serializes us\n+\t * with the writeback of the upper filesystem.\n+\t */\n+\tret = write_inode_now(upper, wbc-\u003esync_mode == WB_SYNC_ALL);\n+\n+\tif (ovl_upper_unfinished(upper))\n+\t\tovl_mark_inode_dirty(inode);\n+\telse if (inode_state_read_once(upper) \u0026 I_DIRTY_TIME)\n+\t\tovl_park_inode(inode);\n+\n+\treturn ret;\n+}\n+\n+/*\n+ * In iput_final(), clean inode will drop directly and dirty inode will\n+ * keep in the cache until write back to sync dirty data then add to lru\n+ * list to wait reclaim.\n+ *\n+ * An inode under writeback has its dirty flags cleared, and only I_SYNC pins\n+ * it. It is not clean: ovl_write_inode() may be about to mark it dirty again,\n+ * which does nothing for an inode which is being freed.\n+ */\n+static int ovl_drop_inode(struct inode *inode)\n+{\n+\tif (!(inode_state_read(inode) \u0026 (I_DIRTY_ALL | I_SYNC)))\n+\t\treturn 1;\n+\treturn inode_generic_drop(inode);\n+}\n+\n static const struct super_operations ovl_super_operations = {\n \t.alloc_inode\t= ovl_alloc_inode,\n \t.free_inode\t= ovl_free_inode,\n \t.destroy_inode\t= ovl_destroy_inode,\n-\t.drop_inode\t= inode_just_drop,\n+\t.drop_inode\t= ovl_drop_inode,\n \t.put_super\t= ovl_put_super,\n+\t.write_inode\t= ovl_write_inode,\n \t.sync_fs\t= ovl_sync_fs,\n \t.statfs\t\t= ovl_statfs,\n \t.show_options\t= ovl_show_options,\n@@ -1455,6 +1575,13 @@ static int ovl_fill_super_creds(struct fs_context *fc, struct super_block *sb)\n \t\tif (err)\n \t\t\treturn err;\n \n+\t\t/* Dirty overlay inodes need a writeback list to be on */\n+\t\tif (ovl_tracks_dirty(ofs)) {\n+\t\t\terr = super_setup_bdi(sb);\n+\t\t\tif (err)\n+\t\t\t\treturn err;\n+\t\t}\n+\n \t\tupper_sb = ovl_upper_mnt(ofs)-\u003emnt_sb;\n \t\tif (!ovl_should_sync(ofs)) {\n \t\t\tofs-\u003eerrseq = errseq_sample(\u0026upper_sb-\u003es_wb_err);\ndiff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c\nindex 521717209b2e44..e7402459548eed 100644\n--- a/fs/overlayfs/util.c\n+++ b/fs/overlayfs/util.c\n@@ -604,6 +604,8 @@ void ovl_inode_update(struct inode *inode, struct dentry *upperdentry)\n \t\tinode-\u003ei_private = upperinode;\n \t\t__insert_inode_hash(inode, (unsigned long) upperinode);\n \t}\n+\t/* The copy up has written to the upper inode */\n+\tovl_mark_inode_dirty(inode);\n }\n \n static void ovl_dir_version_inc(struct dentry *dentry, bool impurity)\n@@ -1492,7 +1494,7 @@ int ovl_sync_status(struct ovl_fs *ofs)\n * map any lower or upper inode owned by id 1001 to id 1000. These mapping\n * helpers are nops when the relevant layer isn't idmapped.\n */\n-void ovl_copyattr(struct inode *inode)\n+void __ovl_copyattr(struct inode *inode)\n {\n \tstruct path realpath;\n \tstruct inode *realinode;\n@@ -1516,3 +1518,13 @@ void ovl_copyattr(struct inode *inode)\n \ti_size_write(inode, i_size_read(realinode));\n \tspin_unlock(\u0026inode-\u003ei_lock);\n }\n+\n+/*\n+ * The attributes are copied because the real inode was changed through the\n+ * overlay, so this is also where the overlay inode becomes dirty.\n+ */\n+void ovl_copyattr(struct inode *inode)\n+{\n+\t__ovl_copyattr(inode);\n+\tovl_mark_inode_dirty(inode);\n+}\ndiff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c\nindex 5a06132aa38466..2f09d48b7e6f06 100644\n--- a/fs/xfs/xfs_super.c\n+++ b/fs/xfs/xfs_super.c\n@@ -1924,7 +1924,7 @@ xfs_fs_fill_super(\n \t\tsb-\u003es_time_max = XFS_LEGACY_TIME_MAX;\n \t}\n \ttrace_xfs_inode_timestamp_range(mp, sb-\u003es_time_min, sb-\u003es_time_max);\n-\tsb-\u003es_iflags |= SB_I_CGROUPWB | SB_I_ALLOW_HSM;\n+\tsb-\u003es_iflags |= SB_I_CGROUPWB | SB_I_ALLOW_HSM | SB_I_OVL_USE_SYNC_FS;\n \n \tset_posix_acl_flag(sb);\n \ndiff --git a/include/linux/fs/super_types.h b/include/linux/fs/super_types.h\nindex 72f4288e16c526..370b0d27815bd7 100644\n--- a/include/linux/fs/super_types.h\n+++ b/include/linux/fs/super_types.h\n@@ -359,5 +359,6 @@ struct super_block {\n #define SB_I_NOIDMAP\t0x00002000\t/* No idmapped mounts on this superblock */\n #define SB_I_ALLOW_HSM\t0x00004000\t/* Allow HSM events on this superblock */\n #define SB_I_NO_DATA_INTEGRITY\t0x00008000 /* fs cannot guarantee data persistence on sync */\n+#define SB_I_OVL_USE_SYNC_FS\t0x00010000 /* overlayfs: -\u003esync_fs() commits all metadata */\n \n #endif /* _LINUX_FS_SUPER_TYPES_H */\n"
} |
| 2/1 | 2026/10/28 04:24 | agent | patch-evaluator |
1mModel:core Args: null Results: {
"EnableConfigs": [
"OVERLAY_FS",
"EXT4_FS",
"BTRFS_FS",
"XFS_FS"
],
"FocusSymbols": [
"ovl_write_inode",
"ovl_sync_fs",
"ovl_drop_inode",
"ovl_sync_lazytime",
"ovl_mmap",
"ovl_copyattr",
"ovl_update_time",
"ovl_copy_up_meta_inode_data",
"ovl_inode_update"
],
"Reasoning": "The patch modifies OverlayFS dirty inode tracking and writeback handling when backed by filesystems supporting SB_I_OVL_USE_SYNC_FS (ext4, btrfs, xfs). It introduces custom .write_inode, .drop_inode, and .sync_lazytime superblock and inode operations, adjusts sync_fs behavior, and marks overlay inodes dirty across copy-up, mmap, and attribute updates. These changes significantly alter inode lifecycle and writeback state machines and are directly exercisable via standard VFS syscalls (mount, syncfs, mmap, fsync).",
"WorthFuzzing": true
}Instruction: You are an expert Linux kernel maintainer and security engineer.
Your job is to review a provided patch series and evaluate whether it warrants fuzzing with syzkaller.
IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on internal assumptions. You must actively use your code access
tools to inspect the actual source code, callers, and surrounding context.
================================================================================
1. CORE TRIAGE PHILOSOPHY
================================================================================
The goal of patch fuzzing is to discover crashes, regressions, exposed latent bugs,
and newly triggered assertions introduced by the patch series.
- REACHABILITY IS THE PRIMARY GATE:
Fuzzing can only discover bugs in code that can actually execute in standard virtualized
environments (GCE or QEMU, utilizing software-emulated devices like USB gadgets, netdev, tun/tap).
If the modified code is structurally unreachable (see Section 2), it MUST NOT be fuzzed,
regardless of whether it adds assertions or complex logic.
- DO NOT BLINDLY TRUST "NO FUNCTIONAL CHANGE" (NFCI) OR "REFACTORING" CLAIMS:
Patch authors routinely label changes as "cleanups", "refactorings", or state
"No functional change intended". Do NOT take these claims at face value.
Code refactorings that rearrange logic, introduce helper functions, or alter state management
in core subsystems frequently introduce subtle semantic shifts or uncover latent kernel bugs.
If reachable executable code is modified or refactored, it MUST be fuzzed.
- NEW OR MODIFIED ASSERTIONS IN REACHABLE CODE MUST BE FUZZED:
When a patch introduces or modifies runtime checks or assertions (e.g., WARN_ON*, VM_WARN_ON*,
BUG_ON*, lockdep_assert*) in reachable code paths, it enforces new or stricter invariants.
Even if the author believes the invariant always holds, fuzzing is essential to verify whether
an unusual sequence of operations can violate it.
================================================================================
2. WHEN TO RETURN WorthFuzzing=false (NEGATIVE CRITERIA)
================================================================================
Return WorthFuzzing=false ONLY IF all modified code falls strictly into one or more of these categories:
- Non-kernel and non-executable changes:
* Modifications to Documentation/, comments, or spelling fixes.
* User-space directories, self-tests, samples, or scripts (e.g., tools/, samples/, scripts/, usr/)
that do not affect the compiled kernel image (vmlinux) or kernel modules.
* Purely decorative logging (e.g., message strings in pr_err, printk, dev_info) or tracepoints
that do not alter control flow or data structures.
* Build system or Kconfig changes that do not alter compiled C logic.
- Structurally unreachable hardware:
* Vendor-specific PCIe switches, SmartNICs, or GPU drivers (e.g., mlxsw, pds_core, qed,
ionic, amdgpu) requiring physical ASIC/PCIe cards not emulated in standard QEMU.
- Unreachable execution paths:
* Driver teardown callbacks (.remove, .shutdown, pci_unregister_driver) executed only during
physical PCI hot-unplug or manual sysfs driver unbinding.
* Code paths exclusive to architectures other than the target architecture.
================================================================================
3. WHEN TO RETURN WorthFuzzing=true (POSITIVE CRITERIA)
================================================================================
Return WorthFuzzing=true whenever the patch touches reachable executable code, including:
- Core Subsystems:
* Any logic modifications in memory management (mm/), synchronization/locking (kernel/locking/),
BPF, scheduler, core networking, VFS, or syscall handling.
- Refactorings and Code Cleanups:
* Any restructuring of reachable data structures, helper abstractions, or algorithm flows.
- Runtime Assertions and Defensive Checks:
* Any introduction or alteration of assertions (WARN_ON*, VM_WARN_ON*, BUG_ON*, etc.) in reachable paths.
- Reachable Drivers and Protocols:
* Drivers accessible via virtual buses (virtio, USB gadget, loopback, netlink, binder, sockets, etc.).
================================================================================
4. EXTRACTING FocusSymbols (PREVENTING DILUTION)
================================================================================
When WorthFuzzing=true, you must extract specific kernel functions into FocusSymbols to guide the fuzzer:
- AVOID UBIQUITOUS LIFECYCLE HOT-PATHS:
Do NOT list generic, ubiquitous functions called by almost every program in the corpus
(including, but not limited to: general memory allocators and deallocators, page fault
and trap handlers, or core synchronization primitives; this is not an exhaustive list).
Listing ubiquitous functions causes the fuzzer to classify thousands of unrelated tests as "focused",
which severely dilutes fuzzing effort away from the actual changes.
- TARGET SPECIFIC FEATURE LOGIC AND ENTRYPOINTS:
List functions that specifically implement the logic being added or altered, or direct API entrypoints
for the subsystem feature under review.
- HANDLING STATIC INLINE FUNCTIONS IN HEADERS (.h):
Compiler-inlined static functions (such as static inlines in mm/*.h or include/linux/*.h) lack
distinct symbol addresses in vmlinux and cannot be targeted directly by symbol coverage filters.
If the changes are primarily in static inline helpers, identify non-static, feature-specific caller
functions in .c files that exercise them (avoiding ubiquitous lifecycle wrappers).
================================================================================
5. IDENTIFYING EnableConfigs
================================================================================
Identify any specific CONFIG_ options required to properly compile and reach the modified code:
- Inspect Kconfig files and #ifdef guards; do not make assumptions.
- Check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed.
- Strip any 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4").
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Target architecture: amd64
For your convenience, here is the diff of the changes:
commit 64ab42f83b206b4de0e9c6266eb7828ce82e6263
Author: syz-cluster <triage@syzkaller.com>
Date: Wed Oct 28 04:24:44 2026 +0000
syz-cluster: applied patch under review
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 7fabb775d4e3f6..cdecf90bdae0cd 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -981,7 +981,7 @@ static int btrfs_fill_super(struct super_block *sb,
#endif
sb->s_xattr = btrfs_xattr_handlers;
sb->s_time_gran = 1;
- sb->s_iflags |= SB_I_CGROUPWB | SB_I_ALLOW_HSM;
+ sb->s_iflags |= SB_I_CGROUPWB | SB_I_ALLOW_HSM | SB_I_OVL_USE_SYNC_FS;
ret = super_setup_bdi(sb);
if (ret) {
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 3ace06b4f9e3a1..037e274dca8aa8 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -5542,6 +5542,7 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
err = ext4_load_and_init_journal(sb, es, ctx);
if (err)
goto failed_mount3a;
+ sb->s_iflags |= SB_I_OVL_USE_SYNC_FS;
if (bdev_read_only(sb->s_bdev))
needs_recovery = 0;
} else if (test_opt(sb, NOLOAD) && !sb_rdonly(sb) &&
diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
index e963701b4c8775..12ad3ada551709 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -1122,6 +1122,8 @@ static int ovl_copy_up_meta_inode_data(struct ovl_copy_up_ctx *c)
ovl_clear_flag(OVL_HAS_DIGEST, d_inode(c->dentry));
ovl_clear_flag(OVL_VERIFIED_DIGEST, d_inode(c->dentry));
ovl_set_upperdata(d_inode(c->dentry));
+ /* The data is in the upper inode now, and nobody may ever write to it */
+ ovl_mark_inode_dirty(d_inode(c->dentry));
out_free:
kfree(capability);
out:
diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
index 1194ccf981c37b..fc47beffa67e27 100644
--- a/fs/overlayfs/dir.c
+++ b/fs/overlayfs/dir.c
@@ -1489,6 +1489,7 @@ const struct inode_operations ovl_dir_inode_operations = {
.get_acl = ovl_get_acl,
.set_acl = ovl_set_acl,
.update_time = ovl_update_time,
+ .sync_lazytime = ovl_sync_lazytime,
.fileattr_get = ovl_fileattr_get,
.fileattr_set = ovl_fileattr_set,
.tmpfile = ovl_tmpfile,
diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c
index 7433220d4ad6c4..cdc552c76878ef 100644
--- a/fs/overlayfs/file.c
+++ b/fs/overlayfs/file.c
@@ -473,7 +473,13 @@ static int ovl_mmap(struct file *file, struct vm_area_struct *vma)
.accessed = ovl_file_accessed,
};
- return backing_file_mmap(of->realfile, vma, &ctx);
+ int err;
+
+ err = backing_file_mmap(of->realfile, vma, &ctx);
+ /* Stores through the mapping go straight to the upper inode */
+ if (!err && vma_is_shared_maywrite(vma))
+ ovl_mark_inode_dirty(file_inode(file));
+ return err;
}
static long ovl_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
index 63906b3dafcbc6..85880296901742 100644
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -587,6 +587,7 @@ int ovl_update_time(struct inode *inode, enum fs_update_time type,
touch_atime(&upperpath);
inode_set_atime_to_ts(inode,
inode_get_atime(d_inode(upperpath.dentry)));
+ ovl_mark_inode_dirty(inode);
}
}
return 0;
@@ -742,6 +743,20 @@ int ovl_fileattr_get(struct dentry *dentry, struct file_kattr *fa)
return err;
}
+/*
+ * The overlay inode has I_DIRTY_TIME because the upper inode has, see
+ * ovl_park_inode(). Pass it on, and keep track of the upper inode until that
+ * has been written.
+ */
+void ovl_sync_lazytime(struct inode *inode)
+{
+ struct inode *upper = ovl_inode_upper(inode);
+
+ if (upper && (inode_state_read_once(upper) & I_DIRTY_TIME))
+ mark_inode_dirty_sync(upper);
+ ovl_mark_inode_dirty(inode);
+}
+
static const struct inode_operations ovl_file_inode_operations = {
.setattr = ovl_setattr,
.permission = ovl_permission,
@@ -751,6 +766,7 @@ static const struct inode_operations ovl_file_inode_operations = {
.get_acl = ovl_get_acl,
.set_acl = ovl_set_acl,
.update_time = ovl_update_time,
+ .sync_lazytime = ovl_sync_lazytime,
.fiemap = ovl_fiemap,
.fileattr_get = ovl_fileattr_get,
.fileattr_set = ovl_fileattr_set,
@@ -762,6 +778,7 @@ static const struct inode_operations ovl_symlink_inode_operations = {
.getattr = ovl_getattr,
.listxattr = ovl_listxattr,
.update_time = ovl_update_time,
+ .sync_lazytime = ovl_sync_lazytime,
};
static const struct inode_operations ovl_special_inode_operations = {
@@ -773,6 +790,7 @@ static const struct inode_operations ovl_special_inode_operations = {
.get_acl = ovl_get_acl,
.set_acl = ovl_set_acl,
.update_time = ovl_update_time,
+ .sync_lazytime = ovl_sync_lazytime,
};
static const struct address_space_operations ovl_aops = {
@@ -898,7 +916,8 @@ void ovl_inode_init(struct inode *inode, struct ovl_inode_params *oip,
oi->lowerdata_redirect = oip->lowerdata_redirect;
realinode = ovl_inode_real(inode);
- ovl_copyattr(inode);
+ /* Nothing was changed, the inode is only being looked up */
+ __ovl_copyattr(inode);
ovl_copyflags(realinode, inode);
ovl_map_ino(inode, ino, fsid);
}
diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h
index 92da556598da5e..ad1084be6191db 100644
--- a/fs/overlayfs/overlayfs.h
+++ b/fs/overlayfs/overlayfs.h
@@ -663,6 +663,32 @@ static inline bool ovl_should_sync(struct ovl_fs *ofs)
return ofs->config.fsync_mode != OVL_FSYNC_VOLATILE;
}
+/*
+ * Does this overlay keep track of the upper inodes which are changed through
+ * it, to sync only those? It knows where it wrote data. It does not know of
+ * every inode which the upper filesystem dirtied on its behalf, so that has to
+ * be a filesystem where ->sync_fs() takes care of all metadata. With any other
+ * one syncfs() and unmount sync the whole upper filesystem.
+ */
+static inline bool ovl_tracks_dirty(struct ovl_fs *ofs)
+{
+ return ovl_upper_mnt(ofs) && ovl_should_sync(ofs) &&
+ (ovl_upper_mnt(ofs)->mnt_sb->s_iflags & SB_I_OVL_USE_SYNC_FS);
+}
+
+/*
+ * The upper inode was changed through this overlay. Put the overlay inode on
+ * the dirty list of the overlay, for syncfs and unmount to find.
+ *
+ * Do not look at the state of the upper inode here. Its dirty flags are
+ * cleared when its writeback starts, not when it is done.
+ */
+static inline void ovl_mark_inode_dirty(struct inode *inode)
+{
+ if (ovl_tracks_dirty(OVL_FS(inode->i_sb)))
+ mark_inode_dirty(inode);
+}
+
static inline bool ovl_should_sync_metadata(struct ovl_fs *ofs)
{
return ofs->config.fsync_mode == OVL_FSYNC_STRICT;
@@ -841,6 +867,7 @@ static inline struct posix_acl *ovl_get_acl_path(const struct path *path,
int ovl_update_time(struct inode *inode, enum fs_update_time type,
unsigned int flags);
+void ovl_sync_lazytime(struct inode *inode);
bool ovl_is_private_xattr(struct super_block *sb, const char *name);
struct ovl_inode_params {
@@ -860,6 +887,7 @@ bool ovl_lookup_trap_inode(struct super_block *sb, struct dentry *dir);
struct inode *ovl_get_trap_inode(struct super_block *sb, struct dentry *dir);
struct inode *ovl_get_inode(struct super_block *sb,
struct ovl_inode_params *oip);
+void __ovl_copyattr(struct inode *to);
void ovl_copyattr(struct inode *to);
/* vfs fileattr flags read from overlay.protattr xattr to ovl inode */
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 19b6d54c4500b7..c570bf7103f843 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -15,6 +15,9 @@
#include <linux/seq_file.h>
#include <linux/posix_acl_xattr.h>
#include <linux/exportfs.h>
+#include <linux/blkdev.h>
+#include <linux/pagemap.h>
+#include <linux/writeback.h>
#include <linux/file.h>
#include <linux/fs_context.h>
#include <linux/fs_parser.h>
@@ -267,18 +270,45 @@ static int ovl_sync_fs(struct super_block *sb, int wait)
/*
* Not called for sync(2) call or an emergency sync (SB_I_SKIP_SYNC).
* All the super blocks will be iterated, including upper_sb.
- *
- * If this is a syncfs(2) call, then we do need to call
- * sync_filesystem() on upper_sb, but enough if we do it when being
- * called with wait == 1.
*/
- if (!wait)
- return 0;
-
upper_sb = ovl_upper_mnt(ofs)->mnt_sb;
+ if (!ovl_tracks_dirty(ofs)) {
+ /*
+ * If this is a syncfs(2) call, then we do need to call
+ * sync_filesystem() on upper_sb, but enough if we do it when
+ * being called with wait == 1.
+ */
+ if (!wait)
+ return 0;
+
+ down_read(&upper_sb->s_umount);
+ ret = sync_filesystem(upper_sb);
+ up_read(&upper_sb->s_umount);
+
+ return ret;
+ }
+
+ /*
+ * For syncfs(2) and for unmount, sync_filesystem() has written the
+ * dirty inodes of this overlay by now, see ovl_write_inode(). What is
+ * left is for the upper filesystem to commit its metadata. The dirty
+ * inodes of everybody else on the upper filesystem are none of our
+ * business.
+ */
down_read(&upper_sb->s_umount);
- ret = sync_filesystem(upper_sb);
+ /* As in sync_filesystem(): ->sync_fs() doesn't expect to be called then */
+ ret = 0;
+ if (sb_rdonly(upper_sb))
+ goto out;
+
+ if (upper_sb->s_op->sync_fs)
+ ret = upper_sb->s_op->sync_fs(upper_sb, wait);
+ if (!ret && wait)
+ ret = sync_blockdev(upper_sb->s_bdev);
+ else if (!ret)
+ ret = sync_blockdev_nowait(upper_sb->s_bdev);
+out:
up_read(&upper_sb->s_umount);
return ret;
@@ -313,12 +343,102 @@ static int ovl_statfs(struct dentry *dentry, struct kstatfs *buf)
return err;
}
+/*
+ * Could there be anything left to write or to wait for on @upper?
+ *
+ * Whoever has it open for writing may have it mapped, and stores through a
+ * mapping go unnoticed. The mapping holds the file open.
+ *
+ * Writeback which was only started, by us or by the flusher of the upper
+ * filesystem, shows in the page cache tags until it is done. The dirty flags
+ * of the inode do not, they are cleared at the start.
+ *
+ * Metadata is not looked at. The upper filesystem logs it, see
+ * ovl_tracks_dirty(), and ovl_sync_fs() has the log committed.
+ *
+ * Nothing orders these reads. The one order which matters is to not see
+ * i_writecount at zero and miss the tag of a page which was dirtied through
+ * the mapping. The tag is set when the mapping goes away at the latest, the
+ * count drops when the file is released after that, with the locks of
+ * unmapping and of the final fput in between.
+ */
+static bool ovl_upper_unfinished(struct inode *upper)
+{
+ struct address_space *mapping = upper->i_mapping;
+
+ return inode_is_open_for_write(upper) ||
+ mapping_tagged(mapping, PAGECACHE_TAG_DIRTY) ||
+ mapping_tagged(mapping, PAGECACHE_TAG_WRITEBACK) ||
+ (inode_state_read_once(upper) & I_SYNC);
+}
+
+/*
+ * All that is left of @inode are timestamps which lazytime holds back on the
+ * upper filesystem. A pass which does not wait leaves them alone, for up to 12
+ * hours. Do to the overlay inode what was done to the upper inode: with
+ * I_DIRTY_TIME it is off the list which the flusher walks, syncfs() still gets
+ * to it, and ovl_sync_lazytime() is told when the time has come.
+ *
+ * One such time is when the last reference goes away, which it never does for
+ * the upper inode as long as the overlay inode is there. It may have gone away
+ * already. iput() looks for I_DIRTY_TIME under i_lock before it drops the last
+ * reference, so either it sees the flag or the count is zero here.
+ */
+static void ovl_park_inode(struct inode *inode)
+{
+ if (!ovl_tracks_dirty(OVL_FS(inode->i_sb)))
+ return;
+
+ __mark_inode_dirty(inode, I_DIRTY_TIME);
+ if (!icount_read_once(inode))
+ mark_inode_dirty_sync(inode);
+}
+
+static int ovl_write_inode(struct inode *inode, struct writeback_control *wbc)
+{
+ struct inode *upper = ovl_inode_upper(inode);
+ int ret;
+
+ if (!upper)
+ return 0;
+
+ /*
+ * Go through writeback_single_inode(), I_SYNC is what serializes us
+ * with the writeback of the upper filesystem.
+ */
+ ret = write_inode_now(upper, wbc->sync_mode == WB_SYNC_ALL);
+
+ if (ovl_upper_unfinished(upper))
+ ovl_mark_inode_dirty(inode);
+ else if (inode_state_read_once(upper) & I_DIRTY_TIME)
+ ovl_park_inode(inode);
+
+ return ret;
+}
+
+/*
+ * In iput_final(), clean inode will drop directly and dirty inode will
+ * keep in the cache until write back to sync dirty data then add to lru
+ * list to wait reclaim.
+ *
+ * An inode under writeback has its dirty flags cleared, and only I_SYNC pins
+ * it. It is not clean: ovl_write_inode() may be about to mark it dirty again,
+ * which does nothing for an inode which is being freed.
+ */
+static int ovl_drop_inode(struct inode *inode)
+{
+ if (!(inode_state_read(inode) & (I_DIRTY_ALL | I_SYNC)))
+ return 1;
+ return inode_generic_drop(inode);
+}
+
static const struct super_operations ovl_super_operations = {
.alloc_inode = ovl_alloc_inode,
.free_inode = ovl_free_inode,
.destroy_inode = ovl_destroy_inode,
- .drop_inode = inode_just_drop,
+ .drop_inode = ovl_drop_inode,
.put_super = ovl_put_super,
+ .write_inode = ovl_write_inode,
.sync_fs = ovl_sync_fs,
.statfs = ovl_statfs,
.show_options = ovl_show_options,
@@ -1455,6 +1575,13 @@ static int ovl_fill_super_creds(struct fs_context *fc, struct super_block *sb)
if (err)
return err;
+ /* Dirty overlay inodes need a writeback list to be on */
+ if (ovl_tracks_dirty(ofs)) {
+ err = super_setup_bdi(sb);
+ if (err)
+ return err;
+ }
+
upper_sb = ovl_upper_mnt(ofs)->mnt_sb;
if (!ovl_should_sync(ofs)) {
ofs->errseq = errseq_sample(&upper_sb->s_wb_err);
diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c
index 521717209b2e44..e7402459548eed 100644
--- a/fs/overlayfs/util.c
+++ b/fs/overlayfs/util.c
@@ -604,6 +604,8 @@ void ovl_inode_update(struct inode *inode, struct dentry *upperdentry)
inode->i_private = upperinode;
__insert_inode_hash(inode, (unsigned long) upperinode);
}
+ /* The copy up has written to the upper inode */
+ ovl_mark_inode_dirty(inode);
}
static void ovl_dir_version_inc(struct dentry *dentry, bool impurity)
@@ -1492,7 +1494,7 @@ int ovl_sync_status(struct ovl_fs *ofs)
* map any lower or upper inode owned by id 1001 to id 1000. These mapping
* helpers are nops when the relevant layer isn't idmapped.
*/
-void ovl_copyattr(struct inode *inode)
+void __ovl_copyattr(struct inode *inode)
{
struct path realpath;
struct inode *realinode;
@@ -1516,3 +1518,13 @@ void ovl_copyattr(struct inode *inode)
i_size_write(inode, i_size_read(realinode));
spin_unlock(&inode->i_lock);
}
+
+/*
+ * The attributes are copied because the real inode was changed through the
+ * overlay, so this is also where the overlay inode becomes dirty.
+ */
+void ovl_copyattr(struct inode *inode)
+{
+ __ovl_copyattr(inode);
+ ovl_mark_inode_dirty(inode);
+}
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 5a06132aa38466..2f09d48b7e6f06 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1924,7 +1924,7 @@ xfs_fs_fill_super(
sb->s_time_max = XFS_LEGACY_TIME_MAX;
}
trace_xfs_inode_timestamp_range(mp, sb->s_time_min, sb->s_time_max);
- sb->s_iflags |= SB_I_CGROUPWB | SB_I_ALLOW_HSM;
+ sb->s_iflags |= SB_I_CGROUPWB | SB_I_ALLOW_HSM | SB_I_OVL_USE_SYNC_FS;
set_posix_acl_flag(sb);
diff --git a/include/linux/fs/super_types.h b/include/linux/fs/super_types.h
index 72f4288e16c526..370b0d27815bd7 100644
--- a/include/linux/fs/super_types.h
+++ b/include/linux/fs/super_types.h
@@ -359,5 +359,6 @@ struct super_block {
#define SB_I_NOIDMAP 0x00002000 /* No idmapped mounts on this superblock */
#define SB_I_ALLOW_HSM 0x00004000 /* Allow HSM events on this superblock */
#define SB_I_NO_DATA_INTEGRITY 0x00008000 /* fs cannot guarantee data persistence on sync */
+#define SB_I_OVL_USE_SYNC_FS 0x00010000 /* overlayfs: ->sync_fs() commits all metadata */
#endif /* _LINUX_FS_SUPER_TYPES_H */
|
| 3/2 | 2026/10/28 04:24 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 9171 output: 32 thoughts: 782 Thoughts: **Analyzing Potential Fuzzing Targets in Filesystem Code** Okay, so I'm looking at a patch that makes some substantial changes across several filesystem components. My initial impression is that this is potentially very interesting from a security perspective. It looks like the patch is adding new functionality or modifying existing behavior related to `syncfs` and writeback operations, specifically within `overlayfs`, and it seems to integrate this with `btrfs`, `ext4`, and `xfs`. The code introduces `SB_I_OVL_USE_SYNC_FS` which suggests a direct link to `syncfs`. Specifically, I see modifications to: * **Superblock initialization:** Adding `SB_I_OVL_USE_SYNC_FS` to the `btrfs`, `ext4`, and `xfs` superblock initialization functions. This is a common pattern for conditional behavior. * **Overlayfs core logic:** Significant changes to `overlayfs` files related to copying up operations (`copy_up.c`), directory handling (`dir.c`), file mapping (`file.c`), and inode management (`inode.c`). The introduction of `ovl_sync_lazytime` and `ovl_mark_inode_dirty` coupled with calls within `ovl_copy_up_meta_inode_data`, `ovl_mmap`, and `ovl_inode_update`, immediately catches my eye as potential areas. * **Overlayfs superblock and utilities:** The changes to `super.c` and `util.c` are also noteworthy. The addition of functions like `ovl_upper_unfinished`, `ovl_park_inode`, `ovl_write_inode`, and `ovl_drop_inode` along with the update to the `super_operations` struct are significant, which is key. The `ovl_fill_super_creds` which calls `super_setup_bdi(sb)` when `ovl_tracks_dirty(ofs)` looks important. * **A new flag:** The `include/linux/fs/super_types.h` file defining `SB_I_OVL_USE_SYNC_FS` is the central point. My first thought is, is this reachable, and more importantly, is it worth fuzzing? Given that this hits core filesystem code, I'd say YES, definitely worth the effort. It involves interactions between overlayfs and the underlying filesystems (btrfs, ext4, xfs) for the writeback implementation, lazytime handling, dropping inodes, and mmap. Overlayfs is a common target for syzkaller, which means there should be an existing infrastructure to test and fuzz these interactions using unprivileged user namespaces and mount syscalls, plus various underlying filesystems. Now, let's drill down. I need to figure out the minimal configuration needed to trigger this code path. I'll need to check the relevant `Kconfig` options for overlayfs, btrfs, ext4, and xfs. A quick `grep` through the kernel source or just reading the Kconfig files will give me the needed answers. |
| 4/2 | 2026/10/28 04:25 | tool | grepper |
0mArgs:{
"Expression": "OVERLAY_FS",
"PathPrefixes": [
"fs/overlayfs/Kconfig"
]
}Results: {
"Output": "fs/overlayfs/Kconfig-1-# SPDX-License-Identifier: GPL-2.0-only\nfs/overlayfs/Kconfig:2:config OVERLAY_FS\nfs/overlayfs/Kconfig-3-\ttristate \"Overlay filesystem support\"\n--\nfs/overlayfs/Kconfig-14-\nfs/overlayfs/Kconfig:15:config OVERLAY_FS_REDIRECT_DIR\nfs/overlayfs/Kconfig-16-\tbool \"Overlayfs: turn on redirect directory feature by default\"\nfs/overlayfs/Kconfig:17:\tdepends on OVERLAY_FS\nfs/overlayfs/Kconfig-18-\thelp\n--\nfs/overlayfs/Kconfig-30-\nfs/overlayfs/Kconfig:31:config OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW\nfs/overlayfs/Kconfig-32-\tbool \"Overlayfs: follow redirects even if redirects are turned off\"\nfs/overlayfs/Kconfig-33-\tdefault y\nfs/overlayfs/Kconfig:34:\tdepends on OVERLAY_FS\nfs/overlayfs/Kconfig-35-\thelp\n--\nfs/overlayfs/Kconfig-45-\nfs/overlayfs/Kconfig:46:config OVERLAY_FS_INDEX\nfs/overlayfs/Kconfig-47-\tbool \"Overlayfs: turn on inodes index feature by default\"\nfs/overlayfs/Kconfig:48:\tdepends on OVERLAY_FS\nfs/overlayfs/Kconfig-49-\thelp\n--\nfs/overlayfs/Kconfig-64-\nfs/overlayfs/Kconfig:65:config OVERLAY_FS_NFS_EXPORT\nfs/overlayfs/Kconfig-66-\tbool \"Overlayfs: turn on NFS export feature by default\"\nfs/overlayfs/Kconfig:67:\tdepends on OVERLAY_FS\nfs/overlayfs/Kconfig:68:\tdepends on OVERLAY_FS_INDEX\nfs/overlayfs/Kconfig:69:\tdepends on !OVERLAY_FS_METACOPY\nfs/overlayfs/Kconfig-70-\thelp\n--\nfs/overlayfs/Kconfig-92-\nfs/overlayfs/Kconfig:93:config OVERLAY_FS_XINO_AUTO\nfs/overlayfs/Kconfig-94-\tbool \"Overlayfs: auto enable inode number mapping\"\nfs/overlayfs/Kconfig-95-\tdefault n\nfs/overlayfs/Kconfig:96:\tdepends on OVERLAY_FS\nfs/overlayfs/Kconfig-97-\tdepends on 64BIT\n--\nfs/overlayfs/Kconfig-110-\nfs/overlayfs/Kconfig:111:config OVERLAY_FS_METACOPY\nfs/overlayfs/Kconfig-112-\tbool \"Overlayfs: turn on metadata only copy up feature by default\"\nfs/overlayfs/Kconfig:113:\tdepends on OVERLAY_FS\nfs/overlayfs/Kconfig:114:\tselect OVERLAY_FS_REDIRECT_DIR\nfs/overlayfs/Kconfig-115-\thelp\n--\nfs/overlayfs/Kconfig-128-\nfs/overlayfs/Kconfig:129:config OVERLAY_FS_DEBUG\nfs/overlayfs/Kconfig-130-\tbool \"Overlayfs: turn on extra debugging checks\"\nfs/overlayfs/Kconfig-131-\tdefault n\nfs/overlayfs/Kconfig:132:\tdepends on OVERLAY_FS\nfs/overlayfs/Kconfig-133-\thelp\n"
} |
| 5/2 | 2026/10/28 04:25 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 11504 output: 18 thoughts: 1123 Thoughts: **OverlayFS Synchronization Logic Deep Dive** Okay, let's break this down. First, I need to understand the sync behavior, especially given the various filesystems involved: `OVERLAY_FS`, `EXT4_FS`, `BTRFS_FS`, and `XFS_FS`. I see that `SB_I_OVL_USE_SYNC_FS` is key, and `ovl_tracks_dirty` determines if we should sync based on whether the upper filesystem sets this flag. From the code, it's used with Btrfs, ext4 (when journaled), and XFS. Now, let's identify the specific functions that are added or modified, the focus symbols. I initially listed `ovl_sync_fs`, `ovl_write_inode`, and `ovl_drop_inode` as modified, but wait… I need to refine that list, and make sure that my definition of focus symbols is correct! I need to avoid including generic functions. I was concerned that static functions within `.c` files might not be valid focus symbols, but they *can* be, unless inlined. So I need to go through the functions again, and make sure to capture the non-static symbols, or the static ones pointed to by `super_operations`. I re-read the definition of FocusSymbols and understand I need to be careful to select feature-specific entry points and logic. OK. I now need to review the list more carefully. I note `ovl_sync_fs` is modified and calls `upper_sb->s_op->sync_fs` etc., which is good. I also have `ovl_write_inode` and `ovl_drop_inode`, which are super_operation callbacks. I was distracted by static functions. OK! Let's check the non-static ones: `ovl_sync_lazytime`, `__ovl_copyattr`, `ovl_copyattr`, `ovl_update_time`. I see `ovl_mmap` in the file. Now, I need to make sure I am on the right track! Are these functions feature-specific? Let me specifically check `ovl_sync_lazytime`. Time to grep the VFS. |
| 6/2 | 2026/10/28 04:25 | tool | grepper |
0mArgs:{
"Expression": "sync_lazytime"
}Results: {
"Output": "Documentation/filesystems/locking.rst=62=prototypes::\n--\nDocumentation/filesystems/locking.rst-84-\t\t\t int flags);\nDocumentation/filesystems/locking.rst:85:\tvoid (*sync_lazytime)(struct inode *inode);\nDocumentation/filesystems/locking.rst-86-\tint (*atomic_open)(struct inode *, struct dentry *,\n--\nDocumentation/filesystems/locking.rst=121=update_time:\tno\nDocumentation/filesystems/locking.rst:122:sync_lazytime:\tno\nDocumentation/filesystems/locking.rst-123-atomic_open:\tshared (exclusive if O_CREAT is set in open flags)\n--\nDocumentation/filesystems/vfs.rst=413=As of kernel 2.6.22, the following members are defined:\n--\nDocumentation/filesystems/vfs.rst-437-\t\t\t\t int flags);\nDocumentation/filesystems/vfs.rst:438:\t\tvoid (*sync_lazytime)(struct inode *inode);\nDocumentation/filesystems/vfs.rst-439-\t\tint (*atomic_open)(struct inode *, struct dentry *, struct file *,\n--\nDocumentation/filesystems/vfs.rst=451=otherwise noted.\n--\nDocumentation/filesystems/vfs.rst-594-\nDocumentation/filesystems/vfs.rst:595:``sync_lazytime``:\nDocumentation/filesystems/vfs.rst-596-\tcalled by the writeback code to update the lazy time stamps to\n--\nfs/fs-writeback.c=1695=static void requeue_inode(struct inode *inode, struct bdi_writeback *wb,\n--\nfs/fs-writeback.c-1760-\nfs/fs-writeback.c:1761:static bool __sync_lazytime(struct inode *inode)\nfs/fs-writeback.c-1762-{\n--\nfs/fs-writeback.c-1769-\tspin_unlock(\u0026inode-\u003ei_lock);\nfs/fs-writeback.c:1770:\tinode-\u003ei_op-\u003esync_lazytime(inode);\nfs/fs-writeback.c-1771-\treturn true;\n--\nfs/fs-writeback.c-1773-\nfs/fs-writeback.c:1774:bool sync_lazytime(struct inode *inode)\nfs/fs-writeback.c-1775-{\n--\nfs/fs-writeback.c-1779-\ttrace_writeback_lazytime(inode);\nfs/fs-writeback.c:1780:\tif (inode-\u003ei_op-\u003esync_lazytime)\nfs/fs-writeback.c:1781:\t\treturn __sync_lazytime(inode);\nfs/fs-writeback.c-1782-\tmark_inode_dirty_sync(inode);\n--\nfs/fs-writeback.c=1798=__writeback_single_inode(struct inode *inode, struct writeback_control *wbc)\n--\nfs/fs-writeback.c-1832-\t\t\tdirtytime_expire_interval * HZ)))\nfs/fs-writeback.c:1833:\t\tsync_lazytime(inode);\nfs/fs-writeback.c-1834-\n--\nfs/fs-writeback.c=2715=void __mark_inode_dirty(struct inode *inode, int flags)\n--\nfs/fs-writeback.c-2751-\t\t\t\tflags \u0026 (I_DIRTY_INODE | I_DIRTY_TIME));\nfs/fs-writeback.c:2752:\t\t} else if (was_dirty_time \u0026\u0026 inode-\u003ei_op-\u003esync_lazytime) {\nfs/fs-writeback.c:2753:\t\t\tinode-\u003ei_op-\u003esync_lazytime(inode);\nfs/fs-writeback.c-2754-\t\t}\n--\nfs/inode.c=2037=void iput(struct inode *inode)\n--\nfs/inode.c-2055-\nfs/inode.c:2056:\tif (inode-\u003ei_nlink \u0026\u0026 sync_lazytime(inode))\nfs/inode.c-2057-\t\tgoto retry;\n--\nfs/internal.h=223=long get_nr_dirty_inodes(void);\nfs/internal.h:224:bool sync_lazytime(struct inode *inode);\nfs/internal.h-225-\n--\nfs/overlayfs/dir.c=1474=const struct inode_operations ovl_dir_inode_operations = {\n--\nfs/overlayfs/dir.c-1491-\t.update_time\t= ovl_update_time,\nfs/overlayfs/dir.c:1492:\t.sync_lazytime\t= ovl_sync_lazytime,\nfs/overlayfs/dir.c-1493-\t.fileattr_get\t= ovl_fileattr_get,\n--\nfs/overlayfs/inode.c=731=int ovl_fileattr_get(struct dentry *dentry, struct file_kattr *fa)\n--\nfs/overlayfs/inode.c-750- */\nfs/overlayfs/inode.c:751:void ovl_sync_lazytime(struct inode *inode)\nfs/overlayfs/inode.c-752-{\n--\nfs/overlayfs/inode.c=760=static const struct inode_operations ovl_file_inode_operations = {\n--\nfs/overlayfs/inode.c-768-\t.update_time\t= ovl_update_time,\nfs/overlayfs/inode.c:769:\t.sync_lazytime\t= ovl_sync_lazytime,\nfs/overlayfs/inode.c-770-\t.fiemap\t\t= ovl_fiemap,\n--\nfs/overlayfs/inode.c=775=static const struct inode_operations ovl_symlink_inode_operations = {\n--\nfs/overlayfs/inode.c-780-\t.update_time\t= ovl_update_time,\nfs/overlayfs/inode.c:781:\t.sync_lazytime\t= ovl_sync_lazytime,\nfs/overlayfs/inode.c-782-};\n--\nfs/overlayfs/inode.c=784=static const struct inode_operations ovl_special_inode_operations = {\n--\nfs/overlayfs/inode.c-792-\t.update_time\t= ovl_update_time,\nfs/overlayfs/inode.c:793:\t.sync_lazytime\t= ovl_sync_lazytime,\nfs/overlayfs/inode.c-794-};\n--\nfs/overlayfs/overlayfs.h=868=int ovl_update_time(struct inode *inode, enum fs_update_time type,\nfs/overlayfs/overlayfs.h-869-\t\tunsigned int flags);\nfs/overlayfs/overlayfs.h:870:void ovl_sync_lazytime(struct inode *inode);\nfs/overlayfs/overlayfs.h-871-bool ovl_is_private_xattr(struct super_block *sb, const char *name);\n--\nfs/overlayfs/super.c=365=static bool ovl_upper_unfinished(struct inode *upper)\n--\nfs/overlayfs/super.c-379- * I_DIRTY_TIME it is off the list which the flusher walks, syncfs() still gets\nfs/overlayfs/super.c:380: * to it, and ovl_sync_lazytime() is told when the time has come.\nfs/overlayfs/super.c-381- *\n--\nfs/sync.c=179=int vfs_fsync_range(struct file *file, loff_t start, loff_t end, int datasync)\n--\nfs/sync.c-185-\tif (!datasync)\nfs/sync.c:186:\t\tsync_lazytime(inode);\nfs/sync.c-187-\treturn file-\u003ef_op-\u003efsync(file, start, end, datasync);\n--\nfs/xfs/xfs_iops.c=1230=static void\nfs/xfs/xfs_iops.c:1231:xfs_vn_sync_lazytime(\nfs/xfs/xfs_iops.c-1232-\tstruct inode\t\t*inode)\n--\nfs/xfs/xfs_iops.c=1281=static const struct inode_operations xfs_inode_operations = {\n--\nfs/xfs/xfs_iops.c-1288-\t.update_time\t\t= xfs_vn_update_time,\nfs/xfs/xfs_iops.c:1289:\t.sync_lazytime\t\t= xfs_vn_sync_lazytime,\nfs/xfs/xfs_iops.c-1290-\t.fileattr_get\t\t= xfs_fileattr_get,\n--\nfs/xfs/xfs_iops.c=1294=static const struct inode_operations xfs_dir_inode_operations = {\n--\nfs/xfs/xfs_iops.c-1315-\t.update_time\t\t= xfs_vn_update_time,\nfs/xfs/xfs_iops.c:1316:\t.sync_lazytime\t\t= xfs_vn_sync_lazytime,\nfs/xfs/xfs_iops.c-1317-\t.tmpfile\t\t= xfs_vn_tmpfile,\n--\nfs/xfs/xfs_iops.c=1322=static const struct inode_operations xfs_dir_ci_inode_operations = {\n--\nfs/xfs/xfs_iops.c-1343-\t.update_time\t\t= xfs_vn_update_time,\nfs/xfs/xfs_iops.c:1344:\t.sync_lazytime\t\t= xfs_vn_sync_lazytime,\nfs/xfs/xfs_iops.c-1345-\t.tmpfile\t\t= xfs_vn_tmpfile,\n--\nfs/xfs/xfs_iops.c=1350=static const struct inode_operations xfs_symlink_inode_operations = {\n--\nfs/xfs/xfs_iops.c-1355-\t.update_time\t\t= xfs_vn_update_time,\nfs/xfs/xfs_iops.c:1356:\t.sync_lazytime\t\t= xfs_vn_sync_lazytime,\nfs/xfs/xfs_iops.c-1357-\t.fileattr_get\t\t= xfs_fileattr_get,\n--\ninclude/linux/fs.h=1998=struct inode_operations {\n--\ninclude/linux/fs.h-2026-\t\t\t unsigned int flags);\ninclude/linux/fs.h:2027:\tvoid (*sync_lazytime)(struct inode *inode);\ninclude/linux/fs.h-2028-\tint (*atomic_open)(struct inode *, struct dentry *,\n"
} |
| 7/2 | 2026/10/28 04:25 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 15918 output: 67 thoughts: 1454 Thoughts: **Analyzing OverlayFS Lazytime Synchronization** Okay, so `sync_lazytime` is triggered when lazytime is dirtied in inodes, and overlayfs is now integrating this with `.sync_lazytime = ovl_sync_lazytime`. I'm going through the overlayfs changes, noting these additions: `ovl_sync_fs`, `ovl_write_inode`, `ovl_drop_inode`, `ovl_sync_lazytime`, `ovl_mmap`, `ovl_copyattr`, and `ovl_update_time`. I need to understand if these are potentially problematic, or if they are in hot paths. I'm also seeing `ovl_copy_up_meta_inode_data`, `ovl_inode_update`, `__ovl_copyattr`, `ovl_fill_super_creds` (super_setup_bdi(sb) added), `ovl_upper_unfinished`, and `ovl_park_inode` in various overlayfs source files. These are overlayfs specific, so I can exclude any ubiquitous filesystem operations like `mark_inode_dirty` or `sync_filesystem` as not relevant. I am looking for overlayfs-specific functions like `ovl_write_inode`, `ovl_sync_fs`, `ovl_drop_inode`, and the rest. Now, let's see if we have inlines, because inlined functions are tricky for symbol coverage. I see that `ovl_tracks_dirty` and `ovl_mark_inode_dirty` are static inline functions in `fs/overlayfs/overlayfs.h`. That means I need to focus on *callers* of these functions in the `.c` files. The callers of `ovl_mark_inode_dirty` are: `ovl_copy_up_meta_inode_data`, `ovl_mmap`, `ovl_update_time`, `ovl_sync_lazytime`, `ovl_inode_update`, `ovl_copyattr`, and `ovl_write_inode`. `ovl_tracks_dirty` is called by `ovl_sync_fs`, `ovl_park_inode` and `ovl_fill_super_creds`. The important thing now is to look at Kconfig options, to check for dependencies. `OVERLAY_FS` is required. I see that it's tristate and has no direct dependencies. However, the patch enables `SB_I_OVL_USE_SYNC_FS` for Btrfs, Ext4, and XFS. This means that if overlayfs is used *over* ext4, btrfs, or xfs, then these options must be enabled. Otherwise, `SB_I_OVL_USE_SYNC_FS` isn't set. Looking at `ovl_tracks_dirty`, it returns true *only* if `SB_I_OVL_USE_SYNC_FS` is set on the upper superblock. So, without `EXT4_FS`, `BTRFS_FS`, or `XFS_FS` enabled, `ovl_tracks_dirty` is *always* false. This effectively means that all this new logic added around `ovl_mark_inode_dirty`, `ovl_drop_inode`, etc. is disabled! At least one of `EXT4_FS`, `BTRFS_FS`, or `XFS_FS` is *critical* for this functionality to even be active, alongside `OVERLAY_FS`. I'll need to double check the Kconfig for ext4, btrfs and xfs. |
| 8/2 | 2026/10/28 04:25 | tool | grepper |
0mArgs:{
"Expression": "config (EXT4_FS|BTRFS_FS|XFS_FS)$",
"PathPrefixes": [
"fs/ext4/Kconfig",
"fs/btrfs/Kconfig",
"fs/xfs/Kconfig"
]
}Results: {
"Output": "fs/btrfs/Kconfig-2-\nfs/btrfs/Kconfig:3:config BTRFS_FS\nfs/btrfs/Kconfig-4-\ttristate \"Btrfs filesystem support\"\n--\nfs/ext4/Kconfig-1-# SPDX-License-Identifier: GPL-2.0-only\nfs/ext4/Kconfig:2:config EXT4_FS\nfs/ext4/Kconfig-3-\ttristate \"The Extended 4 (ext4) filesystem\"\n--\nfs/xfs/Kconfig-1-# SPDX-License-Identifier: GPL-2.0-only\nfs/xfs/Kconfig:2:config XFS_FS\nfs/xfs/Kconfig-3-\ttristate \"XFS filesystem support\"\n"
} |
| 9/2 | 2026/10/28 04:25 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 18422 output: 38 thoughts: 101 Thoughts: **Investigating OverlayFS Metacopy Configuration** Okay, let's dive in. I need to make sure I haven't missed any other configuration options related to `overlayfs`, specifically around metacopy functionality. My immediate thought is to check for any flags like `OVERLAY_FS_METACOPY` that might be relevant. My gut feeling is that something exists, so I'm double-checking. Right, I'm now looking into `fs/overlayfs/copy_up.c`. I recall that `ovl_copy_up_meta_inode_data` is directly related to metacopy behavior, particularly when dealing with the `OVERLAY_FS_METACOPY` configuration option. Now, let me get a clear picture of what `ovl_copy_up_meta_inode_data` actually does. I'm going to carefully review that function within `fs/overlayfs/copy_up.c`. |
| 10/2 | 2026/10/28 04:25 | tool | grepper |
0mArgs:{
"Expression": "ovl_copy_up_meta_inode_data",
"PathPrefixes": [
"fs/overlayfs/"
]
}Results: {
"Output": "fs/overlayfs/copy_up.c=1058=static ssize_t ovl_getxattr_value(const struct path *path, char *name, char **value)\n--\nfs/overlayfs/copy_up.c-1081-/* Copy up data of an inode which was copied up metadata only in the past. */\nfs/overlayfs/copy_up.c:1082:static int ovl_copy_up_meta_inode_data(struct ovl_copy_up_ctx *c)\nfs/overlayfs/copy_up.c-1083-{\n--\nfs/overlayfs/copy_up.c=1133=static int ovl_copy_up_one(struct dentry *parent, struct dentry *dentry,\n--\nfs/overlayfs/copy_up.c-1202-\t\tif (!err \u0026\u0026 ovl_dentry_needs_data_copy_up_locked(dentry, flags))\nfs/overlayfs/copy_up.c:1203:\t\t\terr = ovl_copy_up_meta_inode_data(\u0026ctx);\nfs/overlayfs/copy_up.c-1204-\t\tovl_copy_up_end(dentry);\n--\nfs/overlayfs/util.c=534=bool ovl_has_upperdata(struct inode *inode)\n--\nfs/overlayfs/util.c-542-\t * Pairs with smp_wmb() in ovl_set_upperdata(). Main user of\nfs/overlayfs/util.c:543:\t * ovl_has_upperdata() is ovl_copy_up_meta_inode_data(). Make sure\nfs/overlayfs/util.c-544-\t * if setting of OVL_UPPERDATA is visible, then effects of writes\n"
} |
| 11/2 | 2026/10/28 04:25 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 19206 output: 266 thoughts: 930 Thoughts: **Analysis of OverlayFS Writeback Tracking for Fuzzing** Alright, let's break this down. First, I confirmed that `OVERLAY_FS_METACOPY` is an option, accessible via `fs/overlayfs/Kconfig`. This requires `OVERLAY_FS`, naturally, and also `EXT4_FS`, `BTRFS_FS`, and `XFS_FS`. This looks like the right area to poke. Now, let's look at the symbols. `ovl_sync_fs`, `ovl_write_inode`, `ovl_drop_inode`, `ovl_sync_lazytime`, `ovl_mmap`, `ovl_copyattr`, `ovl_update_time`, `ovl_copy_up_meta_inode_data`, and `ovl_inode_update`—these all look *directly* related to overlayfs-specific functionality. I can ignore the `btrfs_fill_super`, `__ext4_fill_super`, and `xfs_fs_fill_super` symbols, they merely have a single flag set, the changes are actually in overlayfs. The focus is definitely on the overlayfs internals. A quick review of `fs/overlayfs/` confirms my suspicion. `ovl_write_inode` is new, handling inode writeback, and checks `ovl_upper_unfinished` and `ovl_park_inode`. `ovl_sync_fs` is modified to handle the `ovl_tracks_dirty` case. `ovl_drop_inode` is new, replacing `inode_just_drop` to handle dirty/syncing inodes. `ovl_sync_lazytime` is also new for syncing lazytime timestamps. Then, `ovl_mmap`, `ovl_copyattr`, `ovl_update_time`, `ovl_copy_up_meta_inode_data`, and `ovl_inode_update` are all modified to call `ovl_mark_inode_dirty`. These are all *very* specific to the patch's logic. Based on this, my reasoning is clear: this patch introduces writeback tracking in overlayfs (`SB_I_OVL_USE_SYNC_FS`) when it's backed by ext4, btrfs, or xfs. It adds new operations and modifies existing ones to handle inode lifecycle, dirty state tracking, writeback, and sync semantics. And most importantly, all these changes are fully reachable from userspace via mount, syncfs, msync/mmap, writeback, and fsync. This directly impacts file system consistency and data integrity. Therefore, `WorthFuzzing` should be `true`. The configs to enable are: `OVERLAY_FS`, `EXT4_FS`, `BTRFS_FS`, and `XFS_FS`. The focus symbols are: `ovl_write_inode`, `ovl_sync_fs`, `ovl_drop_inode`, `ovl_sync_lazytime`, `ovl_mmap`, `ovl_copyattr`, `ovl_update_time`, `ovl_copy_up_meta_inode_data`, and `ovl_inode_update`. I double-checked everything and confirmed the `set-results` tool is used once, the EnableConfigs don't have the `CONFIG_` prefix, the focus symbols are correct, and the reasoning is concise and explains the verdict. This is good to go. |
| 12/2 | 2026/10/28 04:26 | tool | set-results |
0mArgs:{
"EnableConfigs": [
"OVERLAY_FS",
"EXT4_FS",
"BTRFS_FS",
"XFS_FS"
],
"FocusSymbols": [
"ovl_write_inode",
"ovl_sync_fs",
"ovl_drop_inode",
"ovl_sync_lazytime",
"ovl_mmap",
"ovl_copyattr",
"ovl_update_time",
"ovl_copy_up_meta_inode_data",
"ovl_inode_update"
],
"Reasoning": "The patch modifies OverlayFS dirty inode tracking and writeback handling when backed by filesystems supporting SB_I_OVL_USE_SYNC_FS (ext4, btrfs, xfs). It introduces custom .write_inode, .drop_inode, and .sync_lazytime superblock and inode operations, adjusts sync_fs behavior, and marks overlay inodes dirty across copy-up, mmap, and attribute updates. These changes significantly alter inode lifecycle and writeback state machines and are directly exercisable via standard VFS syscalls (mount, syncfs, mmap, fsync).",
"WorthFuzzing": true
}Results: {
"EnableConfigs": [
"OVERLAY_FS",
"EXT4_FS",
"BTRFS_FS",
"XFS_FS"
],
"FocusSymbols": [
"ovl_write_inode",
"ovl_sync_fs",
"ovl_drop_inode",
"ovl_sync_lazytime",
"ovl_mmap",
"ovl_copyattr",
"ovl_update_time",
"ovl_copy_up_meta_inode_data",
"ovl_inode_update"
],
"Reasoning": "The patch modifies OverlayFS dirty inode tracking and writeback handling when backed by filesystems supporting SB_I_OVL_USE_SYNC_FS (ext4, btrfs, xfs). It introduces custom .write_inode, .drop_inode, and .sync_lazytime superblock and inode operations, adjusts sync_fs behavior, and marks overlay inodes dirty across copy-up, mmap, and attribute updates. These changes significantly alter inode lifecycle and writeback state machines and are directly exercisable via standard VFS syscalls (mount, syncfs, mmap, fsync).",
"WorthFuzzing": true
} |
| 13/1 | 2026/10/28 04:26 | action | If |
0mArgs:{
"WorthFuzzing": true
}Results: null |
| 14/2 | 2026/10/28 04:26 | agent | kmsan-evaluator |
0mModel:core Args: null Results: {
"KMSANReasoning": "The patch series optimizes overlayfs dirty inode tracking and synchronization for underlying filesystems supporting SB_I_OVL_USE_SYNC_FS (btrfs, ext4, xfs). It introduces dirty tracking operations (ovl_tracks_dirty, ovl_mark_inode_dirty, ovl_sync_lazytime, ovl_write_inode, ovl_drop_inode), sets up backing device info on the overlay superblock when dirty tracking is enabled, and adjusts sync_fs behavior.\n\nThese changes alter filesystem internal state machines, inode writeback, and synchronization flags. They do not introduce or modify any kernel-to-user copies (such as copy_to_user, put_user, ioctl outputs, netlink attributes, or BPF helpers), nor do they create or modify any uninitialized memory allocations or conditionally branch on uninitialized variables. Any potential bugs introduced by these changes would be related to locking, inode reference lifecycle, or concurrency/data corruption, which are covered by standard bug detectors (KASAN, LOCKDEP) rather than KMSAN. Therefore, a dedicated KMSAN fuzzing session is not warranted.",
"NeedsKMSAN": false
}Instruction: You are an expert Linux kernel security engineer specializing in kernel memory
error detectors (KASAN and KMSAN). Your job is to review the provided patch series and
determine if the code changes justify spawning a dedicated KMSAN (KernelMemorySanitizer)
fuzzing session in addition to standard KASAN fuzzing.
CRITICAL DISTINCTION BETWEEN KASAN AND KMSAN:
- Standard KASAN kernel builds (upstream-apparmor-kasan.config) already enable
a comprehensive suite of debugging tools and sanitizers, including KASAN
(out-of-bounds accesses, use-after-free, double free, invalid free), LOCKDEP
(locking bugs and deadlocks), UB-sanitizers, and memory corruption checks.
- KMSAN (KernelMemorySanitizer) detects reads of UNINITIALIZED memory (stack, heap,
or page allocations) and kernel-to-user memory info-leaks.
Rule: THERE IS NO SENSE IN RUNNING A KMSAN SESSION IF A BUG CAN BE CAUGHT BY KASAN,
LOCKDEP, OR OTHER STANDARD BUG DETECTORS.
A dedicated KMSAN fuzzing session incurs significant resource costs. You must ONLY
set NeedsKMSAN=true if the code changes introduce or expose UNINITIALIZED MEMORY risks
that are detected ONLY by KMSAN.
Look holistically at the patch series and surrounding code. Even if no direct
uninitialized field accesses or new buffer allocations are added in the diff itself,
a patch may alter control flow, bounds checking, or data length calculations in ways
that change how the rest of the code operates on existing buffers (e.g. allowing
uninitialized stack/heap memory to be read, copied to user space, or used in control
flow). Do not hesitate to use your code access tools to inspect the surrounding code,
called functions, and callers.
Set NeedsKMSAN=true ONLY IF the patch introduces or modifies:
1. Kernel structures sent to user space (via copy_to_user, put_user, netlink skb
attributes, ioctl output arguments, socket options, or BPF buffers) where fields
or structure padding might not be fully initialized/zeroed.
2. Conditional logic or branching that depends on potentially uninitialized variables
or struct fields.
3. Allocation or initialization of complex data structures where uninitialized fields
could be read later in reachable code paths.
4. Bounds checks, lengths, or logic in a way that allows surrounding code to access
uninitialized bytes of existing buffers.
Set NeedsKMSAN=false IF:
- The code changes primarily risk out-of-bounds access, array overflows, NULL pointer
dereferences, locking deadlocks, or use-after-free bugs (these are already caught
by KASAN, LOCKDEP, or standard bug detectors).
- All stack/heap structures touched or introduced by the patch are fully zeroed
or initialized (e.g. using = {0}, memset, kzalloc) before being read or copied.
- The patch does not introduce any risk of uninitialized memory usage or info-leaks.
Use your code access tools to inspect the surrounding code if necessary, then provide
detailed KMSANReasoning contrasting KASAN vs KMSAN applicability for this patch.
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Target architecture: amd64
For your convenience, here is the diff of the changes:
commit 64ab42f83b206b4de0e9c6266eb7828ce82e6263
Author: syz-cluster <triage@syzkaller.com>
Date: Wed Oct 28 04:24:44 2026 +0000
syz-cluster: applied patch under review
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 7fabb775d4e3f6..cdecf90bdae0cd 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -981,7 +981,7 @@ static int btrfs_fill_super(struct super_block *sb,
#endif
sb->s_xattr = btrfs_xattr_handlers;
sb->s_time_gran = 1;
- sb->s_iflags |= SB_I_CGROUPWB | SB_I_ALLOW_HSM;
+ sb->s_iflags |= SB_I_CGROUPWB | SB_I_ALLOW_HSM | SB_I_OVL_USE_SYNC_FS;
ret = super_setup_bdi(sb);
if (ret) {
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 3ace06b4f9e3a1..037e274dca8aa8 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -5542,6 +5542,7 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
err = ext4_load_and_init_journal(sb, es, ctx);
if (err)
goto failed_mount3a;
+ sb->s_iflags |= SB_I_OVL_USE_SYNC_FS;
if (bdev_read_only(sb->s_bdev))
needs_recovery = 0;
} else if (test_opt(sb, NOLOAD) && !sb_rdonly(sb) &&
diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
index e963701b4c8775..12ad3ada551709 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -1122,6 +1122,8 @@ static int ovl_copy_up_meta_inode_data(struct ovl_copy_up_ctx *c)
ovl_clear_flag(OVL_HAS_DIGEST, d_inode(c->dentry));
ovl_clear_flag(OVL_VERIFIED_DIGEST, d_inode(c->dentry));
ovl_set_upperdata(d_inode(c->dentry));
+ /* The data is in the upper inode now, and nobody may ever write to it */
+ ovl_mark_inode_dirty(d_inode(c->dentry));
out_free:
kfree(capability);
out:
diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
index 1194ccf981c37b..fc47beffa67e27 100644
--- a/fs/overlayfs/dir.c
+++ b/fs/overlayfs/dir.c
@@ -1489,6 +1489,7 @@ const struct inode_operations ovl_dir_inode_operations = {
.get_acl = ovl_get_acl,
.set_acl = ovl_set_acl,
.update_time = ovl_update_time,
+ .sync_lazytime = ovl_sync_lazytime,
.fileattr_get = ovl_fileattr_get,
.fileattr_set = ovl_fileattr_set,
.tmpfile = ovl_tmpfile,
diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c
index 7433220d4ad6c4..cdc552c76878ef 100644
--- a/fs/overlayfs/file.c
+++ b/fs/overlayfs/file.c
@@ -473,7 +473,13 @@ static int ovl_mmap(struct file *file, struct vm_area_struct *vma)
.accessed = ovl_file_accessed,
};
- return backing_file_mmap(of->realfile, vma, &ctx);
+ int err;
+
+ err = backing_file_mmap(of->realfile, vma, &ctx);
+ /* Stores through the mapping go straight to the upper inode */
+ if (!err && vma_is_shared_maywrite(vma))
+ ovl_mark_inode_dirty(file_inode(file));
+ return err;
}
static long ovl_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
index 63906b3dafcbc6..85880296901742 100644
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -587,6 +587,7 @@ int ovl_update_time(struct inode *inode, enum fs_update_time type,
touch_atime(&upperpath);
inode_set_atime_to_ts(inode,
inode_get_atime(d_inode(upperpath.dentry)));
+ ovl_mark_inode_dirty(inode);
}
}
return 0;
@@ -742,6 +743,20 @@ int ovl_fileattr_get(struct dentry *dentry, struct file_kattr *fa)
return err;
}
+/*
+ * The overlay inode has I_DIRTY_TIME because the upper inode has, see
+ * ovl_park_inode(). Pass it on, and keep track of the upper inode until that
+ * has been written.
+ */
+void ovl_sync_lazytime(struct inode *inode)
+{
+ struct inode *upper = ovl_inode_upper(inode);
+
+ if (upper && (inode_state_read_once(upper) & I_DIRTY_TIME))
+ mark_inode_dirty_sync(upper);
+ ovl_mark_inode_dirty(inode);
+}
+
static const struct inode_operations ovl_file_inode_operations = {
.setattr = ovl_setattr,
.permission = ovl_permission,
@@ -751,6 +766,7 @@ static const struct inode_operations ovl_file_inode_operations = {
.get_acl = ovl_get_acl,
.set_acl = ovl_set_acl,
.update_time = ovl_update_time,
+ .sync_lazytime = ovl_sync_lazytime,
.fiemap = ovl_fiemap,
.fileattr_get = ovl_fileattr_get,
.fileattr_set = ovl_fileattr_set,
@@ -762,6 +778,7 @@ static const struct inode_operations ovl_symlink_inode_operations = {
.getattr = ovl_getattr,
.listxattr = ovl_listxattr,
.update_time = ovl_update_time,
+ .sync_lazytime = ovl_sync_lazytime,
};
static const struct inode_operations ovl_special_inode_operations = {
@@ -773,6 +790,7 @@ static const struct inode_operations ovl_special_inode_operations = {
.get_acl = ovl_get_acl,
.set_acl = ovl_set_acl,
.update_time = ovl_update_time,
+ .sync_lazytime = ovl_sync_lazytime,
};
static const struct address_space_operations ovl_aops = {
@@ -898,7 +916,8 @@ void ovl_inode_init(struct inode *inode, struct ovl_inode_params *oip,
oi->lowerdata_redirect = oip->lowerdata_redirect;
realinode = ovl_inode_real(inode);
- ovl_copyattr(inode);
+ /* Nothing was changed, the inode is only being looked up */
+ __ovl_copyattr(inode);
ovl_copyflags(realinode, inode);
ovl_map_ino(inode, ino, fsid);
}
diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h
index 92da556598da5e..ad1084be6191db 100644
--- a/fs/overlayfs/overlayfs.h
+++ b/fs/overlayfs/overlayfs.h
@@ -663,6 +663,32 @@ static inline bool ovl_should_sync(struct ovl_fs *ofs)
return ofs->config.fsync_mode != OVL_FSYNC_VOLATILE;
}
+/*
+ * Does this overlay keep track of the upper inodes which are changed through
+ * it, to sync only those? It knows where it wrote data. It does not know of
+ * every inode which the upper filesystem dirtied on its behalf, so that has to
+ * be a filesystem where ->sync_fs() takes care of all metadata. With any other
+ * one syncfs() and unmount sync the whole upper filesystem.
+ */
+static inline bool ovl_tracks_dirty(struct ovl_fs *ofs)
+{
+ return ovl_upper_mnt(ofs) && ovl_should_sync(ofs) &&
+ (ovl_upper_mnt(ofs)->mnt_sb->s_iflags & SB_I_OVL_USE_SYNC_FS);
+}
+
+/*
+ * The upper inode was changed through this overlay. Put the overlay inode on
+ * the dirty list of the overlay, for syncfs and unmount to find.
+ *
+ * Do not look at the state of the upper inode here. Its dirty flags are
+ * cleared when its writeback starts, not when it is done.
+ */
+static inline void ovl_mark_inode_dirty(struct inode *inode)
+{
+ if (ovl_tracks_dirty(OVL_FS(inode->i_sb)))
+ mark_inode_dirty(inode);
+}
+
static inline bool ovl_should_sync_metadata(struct ovl_fs *ofs)
{
return ofs->config.fsync_mode == OVL_FSYNC_STRICT;
@@ -841,6 +867,7 @@ static inline struct posix_acl *ovl_get_acl_path(const struct path *path,
int ovl_update_time(struct inode *inode, enum fs_update_time type,
unsigned int flags);
+void ovl_sync_lazytime(struct inode *inode);
bool ovl_is_private_xattr(struct super_block *sb, const char *name);
struct ovl_inode_params {
@@ -860,6 +887,7 @@ bool ovl_lookup_trap_inode(struct super_block *sb, struct dentry *dir);
struct inode *ovl_get_trap_inode(struct super_block *sb, struct dentry *dir);
struct inode *ovl_get_inode(struct super_block *sb,
struct ovl_inode_params *oip);
+void __ovl_copyattr(struct inode *to);
void ovl_copyattr(struct inode *to);
/* vfs fileattr flags read from overlay.protattr xattr to ovl inode */
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 19b6d54c4500b7..c570bf7103f843 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -15,6 +15,9 @@
#include <linux/seq_file.h>
#include <linux/posix_acl_xattr.h>
#include <linux/exportfs.h>
+#include <linux/blkdev.h>
+#include <linux/pagemap.h>
+#include <linux/writeback.h>
#include <linux/file.h>
#include <linux/fs_context.h>
#include <linux/fs_parser.h>
@@ -267,18 +270,45 @@ static int ovl_sync_fs(struct super_block *sb, int wait)
/*
* Not called for sync(2) call or an emergency sync (SB_I_SKIP_SYNC).
* All the super blocks will be iterated, including upper_sb.
- *
- * If this is a syncfs(2) call, then we do need to call
- * sync_filesystem() on upper_sb, but enough if we do it when being
- * called with wait == 1.
*/
- if (!wait)
- return 0;
-
upper_sb = ovl_upper_mnt(ofs)->mnt_sb;
+ if (!ovl_tracks_dirty(ofs)) {
+ /*
+ * If this is a syncfs(2) call, then we do need to call
+ * sync_filesystem() on upper_sb, but enough if we do it when
+ * being called with wait == 1.
+ */
+ if (!wait)
+ return 0;
+
+ down_read(&upper_sb->s_umount);
+ ret = sync_filesystem(upper_sb);
+ up_read(&upper_sb->s_umount);
+
+ return ret;
+ }
+
+ /*
+ * For syncfs(2) and for unmount, sync_filesystem() has written the
+ * dirty inodes of this overlay by now, see ovl_write_inode(). What is
+ * left is for the upper filesystem to commit its metadata. The dirty
+ * inodes of everybody else on the upper filesystem are none of our
+ * business.
+ */
down_read(&upper_sb->s_umount);
- ret = sync_filesystem(upper_sb);
+ /* As in sync_filesystem(): ->sync_fs() doesn't expect to be called then */
+ ret = 0;
+ if (sb_rdonly(upper_sb))
+ goto out;
+
+ if (upper_sb->s_op->sync_fs)
+ ret = upper_sb->s_op->sync_fs(upper_sb, wait);
+ if (!ret && wait)
+ ret = sync_blockdev(upper_sb->s_bdev);
+ else if (!ret)
+ ret = sync_blockdev_nowait(upper_sb->s_bdev);
+out:
up_read(&upper_sb->s_umount);
return ret;
@@ -313,12 +343,102 @@ static int ovl_statfs(struct dentry *dentry, struct kstatfs *buf)
return err;
}
+/*
+ * Could there be anything left to write or to wait for on @upper?
+ *
+ * Whoever has it open for writing may have it mapped, and stores through a
+ * mapping go unnoticed. The mapping holds the file open.
+ *
+ * Writeback which was only started, by us or by the flusher of the upper
+ * filesystem, shows in the page cache tags until it is done. The dirty flags
+ * of the inode do not, they are cleared at the start.
+ *
+ * Metadata is not looked at. The upper filesystem logs it, see
+ * ovl_tracks_dirty(), and ovl_sync_fs() has the log committed.
+ *
+ * Nothing orders these reads. The one order which matters is to not see
+ * i_writecount at zero and miss the tag of a page which was dirtied through
+ * the mapping. The tag is set when the mapping goes away at the latest, the
+ * count drops when the file is released after that, with the locks of
+ * unmapping and of the final fput in between.
+ */
+static bool ovl_upper_unfinished(struct inode *upper)
+{
+ struct address_space *mapping = upper->i_mapping;
+
+ return inode_is_open_for_write(upper) ||
+ mapping_tagged(mapping, PAGECACHE_TAG_DIRTY) ||
+ mapping_tagged(mapping, PAGECACHE_TAG_WRITEBACK) ||
+ (inode_state_read_once(upper) & I_SYNC);
+}
+
+/*
+ * All that is left of @inode are timestamps which lazytime holds back on the
+ * upper filesystem. A pass which does not wait leaves them alone, for up to 12
+ * hours. Do to the overlay inode what was done to the upper inode: with
+ * I_DIRTY_TIME it is off the list which the flusher walks, syncfs() still gets
+ * to it, and ovl_sync_lazytime() is told when the time has come.
+ *
+ * One such time is when the last reference goes away, which it never does for
+ * the upper inode as long as the overlay inode is there. It may have gone away
+ * already. iput() looks for I_DIRTY_TIME under i_lock before it drops the last
+ * reference, so either it sees the flag or the count is zero here.
+ */
+static void ovl_park_inode(struct inode *inode)
+{
+ if (!ovl_tracks_dirty(OVL_FS(inode->i_sb)))
+ return;
+
+ __mark_inode_dirty(inode, I_DIRTY_TIME);
+ if (!icount_read_once(inode))
+ mark_inode_dirty_sync(inode);
+}
+
+static int ovl_write_inode(struct inode *inode, struct writeback_control *wbc)
+{
+ struct inode *upper = ovl_inode_upper(inode);
+ int ret;
+
+ if (!upper)
+ return 0;
+
+ /*
+ * Go through writeback_single_inode(), I_SYNC is what serializes us
+ * with the writeback of the upper filesystem.
+ */
+ ret = write_inode_now(upper, wbc->sync_mode == WB_SYNC_ALL);
+
+ if (ovl_upper_unfinished(upper))
+ ovl_mark_inode_dirty(inode);
+ else if (inode_state_read_once(upper) & I_DIRTY_TIME)
+ ovl_park_inode(inode);
+
+ return ret;
+}
+
+/*
+ * In iput_final(), clean inode will drop directly and dirty inode will
+ * keep in the cache until write back to sync dirty data then add to lru
+ * list to wait reclaim.
+ *
+ * An inode under writeback has its dirty flags cleared, and only I_SYNC pins
+ * it. It is not clean: ovl_write_inode() may be about to mark it dirty again,
+ * which does nothing for an inode which is being freed.
+ */
+static int ovl_drop_inode(struct inode *inode)
+{
+ if (!(inode_state_read(inode) & (I_DIRTY_ALL | I_SYNC)))
+ return 1;
+ return inode_generic_drop(inode);
+}
+
static const struct super_operations ovl_super_operations = {
.alloc_inode = ovl_alloc_inode,
.free_inode = ovl_free_inode,
.destroy_inode = ovl_destroy_inode,
- .drop_inode = inode_just_drop,
+ .drop_inode = ovl_drop_inode,
.put_super = ovl_put_super,
+ .write_inode = ovl_write_inode,
.sync_fs = ovl_sync_fs,
.statfs = ovl_statfs,
.show_options = ovl_show_options,
@@ -1455,6 +1575,13 @@ static int ovl_fill_super_creds(struct fs_context *fc, struct super_block *sb)
if (err)
return err;
+ /* Dirty overlay inodes need a writeback list to be on */
+ if (ovl_tracks_dirty(ofs)) {
+ err = super_setup_bdi(sb);
+ if (err)
+ return err;
+ }
+
upper_sb = ovl_upper_mnt(ofs)->mnt_sb;
if (!ovl_should_sync(ofs)) {
ofs->errseq = errseq_sample(&upper_sb->s_wb_err);
diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c
index 521717209b2e44..e7402459548eed 100644
--- a/fs/overlayfs/util.c
+++ b/fs/overlayfs/util.c
@@ -604,6 +604,8 @@ void ovl_inode_update(struct inode *inode, struct dentry *upperdentry)
inode->i_private = upperinode;
__insert_inode_hash(inode, (unsigned long) upperinode);
}
+ /* The copy up has written to the upper inode */
+ ovl_mark_inode_dirty(inode);
}
static void ovl_dir_version_inc(struct dentry *dentry, bool impurity)
@@ -1492,7 +1494,7 @@ int ovl_sync_status(struct ovl_fs *ofs)
* map any lower or upper inode owned by id 1001 to id 1000. These mapping
* helpers are nops when the relevant layer isn't idmapped.
*/
-void ovl_copyattr(struct inode *inode)
+void __ovl_copyattr(struct inode *inode)
{
struct path realpath;
struct inode *realinode;
@@ -1516,3 +1518,13 @@ void ovl_copyattr(struct inode *inode)
i_size_write(inode, i_size_read(realinode));
spin_unlock(&inode->i_lock);
}
+
+/*
+ * The attributes are copied because the real inode was changed through the
+ * overlay, so this is also where the overlay inode becomes dirty.
+ */
+void ovl_copyattr(struct inode *inode)
+{
+ __ovl_copyattr(inode);
+ ovl_mark_inode_dirty(inode);
+}
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 5a06132aa38466..2f09d48b7e6f06 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1924,7 +1924,7 @@ xfs_fs_fill_super(
sb->s_time_max = XFS_LEGACY_TIME_MAX;
}
trace_xfs_inode_timestamp_range(mp, sb->s_time_min, sb->s_time_max);
- sb->s_iflags |= SB_I_CGROUPWB | SB_I_ALLOW_HSM;
+ sb->s_iflags |= SB_I_CGROUPWB | SB_I_ALLOW_HSM | SB_I_OVL_USE_SYNC_FS;
set_posix_acl_flag(sb);
diff --git a/include/linux/fs/super_types.h b/include/linux/fs/super_types.h
index 72f4288e16c526..370b0d27815bd7 100644
--- a/include/linux/fs/super_types.h
+++ b/include/linux/fs/super_types.h
@@ -359,5 +359,6 @@ struct super_block {
#define SB_I_NOIDMAP 0x00002000 /* No idmapped mounts on this superblock */
#define SB_I_ALLOW_HSM 0x00004000 /* Allow HSM events on this superblock */
#define SB_I_NO_DATA_INTEGRITY 0x00008000 /* fs cannot guarantee data persistence on sync */
+#define SB_I_OVL_USE_SYNC_FS 0x00010000 /* overlayfs: ->sync_fs() commits all metadata */
#endif /* _LINUX_FS_SUPER_TYPES_H */
|
| 15/3 | 2026/10/28 04:26 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 8383 output: 262 thoughts: 2012 Thoughts: **Analysis of Filesystem Synchronization and Inode Dirty Tracking Patch Series** Okay, let's break this down. This patch series touches Btrfs, Ext4 (journaled), XFS, and OverlayFS, along with the `super_types.h` header. The main focus here is improving filesystem synchronization and tracking inode dirtiness, particularly within the context of OverlayFS. My initial thought is that this introduces a new flag, `SB_I_OVL_USE_SYNC_FS`, to signal that a filesystem supports syncfs optimization. The core modifications seem to be around OverlayFS, with the introduction of dirty inode tracking for syncfs and unmount operations. This is achieved through new functions like `ovl_tracks_dirty()`, `ovl_mark_inode_dirty()`, and modifications to existing functions like `ovl_mmap()`, `ovl_update_time()`, `ovl_sync_fs()`, `ovl_write_inode()` and `ovl_drop_inode()`. Specifically, OverlayFS now integrates with `write_inode`, `sync_fs`, `sync_lazytime`, and `drop_inode`, marking inodes dirty in several places, including `ovl_mmap`, `ovl_update_time`, and copy operations. The critical question is, does this introduce *uninitialized memory* risks that KMSAN would catch *but* other tools like KASAN, lockdep, or standard bug detectors would not? We need to determine if we're sending uninitialized kernel data to userspace or if conditional logic relies on uninitialized variables. Reviewing the code, I don't see any obvious introduction of uninitialized memory. There are no explicit copies to user space (`copy_to_user`, `put_user`, netlink), no modified ioctls, socket options, or BPF buffers. Branching logic appears safe, as all variables used in conditions are initialized before use, for example, `err` and `ret` variables are assigned immediately after declaration. There are no new data structures allocated without proper initialization. All stack and heap structures are zeroed or explicitly initialized before any read or copy operations. The patch primarily focuses on filesystem writeback and syncfs behavior, so any potential issues would most likely be related to concurrency, locking, or data corruption, issues which KASAN, LOCKDEP and other tools are very capable of detecting. Therefore, this patch series *does not* introduce any risks related to uninitialized memory. Standard bug detectors are sufficient here. There is no sense in running a KMSAN session. `NeedsKMSAN` is `false`. Time to call `set-results`. |
| 16/3 | 2026/10/28 04:26 | tool | set-results |
0mArgs:{
"KMSANReasoning": "The patch series optimizes overlayfs dirty inode tracking and synchronization for underlying filesystems supporting SB_I_OVL_USE_SYNC_FS (btrfs, ext4, xfs). It introduces dirty tracking operations (ovl_tracks_dirty, ovl_mark_inode_dirty, ovl_sync_lazytime, ovl_write_inode, ovl_drop_inode), sets up backing device info on the overlay superblock when dirty tracking is enabled, and adjusts sync_fs behavior.\n\nThese changes alter filesystem internal state machines, inode writeback, and synchronization flags. They do not introduce or modify any kernel-to-user copies (such as copy_to_user, put_user, ioctl outputs, netlink attributes, or BPF helpers), nor do they create or modify any uninitialized memory allocations or conditionally branch on uninitialized variables. Any potential bugs introduced by these changes would be related to locking, inode reference lifecycle, or concurrency/data corruption, which are covered by standard bug detectors (KASAN, LOCKDEP) rather than KMSAN. Therefore, a dedicated KMSAN fuzzing session is not warranted.",
"NeedsKMSAN": false
}Results: {
"KMSANReasoning": "The patch series optimizes overlayfs dirty inode tracking and synchronization for underlying filesystems supporting SB_I_OVL_USE_SYNC_FS (btrfs, ext4, xfs). It introduces dirty tracking operations (ovl_tracks_dirty, ovl_mark_inode_dirty, ovl_sync_lazytime, ovl_write_inode, ovl_drop_inode), sets up backing device info on the overlay superblock when dirty tracking is enabled, and adjusts sync_fs behavior.\n\nThese changes alter filesystem internal state machines, inode writeback, and synchronization flags. They do not introduce or modify any kernel-to-user copies (such as copy_to_user, put_user, ioctl outputs, netlink attributes, or BPF helpers), nor do they create or modify any uninitialized memory allocations or conditionally branch on uninitialized variables. Any potential bugs introduced by these changes would be related to locking, inode reference lifecycle, or concurrency/data corruption, which are covered by standard bug detectors (KASAN, LOCKDEP) rather than KMSAN. Therefore, a dedicated KMSAN fuzzing session is not warranted.",
"NeedsKMSAN": false
} |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|