In the Linux kernel, the following vulnerability has been resolved:
mm/migrate: fix shmem xarray update during migration
A shmem folio can be either in page cache or in swap cache, but not at the same time. Namely, once it is in swap cache, folio->mapping should be NULL, and the folio is no longer in a shmem mapping.
In _foliomigratemapping(), to determine the number of xarray entries to update, foliotestswapbacked() is used, but that conflates shmem in page cache case and shmem in swap cache case. It leads to xarray multi-index entry corruption, since it turns a sibling entry to a normal entry during xasstore() (see [1] for a userspace reproduction). Fix it by only using foliotestswapcache() to determine whether xarray is storing swap cache entries or not to choose the right number of xarray entries to update.
[1] https://lore.kernel.org/linux-mm/Z8idPCkaJW1IChjT@casper.infradead.org/
Note: In _splithugepage(), foliotestanon() && foliotestswapcache() is used to get swapcache address space, but that ignores the shmem folio in swap cache case. It could lead to NULL pointer dereferencing when a in-swap-cache shmem folio is split at _xastore(), since !foliotestanon() is true and folio->mapping is NULL. But fortunately, its caller splithugepagetolisttoorder() bails out early with EBUSY when folio->mapping is NULL. So no need to take care of it here.
[
{
"signature_type": "Function",
"deprecated": false,
"target": {
"file": "mm/migrate.c",
"function": "folio_migrate_mapping"
},
"digest": {
"length": 2088.0,
"function_hash": "14923251138126787591266845793489643923"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@29124ae980e2860f0eec7355949d3d3292ee81da",
"signature_version": "v1",
"id": "CVE-2025-22015-2989e7ec"
},
{
"signature_type": "Line",
"deprecated": false,
"target": {
"file": "mm/migrate.c"
},
"digest": {
"line_hashes": [
"37612668259392328594190852947169002078",
"121280602470159722539462775450936557783",
"142925461774925487966035682164757878494",
"97290462430729386282938790464251750422",
"274541637442175484516827304745207653387",
"128555236087656153539985504925011928824",
"192675872259342200560033057107078715253",
"52114491988426708411157974175991130018",
"24998623503374693168489341785877135712",
"222802203856230918907218558150531995318",
"320941404560494691802971149630446628095",
"153621442200892052033372588310879214074"
],
"threshold": 0.9
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@29124ae980e2860f0eec7355949d3d3292ee81da",
"signature_version": "v1",
"id": "CVE-2025-22015-42391fef"
},
{
"signature_type": "Function",
"deprecated": false,
"target": {
"file": "mm/migrate.c",
"function": "__folio_migrate_mapping"
},
"digest": {
"length": 2388.0,
"function_hash": "49494306931211139082726422742379205110"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@c057ee03f751d6cecf7ee64f52f6545d94082aaa",
"signature_version": "v1",
"id": "CVE-2025-22015-8fbd106a"
},
{
"signature_type": "Line",
"deprecated": false,
"target": {
"file": "mm/migrate.c"
},
"digest": {
"line_hashes": [
"125113778028472090664174069581033628678",
"37629740680160432707877049550942951832",
"142925461774925487966035682164757878494",
"97290462430729386282938790464251750422",
"274541637442175484516827304745207653387",
"128555236087656153539985504925011928824",
"192675872259342200560033057107078715253",
"52114491988426708411157974175991130018",
"24998623503374693168489341785877135712",
"222802203856230918907218558150531995318",
"320941404560494691802971149630446628095",
"153621442200892052033372588310879214074"
],
"threshold": 0.9
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@c057ee03f751d6cecf7ee64f52f6545d94082aaa",
"signature_version": "v1",
"id": "CVE-2025-22015-92eaf490"
},
{
"signature_type": "Function",
"deprecated": false,
"target": {
"file": "mm/migrate.c",
"function": "folio_migrate_mapping"
},
"digest": {
"length": 2063.0,
"function_hash": "189246379524580923976876462192890086343"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@49100c0b070e900f87c8fac3be9b9ef8a30fa673",
"signature_version": "v1",
"id": "CVE-2025-22015-cb0975c8"
},
{
"signature_type": "Line",
"deprecated": false,
"target": {
"file": "mm/migrate.c"
},
"digest": {
"line_hashes": [
"37612668259392328594190852947169002078",
"121280602470159722539462775450936557783",
"142925461774925487966035682164757878494",
"1958554645348204387113528015978729441",
"102918657139844465079313186198241105084",
"123738176857762766292426972244576484874",
"217484449045451916753400574658486660192",
"175795204337953749343501060152073310435",
"254977215484652111907794198192372045964",
"111954246982197103419918288211500350412",
"245611243555615940140816568896064473360",
"24998623503374693168489341785877135712",
"222802203856230918907218558150531995318",
"320941404560494691802971149630446628095",
"153621442200892052033372588310879214074"
],
"threshold": 0.9
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@49100c0b070e900f87c8fac3be9b9ef8a30fa673",
"signature_version": "v1",
"id": "CVE-2025-22015-f48269ec"
}
]