f2fs: fix fsck inconsistency caused by FGGC of node block
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ da011cc0da8cf4a60ddf4d2ae8b42902a3d71e5f · < c3e238bd1f56993f205ef83889d406dfeaf717a8| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
f2fs: fix fsck inconsistency caused by FGGC of node block
During FGGC node block migration, fsck may incorrectly treat the migrated node block as fsync-written data.
The reproduction scenario: root@vm:/mnt/f2fs# seq 1 2048 | xargs -n 1 ./test_sync // write inline inode and sync root@vm:/mnt/f2fs# rm -f 1 root@vm:/mnt/f2fs# sync root@vm:/mnt/f2fs# f2fs_io gc_range // move data block in sync mode and not write CP SPO, "fsck --dry-run" find inode has already checkpointed but still with DENT_BIT_SHIFT set
The root cause is that GC does not clear the dentry mark and fsync mark during node block migration, leading fsck to misinterpret them as user-issued fsync writes.
In BGGC mode, node block migration is handled by f2fs_sync_node_pages(), which guarantees the dentry and fsync marks are cleared before writing.
This patch move the set/clear of the fsync|dentry marks into __write_node_folio to make the logic clearer, and ensures the fsync|dentry mark is cleared in FGGC.
From the CVE record · Linux
During foreground garbage collection, f2fs can leave fsync and dentry marks on a migrated node block, causing fsck to misinterpret it as fsync-written data and report an inconsistency. The input describes a local reproduction involving filesystem writes and garbage collection; it does not describe an attacker, authentication requirements, or user interaction.
Engineers running Linux with f2fs should check whether their kernel includes the fix; affected versions are not specified.