linux-stable/arch/arm64/mm
Peter Collingbourne 2efbafb91e arm64: Also reset KASAN tag if page is not PG_mte_tagged
Consider the following sequence of events:

1) A page in a PROT_READ|PROT_WRITE VMA is faulted.
2) Page migration allocates a page with the KASAN allocator,
   causing it to receive a non-match-all tag, and uses it
   to replace the page faulted in 1.
3) The program uses mprotect() to enable PROT_MTE on the page faulted in 1.

As a result of step 3, we are left with a non-match-all tag for a page
with tags accessible to userspace, which can lead to the same kind of
tag check faults that commit e74a684680 ("arm64: Reset KASAN tag in
copy_highpage with HW tags only") intended to fix.

The general invariant that we have for pages in a VMA with VM_MTE_ALLOWED
is that they cannot have a non-match-all tag. As a result of step 2, the
invariant is broken. This means that the fix in the referenced commit
was incomplete and we also need to reset the tag for pages without
PG_mte_tagged.

Fixes: e5b8d92189 ("arm64: mte: reset the page tag in page->flags")
Cc: <stable@vger.kernel.org> # 5.15
Link: https://linux-review.googlesource.com/id/I7409cdd41acbcb215c2a7417c1e50d37b875beff
Signed-off-by: Peter Collingbourne <pcc@google.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Link: https://lore.kernel.org/r/20230420210945.2313627-1-pcc@google.com
Signed-off-by: Will Deacon <will@kernel.org>
2023-05-16 14:58:54 +01:00
..
cache.S efi: arm64: enter with MMU and caches enabled 2023-01-24 11:51:08 +00:00
context.c arm64/sysreg: Standardise naming of ID_AA64MMFR0_EL1.ASIDBits 2022-09-09 10:59:02 +01:00
copypage.c arm64: Also reset KASAN tag if page is not PG_mte_tagged 2023-05-16 14:58:54 +01:00
dma-mapping.c Revert "Revert "arm64: dma: Drop cache invalidation from arch_dma_prep_coherent()"" 2023-03-30 16:23:03 +01:00
extable.c arm64: extable: cleanup redundant extable type EX_TYPE_FIXUP 2022-06-28 12:11:47 +01:00
fault.c arm64/mm: mark private VM_FAULT_X defines as vm_fault_t 2023-05-16 14:50:43 +01:00
fixmap.c arm64: mm: always map fixmap at page granularity 2023-04-11 18:55:28 +01:00
flush.c mm: hugetlb_vmemmap: delete hugetlb_optimize_vmemmap_enabled() 2022-08-08 18:06:42 -07:00
hugetlbpage.c arm64: errata: Workaround possible Cortex-A715 [ESR|FAR]_ELx corruption 2023-01-06 17:14:55 +00:00
init.c arm64: kdump: defer the crashkernel reservation for platforms with no DMA memory zones 2023-04-11 19:24:46 +01:00
ioremap.c arm64: mm: Convert to GENERIC_IOREMAP 2022-06-27 12:22:31 +01:00
kasan_init.c arm64: mm: provide idmap pointer to cpu_replace_ttbr1() 2022-06-24 17:18:10 +01:00
Makefile arm64: mm: move fixmap code to its own file 2023-04-11 18:55:28 +01:00
mmap.c arm64/mm: move protection_map[] inside the platform 2022-07-17 17:14:37 -07:00
mmu.c Merge branch 'for-next/mm' into for-next/core 2023-04-20 11:22:33 +01:00
mteswap.c arm64: mte: Lock a page for MTE tag initialisation 2022-11-29 09:26:07 +00:00
pageattr.c mm,kfence: decouple kfence from page granularity mapping judgement 2023-03-27 16:15:20 +01:00
pgd.c
physaddr.c
proc.S arm64: kernel: remove SHF_WRITE|SHF_EXECINSTR from .idmap.text 2023-05-02 12:42:22 +01:00
ptdump.c arm64: add FIXADDR_TOT_{START,SIZE} 2023-04-11 18:55:28 +01:00
ptdump_debugfs.c
trans_pgd-asm.S arm64: kexec: configure EL2 vectors for kexec 2021-10-01 13:31:00 +01:00
trans_pgd.c arm64: mm: avoid writable executable mappings in kexec/hibernate code 2022-05-17 09:32:45 +01:00