CVE-2022-50675
JSON

Not scored

arm64: mte: Avoid setting PG_mte_tagged if no tags cleared or restored

Severity
Not scored
Exploit likelihood
0.26% (higher than 18% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
Linux

Description

In the Linux kernel, the following vulnerability has been resolved: arm64: mte: Avoid setting PG_mte_tagged if no tags cleared or restored Prior to commit 69e3b846d8a7 ("arm64: mte: Sync tags for pages where PTE is untagged"), mte_sync_tags() was only called for pte_tagged() entries (those mapped with PROT_MTE). Therefore mte_sync_tags() could safely use test_and_set_bit(PG_mte_tagged, &page->flags) without inadvertently setting PG_mte_tagged on an untagged page. The above commit was required as guests may enable MTE without any control at the stage 2 mapping, nor a PROT_MTE mapping in the VMM. However, the side-effect was that any page with a PTE that looked like swap (or migration) was getting PG_mte_tagged set automatically. A subsequent page copy (e.g. migration) copied the tags to the destination page even if the tags were owned by KASAN. This issue was masked by the page_kasan_tag_reset() call introduced in commit e5b8d9218951 ("arm64: mte: reset the page tag in page->flags"). When this commit was reverted (20794545c146), KASAN started reporting access faults because the overriding tags in a page did not match the original page->flags (with CONFIG_KASAN_HW_TAGS=y): BUG: KASAN: invalid-access in copy_page+0x10/0xd0 arch/arm64/lib/copy_page.S:26 Read at addr f5ff000017f2e000 by task syz-executor.1/2218 Pointer tag: [f5], memory tag: [f2] Move the PG_mte_tagged bit setting from mte_sync_tags() to the actual place where tags are cleared (mte_sync_page_tags()) or restored (mte_restore_tags()).

Affected

Product or packageVersionsReported by
Linux Linuxfrom 69e3b846d8a753f9f279f29531ca56b0f7563ad0 before 918002bdbe4328c8c0164a22e8ebf2384b80dc23, from 69e3b846d8a753f9f279f29531ca56b0f7563ad0 before 749e9fc18b1e1a3f93a9512e91bd7f93002d2821, from 69e3b846d8a753f9f279f29531ca56b0f7563ad0 before a8e5e5146ad08d794c58252bab00b261045ef16d, 5.14
Not affected: before 5.14, from 5.15.82 up to 5.15.*, from 6.0.3 up to 6.0.*, from 6.1 up to *
CVE List

What each source says

CVE List

In the Linux kernel, the following vulnerability has been resolved: arm64: mte: Avoid setting PG_mte_tagged if no tags cleared or restored Prior to commit 69e3b846d8a7 ("arm64: mte: Sync tags for pages where PTE is untagged"), mte_sync_tags() was only called for pte_tagged() entries (those mapped with PROT_MTE). Therefore mte_sync_tags() could safely use test_and_set_bit(PG_mte_tagged, &page->flags) without inadvertently setting PG_mte_tagged on an untagged page. The above commit was required as guests may enable MTE without any control at the stage 2 mapping, nor a PROT_MTE mapping in the VMM. However, the side-effect was that any page with a PTE that looked like swap (or migration) was getting PG_mte_tagged set automatically. A subsequent page copy (e.g. migration) copied the tags to the destination page even if the tags were owned by KASAN. This issue was masked by the page_kasan_tag_reset() call introduced in commit e5b8d9218951 ("arm64: mte: reset the page tag in page->flags"). When this commit was reverted (20794545c146), KASAN started reporting access faults because the overriding tags in a page did not match the original page->flags (with CONFIG_KASAN_HW_TAGS=y): BUG: KASAN: invalid-access in copy_page+0x10/0xd0 arch/arm64/lib/copy_page.S:26 Read at addr f5ff000017f2e000 by task syz-executor.1/2218 Pointer tag: [f5], memory tag: [f2] Move the PG_mte_tagged bit setting from mte_sync_tags() to the actual place where tags are cleared (mte_sync_page_tags()) or restored (mte_restore_tags()).

NVD (es)

En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta: arm64: mte: Evitar establecer PG_mte_tagged si no se borran o restauran etiquetas Antes del commit 69e3b846d8a7 (’arm64: mte: Sincronizar etiquetas para páginas donde el PTE no está etiquetado’), mte_sync_tags() solo se llamaba para entradas pte_tagged() (aquellas mapeadas con PROT_MTE). Por lo tanto, mte_sync_tags() podía usar de forma segura test_and_set_bit(PG_mte_tagged, &page -> flags) sin establecer inadvertidamente PG_mte_tagged en una página sin etiquetar. El commit anterior fue necesario ya que los invitados pueden habilitar MTE sin ningún control en el mapeo de etapa 2, ni un mapeo PROT_MTE en el VMM. Sin embargo, el efecto secundario fue que cualquier página con un PTE que parecía de intercambio (o migración) estaba obteniendo PG_mte_tagged establecido automáticamente. Una copia de página posterior (por ejemplo, migración) copiaba las etiquetas a la página de destino incluso si las etiquetas eran propiedad de KASAN. Este problema fue enmascarado por la llamada a page_kasan_tag_reset() introducida en el commit e5b8d9218951 (’arm64: mte: restablecer la etiqueta de página en page -> flags’). Cuando este commit fue revertido (20794545c146), KASAN comenzó a reportar fallos de acceso porque las etiquetas sobrescribientes en una página no coincidían con las page -> flags originales (con CONFIG_KASAN_HW_TAGS=y): BUG: KASAN: acceso-inválido en copy_page+0x10/0xd0 arch/arm64/lib/copy_page.S:26 Lectura en la dirección f5ff000017f2e000 por la tarea syz-executor.1/2218 Etiqueta del puntero: [f5], etiqueta de memoria: [f2] Mover la configuración del bit PG_mte_tagged de mte_sync_tags() al lugar real donde las etiquetas se borran (mte_sync_page_tags()) o se restauran (mte_restore_tags()).

References

Sources

SourceRecordLicence
CVE ListCVE-2022-50675 changed 2026-05-11CVE Terms of Use
NVDCVE-2022-50675 changed 2026-11-10Public domain