CVE-2024-45003: vfs: Don't evict inode under the inode lru traversing context
In the Linux kernel, the following vulnerability has been resolved:
vfs: Don't evict inode under the inode lru traversing context
The inode reclaiming process(See function pruneicachesb) collects all reclaimable inodes and mark them with IFREEING flag at first, at that time, other processes will be stuck if they try getting these inodes (See function findinodefast), then the reclaiming process destroy the inodes by function disposelist(). Some filesystems(eg. ext4 with eainode feature, ubifs with xattr) may do inode lookup in the inode evicting callback function, if the inode lookup is operated under the inode lru traversing context, deadlock problems may happen.
Case 1: In function ext4evictinode(), the ea inode lookup could happen if eainode feature is enabled, the lookup process will be stuck under the evicting context like this:
1. File A has inode ireg and an ea inode iea 2. getfattr(A, xattrbuf) // iea is added into lru // lru->iea 3. Then, following three processes running like this:
PA PB echo 2 > /proc/sys/vm/dropcaches shrinkslab prunedcachesb // ireg is added into lru, lru->iea->ireg pruneicachesb listlruwalkone inodelruisolate iea->istate |= IFREEING // set inode state inodelruisolate iget(ireg) spinunlock(&ireg->ilock) spinunlock(lrulock) rm file A ireg->nlink = 0 iput(ireg) // ireg->nlink is 0, do evict ext4evictinode ext4xattrdeleteinode ext4xattrinodedecrefall ext4xattrinodeiget ext4iget(iea->iino) igetlocked findinodefast waitonfreeinginode(iea) ----→ AA deadlock disposelist // cannot be executed by pruneicachesb wakeupbit(&iea->istate)
Case 2: In deleted inode writing function ubifsjnlwriteinode(), file deleting process holds BASEHD's wbuf->iomutex while getting the xattr inode, which could race with inode reclaiming process(The reclaiming process could try locking BASEHD's wbuf->iomutex in inode evicting function), then an ABBA deadlock problem would happen as following:
1. File A has inode ia and a xattr(with inode ixa), regular file B has inode ib and a xattr. 2. getfattr(A, xattrbuf) // ixa is added into lru // lru->ixa 3. Then, following three processes running like this:
PA PB PC echo 2 > /proc/sys/vm/dropcaches shrinkslab prunedcachesb // ib and ia are added into lru, lru->ixa->ib->ia pruneicachesb listlruwalkone inodelruisolate ixa->istate |= IFREEING // set inode state inodelruisolate iget(ib) spinunlock(&ib->ilock) spinunlock(lrulock) rm file B ib->nlink = 0 rm file A iput(ia) ubifsevictinode(ia) ubifsjnldeleteinode(ia) ubifsjnlwriteinode(ia) makereservation(BASEHD) // Lock wbuf->iomutex ubifsiget(ixa->iino) igetlocked findinodefast waitonfreeinginode(ixa) | iput(ib) // ib->nlink is 0, do evict | ubifsevictinode | ubifsjnldeleteinode(ib) ↓ ubifsjnlwriteinode ABBA deadlock ←-----makereservation(BASEHD) disposelist // cannot be executed by pruneicachesb wakeupbit(&ixa->istate)
Fix the possible deadlock by using new inode state flag ILRUISOLATING to pin the inode in memory while inodelruisolate( ---truncated---
Affected Software
Remediation
Event History
Frequently Asked Questions
What is the severity of CVE-2024-45003?
CVE-2024-45003 is rated as a medium severity vulnerability.
How do I fix CVE-2024-45003?
To fix CVE-2024-45003, upgrade your Linux kernel to the patched version 5.10.226-1, 6.1.123-1, or another recommended version listed in the advisory.
What versions of Linux are affected by CVE-2024-45003?
CVE-2024-45003 affects various versions of the Linux kernel ranging from 4.13 up to several prior to 6.11-rc3.
Is CVE-2024-45003 being actively exploited?
As of the latest information, there are no reports indicating that CVE-2024-45003 is actively being exploited in the wild.
What systems should prioritize patching for CVE-2024-45003?
Systems running affected versions of the Linux kernel, particularly in production or critical environments, should prioritize patching for CVE-2024-45003.