In the Linux kernel, the following vulnerability has been resolved:
cachefiles: remove requests from xarray during flushing requests
Even with CACHEFILES_DEAD set, we can still read the requests, so in the following concurrency the request may be used after it has been freed:
cachefilesondemandinitobject cachefilesondemandsendreq REQA = kzalloc(sizeof(*req) + datalen) waitforcompletion(&REQA->done) cachefilesdaemonread cachefilesondemanddaemonread // close dev fd cachefilesflushreqs complete(&REQA->done) kfree(REQA) xalock(&cache->reqs); cachefilesondemandselectreq req->msg.opcode != CACHEFILESOPREAD // req use-after-free !!! xaunlock(&cache->reqs); xadestroy(&cache->reqs)
Hence remove requests from cache->reqs when flushing them to avoid accessing freed requests.
[
{
"id": "CVE-2024-40900-09126e5c",
"signature_type": "Function",
"deprecated": false,
"target": {
"file": "fs/cachefiles/daemon.c",
"function": "cachefiles_flush_reqs"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@50d0e55356ba5b84ffb51c42704126124257e598",
"signature_version": "v1",
"digest": {
"length": 321.0,
"function_hash": "282506108123091286457195073191085585515"
}
},
{
"id": "CVE-2024-40900-304c4f59",
"signature_type": "Function",
"deprecated": false,
"target": {
"file": "fs/cachefiles/daemon.c",
"function": "cachefiles_flush_reqs"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9f13aacdd4ee9a7644b2a3c96d67113cd083c9c7",
"signature_version": "v1",
"digest": {
"length": 321.0,
"function_hash": "282506108123091286457195073191085585515"
}
},
{
"id": "CVE-2024-40900-a55f1244",
"signature_type": "Line",
"deprecated": false,
"target": {
"file": "fs/cachefiles/daemon.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@37e19cf86a520d65de1de9cb330415c332a40d19",
"signature_version": "v1",
"digest": {
"line_hashes": [
"133368490668874490762107831458119947499",
"87146630799270410229938242051576640373",
"172176499812823668186824265549417495836",
"85349179178899306129855673688386906462"
],
"threshold": 0.9
}
},
{
"id": "CVE-2024-40900-b4c3026f",
"signature_type": "Line",
"deprecated": false,
"target": {
"file": "fs/cachefiles/daemon.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@50d0e55356ba5b84ffb51c42704126124257e598",
"signature_version": "v1",
"digest": {
"line_hashes": [
"133368490668874490762107831458119947499",
"87146630799270410229938242051576640373",
"172176499812823668186824265549417495836",
"85349179178899306129855673688386906462"
],
"threshold": 0.9
}
},
{
"id": "CVE-2024-40900-c7ab4d90",
"signature_type": "Line",
"deprecated": false,
"target": {
"file": "fs/cachefiles/daemon.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9f13aacdd4ee9a7644b2a3c96d67113cd083c9c7",
"signature_version": "v1",
"digest": {
"line_hashes": [
"133368490668874490762107831458119947499",
"87146630799270410229938242051576640373",
"172176499812823668186824265549417495836",
"85349179178899306129855673688386906462"
],
"threshold": 0.9
}
},
{
"id": "CVE-2024-40900-e45c1e35",
"signature_type": "Function",
"deprecated": false,
"target": {
"file": "fs/cachefiles/daemon.c",
"function": "cachefiles_flush_reqs"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@37e19cf86a520d65de1de9cb330415c332a40d19",
"signature_version": "v1",
"digest": {
"length": 321.0,
"function_hash": "282506108123091286457195073191085585515"
}
}
]