7.1high
Revert "libfs: fix infinite directory reads for offset dir"
- Severity
- 7.1high CVSS:3.1 by Linux
- Exploit likelihood
- 0.30% (higher than 16% of CVEs)
- Published
- Last changed
- Assigned by
- Linux
Description
In the Linux kernel, the following vulnerability has been resolved: Revert "libfs: fix infinite directory reads for offset dir" The current directory offset allocator (based on mtree_alloc_cyclic) stores the next offset value to return in octx->next_offset. This mechanism typically returns values that increase monotonically over time. Eventually, though, the newly allocated offset value wraps back to a low number (say, 2) which is smaller than other already- allocated offset values. Yu Kuai <yukuai3@huawei.com> reports that, after commit 64a7ce76fb90 ("libfs: fix infinite directory reads for offset dir"), if a directory's offset allocator wraps, existing entries are no longer visible via readdir/getdents because offset_readdir() stops listing entries once an entry's offset is larger than octx->next_offset. These entries vanish persistently -- they can be looked up, but will never again appear in readdir(3) output. The reason for this is that the commit treats directory offsets as monotonically increasing integer values rather than opaque cookies, and introduces this comparison: if (dentry2offset(dentry) >= last_index) { On 64-bit platforms, the directory offset value upper bound is 2^63 - 1. Directory offsets will monotonically increase for millions of years without wrapping. On 32-bit platforms, however, LONG_MAX is 2^31 - 1. The allocator can wrap after only a few weeks (at worst). Revert commit 64a7ce76fb90 ("libfs: fix infinite directory reads for offset dir") to prepare for a fix that can work properly on 32-bit systems and might apply to recent LTS kernels where shmem employs the simple_offset mechanism.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| Linux Linux | from 64a7ce76fb901bf9f9c36cf5d681328fc0fd4b5a before 9e9e710f68bac49bd9b587823c077d06363440e0, from 64a7ce76fb901bf9f9c36cf5d681328fc0fd4b5a before 3f250b82040a72b0059ae00855a74d8570ad2147, from 64a7ce76fb901bf9f9c36cf5d681328fc0fd4b5a before b662d858131da9a8a14e68661656989b14dbf113, 308b4fc2403b335894592ee9dc212a5e58bb309f, from 6.10.7 before 6.11, 6.11 Not affected: before 6.11, from 6.12.12 up to 6.12.*, from 6.13.1 up to 6.13.*, from 6.14 up to * | CVE List |
| linux linux_kernel | from 6.11 before 6.12.12, 6.13 | NVD |
All scores
| Linux | 7.1high CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H |
| CISA-ADP | 5.5medium CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H |
| NVD | 5.5medium CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H |
Classification
SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.
What each source says
CVE List
In the Linux kernel, the following vulnerability has been resolved: Revert "libfs: fix infinite directory reads for offset dir" The current directory offset allocator (based on mtree_alloc_cyclic) stores the next offset value to return in octx->next_offset. This mechanism typically returns values that increase monotonically over time. Eventually, though, the newly allocated offset value wraps back to a low number (say, 2) which is smaller than other already- allocated offset values. Yu Kuai <yukuai3@huawei.com> reports that, after commit 64a7ce76fb90 ("libfs: fix infinite directory reads for offset dir"), if a directory's offset allocator wraps, existing entries are no longer visible via readdir/getdents because offset_readdir() stops listing entries once an entry's offset is larger than octx->next_offset. These entries vanish persistently -- they can be looked up, but will never again appear in readdir(3) output. The reason for this is that the commit treats directory offsets as monotonically increasing integer values rather than opaque cookies, and introduces this comparison: if (dentry2offset(dentry) >= last_index) { On 64-bit platforms, the directory offset value upper bound is 2^63 - 1. Directory offsets will monotonically increase for millions of years without wrapping. On 32-bit platforms, however, LONG_MAX is 2^31 - 1. The allocator can wrap after only a few weeks (at worst). Revert commit 64a7ce76fb90 ("libfs: fix infinite directory reads for offset dir") to prepare for a fix that can work properly on 32-bit systems and might apply to recent LTS kernels where shmem employs the simple_offset mechanism.
NVD (es)
En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: Revertir "libfs: fix infinite directory reads for offset dir" El asignador de desplazamiento de directorio actual (basado en mtree_alloc_cyclic) almacena el siguiente valor de desplazamiento a devolver en octx->next_offset. Este mecanismo normalmente devuelve valores que aumentan monótonamente con el tiempo. Sin embargo, con el tiempo, el valor de desplazamiento recientemente asignado vuelve a un número bajo (por ejemplo, 2) que es menor que otros valores de desplazamiento ya asignados. Yu Kuai informa que, después del commit 64a7ce76fb90 ("libfs: fix infinite directory reads for offset dir"), si el asignador de desplazamiento de un directorio se cierra, las entradas existentes ya no son visibles a través de readdir/getdents porque offset_readdir() deja de enumerar las entradas una vez que el desplazamiento de una entrada es mayor que octx->next_offset. Estas entradas desaparecen de forma persistente: se pueden buscar, pero nunca volverán a aparecer en la salida de readdir(3). La razón para esto es que la confirmación trata los desplazamientos de directorio como valores enteros que aumentan monótonamente en lugar de cookies opacas, e introduce esta comparación: if (dentry2offset(dentry) >= last_index) { En plataformas de 64 bits, el límite superior del valor del desplazamiento de directorio es 2^63 - 1. Los desplazamientos de directorio aumentarán monótonamente durante millones de años sin envolverse. Sin embargo, en plataformas de 32 bits, LONG_MAX es 2^31 - 1. El asignador puede envolverse después de solo unas pocas semanas (en el peor de los casos). Revertir el commit 64a7ce76fb90 ("libfs: arreglar lecturas de directorio infinitas para el desplazamiento dir") para prepararse para una solución que pueda funcionar correctamente en sistemas de 32 bits y podría aplicarse a núcleos LTS recientes donde shmem emplea el mecanismo simple_offset.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2024-57952 changed 2026-08-05 | CVE Terms of Use |
| NVD | CVE-2024-57952 changed 2026-08-04 | Public domain |