CVE-2026-43118
Gravedad:
Pendiente de análisis
Tipo:
No Disponible / Otro tipo
Fecha de publicación:
06/05/2026
Última modificación:
06/05/2026
Descripción
*** Pendiente de traducción *** In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
btrfs: fix zero size inode with non-zero size after log replay<br />
<br />
When logging that an inode exists, as part of logging a new name or<br />
logging new dir entries for a directory, we always set the generation of<br />
the logged inode item to 0. This is to signal during log replay (in<br />
overwrite_item()), that we should not set the i_size since we only logged<br />
that an inode exists, so the i_size of the inode in the subvolume tree<br />
must be preserved (as when we log new names or that an inode exists, we<br />
don&#39;t log extents).<br />
<br />
This works fine except when we have already logged an inode in full mode<br />
or it&#39;s the first time we are logging an inode created in a past<br />
transaction, that inode has a new i_size of 0 and then we log a new name<br />
for the inode (due to a new hardlink or a rename), in which case we log<br />
an i_size of 0 for the inode and a generation of 0, which causes the log<br />
replay code to not update the inode&#39;s i_size to 0 (in overwrite_item()).<br />
<br />
An example scenario:<br />
<br />
mkdir /mnt/dir<br />
xfs_io -f -c "pwrite 0 64K" /mnt/dir/foo<br />
<br />
sync<br />
<br />
xfs_io -c "truncate 0" -c "fsync" /mnt/dir/foo<br />
<br />
ln /mnt/dir/foo /mnt/dir/bar<br />
<br />
xfs_io -c "fsync" /mnt/dir<br />
<br />
<br />
<br />
After log replay the file remains with a size of 64K. This is because when<br />
we first log the inode, when we fsync file foo, we log its current i_size<br />
of 0, and then when we create a hard link we log again the inode in exists<br />
mode (LOG_INODE_EXISTS) but we set a generation of 0 for the inode item we<br />
add to the log tree, so during log replay overwrite_item() sees that the<br />
generation is 0 and i_size is 0 so we skip updating the inode&#39;s i_size<br />
from 64K to 0.<br />
<br />
Fix this by making sure at fill_inode_item() we always log the real<br />
generation of the inode if it was logged in the current transaction with<br />
the i_size we logged before. Also if an inode created in a previous<br />
transaction is logged in exists mode only, make sure we log the i_size<br />
stored in the inode item located from the commit root, so that if we log<br />
multiple times that the inode exists we get the correct i_size.<br />
<br />
A test case for fstests will follow soon.



