linux_dsm_epyc7002/arch/arm64/kernel
Catalin Marinas 975a2396e3 arm64: mte: Allow PTRACE_PEEKMTETAGS access to the zero page
commit 68d54ceeec0e5fee4fb8048e6a04c193f32525ca upstream.

The ptrace(PTRACE_PEEKMTETAGS) implementation checks whether the user
page has valid tags (mapped with PROT_MTE) by testing the PG_mte_tagged
page flag. If this bit is cleared, ptrace(PTRACE_PEEKMTETAGS) returns
-EIO.

A newly created (PROT_MTE) mapping points to the zero page which had its
tags zeroed during cpu_enable_mte(). If there were no prior writes to
this mapping, ptrace(PTRACE_PEEKMTETAGS) fails with -EIO since the zero
page does not have the PG_mte_tagged flag set.

Set PG_mte_tagged on the zero page when its tags are cleared during
boot. In addition, to avoid ptrace(PTRACE_PEEKMTETAGS) succeeding on
!PROT_MTE mappings pointing to the zero page, change the
__access_remote_tags() check to (vm_flags & VM_MTE) instead of
PG_mte_tagged.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Fixes: 34bfeea4a9 ("arm64: mte: Clear the tags when a page is mapped in user-space with PROT_MTE")
Cc: <stable@vger.kernel.org> # 5.10.x
Cc: Will Deacon <will@kernel.org>
Reported-by: Luis Machado <luis.machado@linaro.org>
Tested-by: Luis Machado <luis.machado@linaro.org>
Reviewed-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
Link: https://lore.kernel.org/r/20210210180316.23654-1-catalin.marinas@arm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-02-17 11:02:28 +01:00
..
probes arm64: kprobes: Use BRK instead of single-step when executing instructions out-of-line 2020-11-03 14:03:38 +00:00
vdso More arm64 updates for 5.10 2020-10-23 09:46:16 -07:00
vdso32 arm64: vdso32: Allow ld.lld to properly link the VDSO 2020-10-26 13:17:41 +00:00
.gitignore
acpi_numa.c
acpi_parking_protocol.c
acpi.c
alternative.c
armv8_deprecated.c
asm-offsets.c
cacheinfo.c
cpu_errata.c arm64: cpu_errata: Apply Erratum 845719 to KRYO2XX Silver 2020-11-13 09:47:08 +00:00
cpu_ops.c
cpu-reset.h
cpu-reset.S
cpufeature.c arm64: mte: Allow PTRACE_PEEKMTETAGS access to the zero page 2021-02-17 11:02:28 +01:00
cpuidle.c
cpuinfo.c arm64: avoid -Woverride-init warning 2020-10-28 13:38:36 +00:00
crash_core.c
crash_dump.c
debug-monitors.c
efi-entry.S
efi-header.S arm64: efi: increase EFI PE/COFF header padding to 64 KB 2020-10-28 14:02:03 +00:00
efi-rt-wrapper.S
efi.c treewide: Convert macro and uses of __section(foo) to __section("foo") 2020-10-25 14:51:49 -07:00
entry-common.c arm64: entry: fix EL1 debug transitions 2020-11-30 12:11:38 +00:00
entry-fpsimd.S
entry-ftrace.S
entry.S arm64: entry: fix non-NMI user<->kernel transitions 2020-11-30 12:11:38 +00:00
fpsimd.c arm64: reject prctl(PR_PAC_RESET_KEYS) on compat tasks 2020-10-15 10:50:09 +01:00
ftrace.c
head.S
hibernate-asm.S
hibernate.c
hw_breakpoint.c
hyp-stub.S
image-vars.h KVM/arm64 fixes for 5.10, take #1 2020-10-30 13:25:09 -04:00
image.h
insn.c
io.c
irq.c arm64: entry: move el1 irq/nmi logic to C 2020-11-30 12:11:38 +00:00
jump_label.c
kaslr.c
kexec_image.c arm64: kexec_file: Fix sparse warning 2020-11-10 13:11:44 +00:00
kgdb.c
kuser32.S
machine_kexec_file.c arm64: kexec_file: try more regions if loading segments fails 2020-11-05 21:48:05 +00:00
machine_kexec.c
Makefile
module-plts.c
module.c
mte.c arm64: mte: Allow PTRACE_PEEKMTETAGS access to the zero page 2021-02-17 11:02:28 +01:00
paravirt.c
pci.c
perf_callchain.c
perf_event.c
perf_regs.c perf/arch: Remove perf_sample_data::regs_user_copy 2020-11-09 18:12:34 +01:00
pointer_auth.c arm64: reject prctl(PR_PAC_RESET_KEYS) on compat tasks 2020-10-15 10:50:09 +01:00
process.c arm64 fixes for -rc7 2020-12-02 12:27:37 -08:00
proton-pack.c arm64: proton-pack: Add KRYO2XX silver CPUs to spectre-v2 safe-list 2020-11-13 09:47:08 +00:00
psci.c arm64: psci: Avoid printing in cpu_psci_cpu_die() 2020-11-10 13:11:44 +00:00
ptrace.c
reloc_test_core.c
reloc_test_syms.S
relocate_kernel.S
return_address.c
scs.c
sdei.c arm64: entry: fix NMI {user, kernel}->kernel transitions 2020-11-30 12:11:38 +00:00
setup.c memblock: use separate iterators for memory and reserved regions 2020-10-13 18:38:35 -07:00
signal32.c
signal.c arm64: entry: remove redundant IRQ flag tracing 2021-01-27 11:55:07 +01:00
sigreturn32.S
sleep.S
smccc-call.S
smp_spin_table.c treewide: Convert macro and uses of __section(foo) to __section("foo") 2020-10-25 14:51:49 -07:00
smp.c arm64: smp: Tell RCU about CPUs that fail to come online 2020-11-10 13:11:44 +00:00
stacktrace.c
suspend.c
sys32.c
sys_compat.c
sys.c
syscall.c arm64: entry: remove redundant IRQ flag tracing 2021-01-27 11:55:07 +01:00
time.c
topology.c Power management updates for 5.10-rc1 2020-10-14 10:45:41 -07:00
trace-events-emulation.h
traps.c arm64: entry: fix NMI {user, kernel}->kernel transitions 2020-11-30 12:11:38 +00:00
vdso.c
vmlinux.lds.S arm64: vmlinux.lds: account for spurious empty .igot.plt sections 2020-10-28 13:44:24 +00:00