WSL2-Linux-Kernel/arch/arm64
Peter Collingbourne c37eb46c61 arm64: Also reset KASAN tag if page is not PG_mte_tagged
commit 2efbafb91e upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-05-30 13:55:29 +01:00
..
boot arm64: dts: qcom: msm8996: Add missing DWC3 quirks 2023-05-24 17:36:43 +01:00
configs arm64: defconfig: build imx-sdma as a module 2022-04-08 14:24:00 +02:00
crypto crypto: arm64/gcm - Select AEAD for GHASH_ARM64_CE 2022-08-17 14:23:26 +02:00
hyperv arm64: hyperv: Initialize hypervisor on boot 2021-08-04 16:54:36 +00:00
include arm64: kgdb: Set PSTATE.SS to 1 to re-enable single-step 2023-05-11 23:00:24 +09:00
kernel arm64: kgdb: Set PSTATE.SS to 1 to re-enable single-step 2023-05-11 23:00:24 +09:00
kvm KVM: arm64: Fix buffer overflow in kvm_arm_set_fw_reg() 2023-05-01 08:23:23 +09:00
lib arm64: mte: DC {GVA,GZVA} shouldn't be used when DCZID_EL0.DZP == 1 2022-01-27 11:03:28 +01:00
mm arm64: Also reset KASAN tag if page is not PG_mte_tagged 2023-05-30 13:55:29 +01:00
net bpf, arm64: Use emit_addr_mov_i64() for BPF_PSEUDO_FUNC 2022-07-12 16:34:54 +02:00
tools arm64: errata: Remove AES hwcap for COMPAT tasks 2022-10-29 10:12:53 +02:00
xen
Kbuild arm64: hyperv: Add Hyper-V hypercall and register access utilities 2021-08-04 16:54:36 +00:00
Kconfig arm64: errata: Remove AES hwcap for COMPAT tasks 2022-10-29 10:12:53 +02:00
Kconfig.debug
Kconfig.platforms irqchip/exiu: Fix acknowledgment of edge triggered interrupts 2022-06-09 10:22:54 +02:00
Makefile arm64 updates for 5.15: 2021-09-01 15:04:29 -07:00