Summary: A vulnerability was found in the Linux kernel, specifically related to the Flash-Friendly File System (F2FS) compression feature. This vulnerability could lead to data corruption if a compressed data block isn't properly persisted during a checkpoint. The Linux kernel maintainers have addressed this issue by guaranteeing that compressed pages are written during checkpoint operations.

Introduction

The Linux kernel is the basis for the operating system used by millions of devices worldwide, from smartphones to supercomputers. As with any software, it occasionally contains flaws that can lead to vulnerabilities. CVE-2024-27035 is a vulnerability related to the F2FS file system, a specific feature that deals with efficient management of files on flash memory devices.

The issue at hand revolves around the checkpointing process, which occurs when the kernel writes file system metadata and data to disk. This vulnerability has serious implications, as it could lead to data corruption and potentially cause the loss of important information.

The problem: F2FS Compression Vulnerability

With the F2FS file system, there's a feature called data compression, which saves space on storage devices by compressing data blocks before writing them. The vulnerability lies in cases where a compressed data block isn't properly persisted (written) along with the metadata during the checkpointing process. If that occurs, after an unexpected power loss or system reboot, there's the potential for the data to be corrupted.

The solution: Guaranteeing Persistence of Compressed Blocks during Checkpoint

The Linux kernel developers have come up with a fix for this vulnerability by ensuring that compressed pages are definitely written during the checkpoint process:

/* checkpoint.c */
void f2fs_wait_on_all_pages(struct f2fs_sb_info *sbi, enum page_type type)
{
   /* Existing code */
   f2fs_submit_merged_write_cond(sbi, NULL, , type == PAGE_TYPE_BIO ? META_POR : type, true);
   f2fs_flush_merged_writes(sbi, type);
}

By calling the f2fs_submit_merged_write_cond() function, the kernel ensures that compressed blocks are written during a checkpoint.

Steps have been taken to ensure this fix is included in future kernel releases as well as backported to previous versions.

You can find more details about this vulnerability and resolution in the following resources

1. Linux kernel Git repository commit: f2fs: compress: fix to guarantee persisting compressed blocks by CP
2. The Linux Kernel Mailing List (LKML) discussion: f2fs: Fix Persistence of Compressed Blocks during Checkpoint

Conclusion

CVE-2024-27035 is a vulnerability found within the Linux kernel's F2FS file system, which could lead to corrupted data if compressed blocks are not persisted during the checkpoint process. Linux kernel developers have fixed this issue by ensuring that compressed pages are written during the checkpoint operation. As an end-user, you should make sure to keep your system updated with the latest security patches to protect against potential vulnerabilities like this one.

Timeline

Published on: 05/01/2024 13:15:49 UTC
Last modified on: 05/29/2024 05:27:24 UTC