Skip to main content

CVE-2021-47114: Vulnerability in Linux Linux

Medium
VulnerabilityCVE-2021-47114cvecve-2021-47114
Published: Fri Mar 15 2024 (03/15/2024, 20:14:22 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: ocfs2: fix data corruption by fallocate When fallocate punches holes out of inode size, if original isize is in the middle of last cluster, then the part from isize to the end of the cluster will be zeroed with buffer write, at that time isize is not yet updated to match the new size, if writeback is kicked in, it will invoke ocfs2_writepage()->block_write_full_page() where the pages out of inode size will be dropped. That will cause file corruption. Fix this by zero out eof blocks when extending the inode size. Running the following command with qemu-image 4.2.1 can get a corrupted coverted image file easily. qemu-img convert -p -t none -T none -f qcow2 $qcow_image \ -O qcow2 -o compat=1.1 $qcow_image.conv The usage of fallocate in qemu is like this, it first punches holes out of inode size, then extend the inode size. fallocate(11, FALLOC_FL_KEEP_SIZE|FALLOC_FL_PUNCH_HOLE, 2276196352, 65536) = 0 fallocate(11, 0, 2276196352, 65536) = 0 v1: https://www.spinics.net/lists/linux-fsdevel/msg193999.html v2: https://lore.kernel.org/linux-fsdevel/20210525093034.GB4112@quack2.suse.cz/T/

AI-Powered Analysis

AILast updated: 06/30/2025, 21:56:07 UTC

Technical Analysis

CVE-2021-47114 is a vulnerability in the Linux kernel's OCFS2 (Oracle Cluster File System version 2) filesystem implementation related to the fallocate system call. The flaw arises during the handling of hole punching operations combined with inode size updates. Specifically, when fallocate punches holes out of the inode size and the original inode size (isize) lies in the middle of the last cluster, the kernel zeroes out the region from the original inode size to the end of the cluster using buffered writes. However, at this point, the inode size has not yet been updated to reflect the new size. If a writeback operation is triggered concurrently, it calls ocfs2_writepage() which in turn invokes block_write_full_page(). This function drops pages that are beyond the inode size, leading to a mismatch between the zeroed data and the inode size. The result is file corruption due to inconsistent data being written to disk. This issue was demonstrated with qemu-img version 4.2.1, where converting qcow2 images using fallocate operations caused corrupted output files. The vulnerability is rooted in the sequence of fallocate calls that first punch holes with the FALLOC_FL_KEEP_SIZE and FALLOC_FL_PUNCH_HOLE flags, then extend the inode size, but the zeroing of blocks and inode size update are not properly synchronized. The fix involves zeroing out end-of-file blocks when extending the inode size to prevent corruption. The CVSS 3.1 score is 5.5 (medium severity), reflecting a local attack vector with low complexity, requiring privileges but no user interaction, and causing availability impact (file corruption). There are no known exploits in the wild currently. This vulnerability affects Linux kernel versions containing the specified commit hashes prior to the patch. The issue is particularly relevant for systems using OCFS2 and applications like QEMU that rely on fallocate for image file manipulation.

Potential Impact

For European organizations, the primary impact of CVE-2021-47114 is the risk of data corruption on systems using the OCFS2 filesystem, especially those running Linux kernels vulnerable to this flaw. This can lead to loss of data integrity and availability, particularly in environments where virtual machine images or large files are manipulated using fallocate, such as cloud providers, hosting services, and enterprises running virtualization infrastructure with QEMU/KVM. Corrupted disk images can cause VM failures, downtime, and potential data loss. Since the vulnerability requires local privileges, the risk is higher in multi-tenant environments or where untrusted users have some level of access. The lack of confidentiality or integrity impact reduces the risk of data leakage or unauthorized modification, but availability degradation can disrupt critical services. European organizations with infrastructure relying on OCFS2 or using QEMU for virtualization should be aware of this threat, as it can affect service reliability and operational continuity.

Mitigation Recommendations

1. Apply the official Linux kernel patches that fix this vulnerability as soon as possible to ensure the zeroing of EOF blocks is correctly handled during fallocate operations. 2. For organizations using QEMU, upgrade to versions that do not trigger this issue or apply patches that avoid the problematic fallocate usage pattern. 3. Avoid using OCFS2 filesystem for critical workloads if patching is delayed; consider migrating to more widely used and actively maintained filesystems like ext4 or XFS. 4. Implement strict access controls to limit local user privileges, reducing the risk of exploitation by unprivileged users. 5. Monitor file system integrity and implement regular backups to detect and recover from potential corruption. 6. In virtualized environments, validate VM disk images after conversion or manipulation operations to detect corruption early. 7. Employ kernel live patching solutions where possible to minimize downtime during patch deployment.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2024-03-04T18:12:48.836Z
Cisa Enriched
true
Cvss Version
3.1
State
PUBLISHED

Threat ID: 682d9834c4522896dcbe9d6b

Added to database: 5/21/2025, 9:09:08 AM

Last enriched: 6/30/2025, 9:56:07 PM

Last updated: 8/4/2025, 6:50:29 AM

Views: 11

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats