5.5medium
nilfs2: fix potential deadlock with newly created symlinks
- Severity
- 5.5medium CVSS:3.1 by CISA-ADP
- Exploit likelihood
- 0.24% (higher than 9% of CVEs)
- Published
- Last changed
- Assigned by
- Linux
Description
In the Linux kernel, the following vulnerability has been resolved: nilfs2: fix potential deadlock with newly created symlinks Syzbot reported that page_symlink(), called by nilfs_symlink(), triggers memory reclamation involving the filesystem layer, which can result in circular lock dependencies among the reader/writer semaphore nilfs->ns_segctor_sem, s_writers percpu_rwsem (intwrite) and the fs_reclaim pseudo lock. This is because after commit 21fc61c73c39 ("don't put symlink bodies in pagecache into highmem"), the gfp flags of the page cache for symbolic links are overwritten to GFP_KERNEL via inode_nohighmem(). This is not a problem for symlinks read from the backing device, because the __GFP_FS flag is dropped after inode_nohighmem() is called. However, when a new symlink is created with nilfs_symlink(), the gfp flags remain overwritten to GFP_KERNEL. Then, memory allocation called from page_symlink() etc. triggers memory reclamation including the FS layer, which may call nilfs_evict_inode() or nilfs_dirty_inode(). And these can cause a deadlock if they are called while nilfs->ns_segctor_sem is held: Fix this issue by dropping the __GFP_FS flag from the page cache GFP flags of newly created symlinks in the same way that nilfs_new_inode() and __nilfs_read_inode() do, as a workaround until we adopt nofs allocation scope consistently or improve the locking constraints.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| Linux Linux | from 21fc61c73c3903c4c312d0802da01ec2b323d174 before cc38c596e648575ce58bfc31623a6506eda4b94a, from 21fc61c73c3903c4c312d0802da01ec2b323d174 before a1686db1e59f8fc016c4c9361e2119dd206f479a, from 21fc61c73c3903c4c312d0802da01ec2b323d174 before c72e0df0b56c1166736dc8eb62070ebb12591447, from 21fc61c73c3903c4c312d0802da01ec2b323d174 before 69548bb663fcb63f9ee0301be808a36b9d78dac3, from 21fc61c73c3903c4c312d0802da01ec2b323d174 before 58c7f44c7b9e5ac7e3b1e5da2572ed7767a12f38, from 21fc61c73c3903c4c312d0802da01ec2b323d174 before 1246d86e7bbde265761932c6e2dce28c69cdcb91, from 21fc61c73c3903c4c312d0802da01ec2b323d174 before 9aa5d43ac4cace8fb9bd964ff6c23f599dc3cd24, from 21fc61c73c3903c4c312d0802da01ec2b323d174 before b3a033e3ecd3471248d474ef263aadc0059e516a and 3 more Not affected: before 4.5, from 4.19.323 up to 4.19.*, from 5.4.285 up to 5.4.*, from 5.10.229 up to 5.10.*, from 5.15.171 up to 5.15.*, from 6.1.116 up to 6.1.* | CVE List |
| linux linux_kernel | from 4.5 before 4.19.323, from 4.20 before 5.4.285, from 5.5 before 5.10.229, from 5.11 before 5.15.171, from 5.16 before 6.1.116, from 6.2 before 6.6.60, from 6.7 before 6.11.7, 4.4.116 and 1 more | NVD |
All scores
| 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: nilfs2: fix potential deadlock with newly created symlinks Syzbot reported that page_symlink(), called by nilfs_symlink(), triggers memory reclamation involving the filesystem layer, which can result in circular lock dependencies among the reader/writer semaphore nilfs->ns_segctor_sem, s_writers percpu_rwsem (intwrite) and the fs_reclaim pseudo lock. This is because after commit 21fc61c73c39 ("don't put symlink bodies in pagecache into highmem"), the gfp flags of the page cache for symbolic links are overwritten to GFP_KERNEL via inode_nohighmem(). This is not a problem for symlinks read from the backing device, because the __GFP_FS flag is dropped after inode_nohighmem() is called. However, when a new symlink is created with nilfs_symlink(), the gfp flags remain overwritten to GFP_KERNEL. Then, memory allocation called from page_symlink() etc. triggers memory reclamation including the FS layer, which may call nilfs_evict_inode() or nilfs_dirty_inode(). And these can cause a deadlock if they are called while nilfs->ns_segctor_sem is held: Fix this issue by dropping the __GFP_FS flag from the page cache GFP flags of newly created symlinks in the same way that nilfs_new_inode() and __nilfs_read_inode() do, as a workaround until we adopt nofs allocation scope consistently or improve the locking constraints.
NVD (es)
En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: nilfs2: arregla un potencial bloqueo con enlaces simbólicos recién creados Syzbot informó que page_symlink(), llamado por nilfs_symlink(), activa la recuperación de memoria que involucra la capa del sistema de archivos, lo que puede resultar en dependencias de bloqueo circular entre el semáforo de lectura/escritura nilfs->ns_segctor_sem, s_writers percpu_rwsem (intwrite) y el pseudobloqueo fs_reclaim. Esto se debe a que después de el commit 21fc61c73c39 ("no poner cuerpos de enlaces simbólicos en pagecache en highmem"), las banderas gfp de la caché de páginas para enlaces simbólicos se sobrescriben a GFP_KERNEL a través de inode_nohighmem(). Esto no es un problema para los enlaces simbólicos leídos desde el dispositivo de respaldo, porque la bandera __GFP_FS se descarta después de que se llama a inode_nohighmem(). Sin embargo, cuando se crea un nuevo enlace simbólico con nilfs_symlink(), los indicadores gfp permanecen sobrescritos en GFP_KERNEL. Luego, la asignación de memoria llamada desde page_symlink(), etc., activa la recuperación de memoria, incluida la capa FS, que puede llamar a nilfs_evict_inode() o nilfs_dirty_inode(). Y estos pueden causar un bloqueo si se los llama mientras se mantiene nilfs->ns_segctor_sem: solucione este problema eliminando el indicador __GFP_FS de los indicadores GFP de la caché de páginas de los enlaces simbólicos recién creados de la misma manera que lo hacen nilfs_new_inode() y __nilfs_read_inode(), como workaround hasta que adoptemos el alcance de asignación de nofs de manera consistente o mejoremos las restricciones de bloqueo.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2024-50229 changed 2026-05-23 | CVE Terms of Use |
| NVD | CVE-2024-50229 changed 2026-06-17 | Public domain |