CVE-2024-45003

Source
https://nvd.nist.gov/vuln/detail/CVE-2024-45003
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2024-45003.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2024-45003
Downstream
Related
Published
2024-09-04T19:54:46.276Z
Modified
2025-11-28T02:35:10.030373Z
Summary
vfs: Don't evict inode under the inode lru traversing context
Details

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 ea_inode 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 ea_inode 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->i_ea
  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->io_mutex 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, xattr_buf) // ixa is added into lru // lru->ixa
  3. Then, following three processes running like this:

       PA                PB                        PC
               echo 2 > /proc/sys/vm/drop_caches
                shrink_slab
                 prune_dcache_sb
                 // ib and ia are added into lru, lru->ixa->ib->ia
                 prune_icache_sb
                  list_lru_walk_one
                   inode_lru_isolate
                    ixa->i_state |= I_FREEING // set inode state
                   inode_lru_isolate
                    __iget(ib)
                    spin_unlock(&ib->i_lock)
                    spin_unlock(lru_lock)
                                                  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---

Database specific
{
    "cna_assigner": "Linux",
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/45xxx/CVE-2024-45003.json"
}
References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
e50e5129f384ae282adebfb561189cdb19b81cee
Fixed
3525ad25240dfdd8c78f3470911ed10aa727aa72
Fixed
03880af02a78bc9a98b5a581f529cf709c88a9b8
Fixed
cda54ec82c0f9d05393242b20b13f69b083f7e88
Fixed
437741eba63bf4e437e2beb5583f8633556a2b98
Fixed
b9bda5f6012dd00372f3a06a82ed8971a4c57c32
Fixed
9063ab49c11e9518a3f2352434bb276cc8134c5f
Fixed
2a0629834cd82f05d424bbc193374f9a43d1f87d

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
4.13.0
Fixed
5.4.283
Type
ECOSYSTEM
Events
Introduced
5.5.0
Fixed
5.10.225
Type
ECOSYSTEM
Events
Introduced
5.11.0
Fixed
5.15.166
Type
ECOSYSTEM
Events
Introduced
5.16.0
Fixed
6.1.107
Type
ECOSYSTEM
Events
Introduced
6.2.0
Fixed
6.6.48
Type
ECOSYSTEM
Events
Introduced
6.7.0
Fixed
6.10.7