linux-kernelorg-stable/arch/arm64/kernel
Catalin Marinas 68d54ceeec arm64: mte: Allow PTRACE_PEEKMTETAGS access to the zero page
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
2021-02-12 16:08:31 +00:00
..
probes arm64: kprobes: Fix Uexpected kernel BRK exception at EL1 2021-01-22 16:05:29 +00:00
vdso arm64: vdso: disable .eh_frame_hdr via /DISCARD/ instead of --no-eh-frame-hdr 2021-01-05 17:52:13 +00:00
vdso32 arm64: lto: Strengthen READ_ONCE() to acquire when CONFIG_LTO=y 2020-11-09 21:49:34 +00:00
.gitignore
Makefile arm64: scs: use vmapped IRQ and SDEI shadow stacks 2020-12-01 11:23:34 +00:00
acpi.c arm64: permit ACPI core to map kernel memory used for table overrides 2020-09-30 22:27:51 +01:00
acpi_numa.c
acpi_parking_protocol.c
alternative.c arm64: alternatives: Remove READ_ONCE() usage during patch operation 2020-11-09 21:49:34 +00:00
armv8_deprecated.c arm64: uaccess: rename privileged uaccess routines 2020-12-02 19:49:10 +00:00
asm-offsets.c arm64: rename S_FRAME_SIZE to PT_REGS_SIZE 2021-01-13 15:09:06 +00:00
cacheinfo.c
cpu-reset.S
cpu-reset.h
cpu_errata.c Merge branch 'kvm-arm64/vector-rework' into kvmarm-master/next 2020-11-27 11:47:08 +00:00
cpu_ops.c
cpufeature.c arm64: mte: Allow PTRACE_PEEKMTETAGS access to the zero page 2021-02-12 16:08:31 +00: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 arm64: expose FAR_EL1 tag bits in siginfo 2020-11-23 18:17:39 +00:00
efi-entry.S
efi-header.S arm64: head: tidy up the Image header definition 2020-11-17 16:14:20 +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 Merge remote-tracking branch 'arm64/for-next/fixes' into for-next/core 2020-12-09 18:04:55 +00:00
entry-fpsimd.S arm64/sve: Implement a helper to load SVE registers from FPSIMD state 2020-09-21 18:06:33 +01:00
entry-ftrace.S arm64: rename S_FRAME_SIZE to PT_REGS_SIZE 2021-01-13 15:09:06 +00:00
entry.S arm64: rename S_FRAME_SIZE to PT_REGS_SIZE 2021-01-13 15:09:06 +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 kasan, arm64: expand CONFIG_KASAN checks 2020-12-22 12:55:08 -08:00
hibernate-asm.S
hibernate.c arm64: mte: reset the page tag in page->flags 2020-12-22 12:55:07 -08:00
hw_breakpoint.c
hyp-stub.S
image-vars.h kasan, arm64: expand CONFIG_KASAN checks 2020-12-22 12:55:08 -08:00
image.h
insn.c
io.c
irq.c Merge remote-tracking branch 'arm64/for-next/fixes' into for-next/core 2020-12-09 18:04:55 +00:00
jump_label.c
kaslr.c kasan, arm64: expand CONFIG_KASAN checks 2020-12-22 12:55:08 -08:00
kexec_image.c arm64: kexec_file: Fix sparse warning 2020-11-10 13:11:44 +00:00
kgdb.c
kuser32.S
machine_kexec.c
machine_kexec_file.c arm64: kexec_file: try more regions if loading segments fails 2020-11-05 21:48:05 +00:00
module-plts.c
module.c kasan, arm64: expand CONFIG_KASAN checks 2020-12-22 12:55:08 -08:00
mte.c arm64: mte: Allow PTRACE_PEEKMTETAGS access to the zero page 2021-02-12 16:08:31 +00:00
paravirt.c
pci.c
perf_callchain.c
perf_event.c Revert "arm64: Enable perf events based hard lockup detector" 2021-01-13 15:08:41 +00:00
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 Merge branch 'kvm-master' into kvm-next 2021-01-07 18:06:52 -05:00
proton-pack.c Merge remote-tracking branch 'arm64/for-next/fixes' into for-next/core 2020-12-09 18:04:55 +00:00
psci.c arm64: psci: Avoid printing in cpu_psci_cpu_die() 2020-11-10 13:11:44 +00:00
ptrace.c arm64: expose FAR_EL1 tag bits in siginfo 2020-11-23 18:17:39 +00:00
reloc_test_core.c
reloc_test_syms.S
relocate_kernel.S
return_address.c
sdei.c Merge branch 'kvm-master' into kvm-next 2021-01-07 18:06:52 -05:00
setup.c kasan, arm64: rename kasan_init_tags and mark as __init 2020-12-22 12:55:07 -08:00
signal.c arm64: entry: remove redundant IRQ flag tracing 2021-01-13 12:51:30 +00:00
signal32.c
sigreturn32.S
sleep.S kasan, arm64: unpoison stack only with CONFIG_KASAN_STACK 2020-12-22 12:55:08 -08:00
smccc-call.S
smp.c x86: 2021-01-08 15:06:02 -08:00
smp_spin_table.c treewide: Convert macro and uses of __section(foo) to __section("foo") 2020-10-25 14:51:49 -07:00
stacktrace.c arm64: Move console stack display code to stacktrace.c 2020-09-21 19:43:03 +01:00
suspend.c arm64: uaccess: remove set_fs() 2020-12-02 19:49:11 +00:00
sys.c
sys32.c
sys_compat.c arm64: expose FAR_EL1 tag bits in siginfo 2020-11-23 18:17:39 +00:00
syscall.c arm64: syscall: include prototype for EL0 SVC functions 2021-01-15 10:05:27 +00:00
time.c
topology.c arm64 fixes/updates: 2020-12-18 10:57:27 -08:00
trace-events-emulation.h
traps.c arm64: traps: remove duplicate include statement 2021-01-05 17:52:12 +00:00
vdso.c mm: forbid splitting special mappings 2020-12-15 12:13:41 -08:00
vmlinux.lds.S ARM: 2020-12-20 10:44:05 -08:00