In the Linux kernel, the following vulnerability has been resolved:
mm/gup: fix memfdpinfolios alloc race panic
If memfdpinfolios tries to create a hugetlb page, but someone else already did, then folio gets the value -EEXIST here:
folio = memfd_alloc_folio(memfd, start_idx);
if (IS_ERR(folio)) {
ret = PTR_ERR(folio);
if (ret != -EEXIST)
goto err;
then on the next trip through the "while start_idx" loop we panic here:
if (folio) {
folio_put(folio);
To fix, set the folio to NULL on error.
[
{
"signature_version": "v1",
"deprecated": false,
"target": {
"function": "memfd_pin_folios",
"file": "mm/gup.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e28f39b359c0cfdcc011603e51187085a5f1e5e3",
"digest": {
"function_hash": "160405053835152729222400439494103541297",
"length": 1704.0
},
"signature_type": "Function",
"id": "CVE-2024-49872-490e3e4b"
},
{
"signature_version": "v1",
"deprecated": false,
"target": {
"function": "memfd_pin_folios",
"file": "mm/gup.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ce645b9fdc78ec5d28067286e92871ddae6817d5",
"digest": {
"function_hash": "160405053835152729222400439494103541297",
"length": 1704.0
},
"signature_type": "Function",
"id": "CVE-2024-49872-b5aa5748"
},
{
"signature_version": "v1",
"deprecated": false,
"target": {
"file": "mm/gup.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e28f39b359c0cfdcc011603e51187085a5f1e5e3",
"digest": {
"line_hashes": [
"146933450404069553510915343750206246407",
"31427901901398074050896372576821255126",
"263736259158063109849109438428756036407",
"81349835723810761116707704602341327634"
],
"threshold": 0.9
},
"signature_type": "Line",
"id": "CVE-2024-49872-ed557964"
},
{
"signature_version": "v1",
"deprecated": false,
"target": {
"file": "mm/gup.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ce645b9fdc78ec5d28067286e92871ddae6817d5",
"digest": {
"line_hashes": [
"146933450404069553510915343750206246407",
"31427901901398074050896372576821255126",
"263736259158063109849109438428756036407",
"81349835723810761116707704602341327634"
],
"threshold": 0.9
},
"signature_type": "Line",
"id": "CVE-2024-49872-f0fb3403"
}
]