1
0
Fork 0
alistair23-linux/arch/arm64/kernel
Mark Rutland 230290dca2 arm64: syscall: exit userspace before unmasking exceptions
[ Upstream commit ca1314d73e ]

In el0_svc_common() we unmask exceptions before we call user_exit(), and
so there's a window where an IRQ or debug exception can be taken while
RCU is not watching. In do_debug_exception() we account for this in via
debug_exception_{enter,exit}(), but in the el1_irq asm we do not and we
call trace functions which rely on RCU before we have a guarantee that
RCU is watching.

Let's avoid this by having el0_svc_common() exit userspace before
unmasking exceptions, matching what we do for all other EL0 entry paths.
We can use user_exit_irqoff() to avoid the pointless save/restore of IRQ
flags while we're sure exceptions are masked in DAIF.

The workaround for Cortex-A76 erratum 1463225 may trigger a debug
exception before this point, but the debug code invoked in this case is
safe even when RCU is not watching.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: James Morse <james.morse@arm.com>
Cc: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20201130115950.22492-2-mark.rutland@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-12-30 11:50:57 +01:00
..
probes arm64: kprobes: Recover pstate.D in single-step exception handler 2019-08-02 11:55:50 +01:00
vdso arm64: vdso: Add -fasynchronous-unwind-tables to cflags 2020-05-06 08:15:17 +02:00
vdso32 ARM64: vdso32: Install vdso32 from vdso_install 2020-08-26 10:41:05 +02:00
.gitignore arm64: Build infrastructure 2012-09-17 13:42:21 +01:00
Makefile arm64: vdso: Enable vDSO compat support 2019-06-22 21:21:09 +02:00
acpi.c arm64: acpi: Make apei_claim_sea() synchronise with APEI's irq work 2020-10-01 13:18:02 +02:00
acpi_numa.c acpi: Create subtable parsing infrastructure 2019-04-04 18:41:12 +02:00
acpi_parking_protocol.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
alternative.c arm64/alternatives: don't patch up internal branches 2020-07-22 09:32:53 +02:00
armv8_deprecated.c arm64: armv8_deprecated: Fix undef_hook mask for thumb setend 2020-04-17 10:50:19 +02:00
asm-offsets.c arm64: vdso: Remove unnecessary asm-offsets.c definitions 2019-06-26 07:28:10 +02:00
cacheinfo.c arm64 updates for 5.3: 2019-07-08 09:54:55 -07:00
cpu-reset.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
cpu-reset.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
cpu_errata.c arm64: Run ARCH_WORKAROUND_2 enabling code on all CPUs 2020-11-01 12:01:02 +01:00
cpu_ops.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
cpufeature.c arm64/cpufeature: Drop TraceFilt feature exposure from ID_DFR0 register 2020-10-01 13:18:03 +02:00
cpuidle.c PSCI: cpuidle: Refactor CPU suspend power_state parameter handling 2019-08-09 17:51:39 +01:00
cpuinfo.c arm64: constify icache_policy_str[] 2019-08-13 18:32:17 +01:00
crash_core.c arm64: kernel: arch_crash_save_vmcoreinfo() should depend on CONFIG_CRASH_CORE 2018-09-11 11:08:49 +01:00
crash_dump.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
debug-monitors.c arm64: Use test_tsk_thread_flag() for checking TIF_SINGLESTEP 2020-07-29 10:18:40 +02:00
efi-entry.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
efi-header.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
efi-rt-wrapper.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
efi.c mm/pgtable: drop pgtable_t variable from pte_fn_t functions 2019-07-12 11:05:46 -07:00
entry-fpsimd.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
entry-ftrace.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
entry.S Merge branch 'errata/tx2-219' into for-next/fixes 2019-10-17 13:42:42 -07:00
fpsimd.c arm64: sve: Fix build failure when ARM64_SVE=y and SYSCTL=n 2020-06-30 15:37:05 -04:00
ftrace.c arm64: ftrace: Ensure synchronisation in PLT setup for Neoverse-N1 #1542419 2019-10-04 11:44:05 +01:00
head.S arm64/kernel: Fix range on invalidating dcache for boot page tables 2020-06-22 09:30:50 +02:00
hibernate-asm.S arm64: mm: Logic to make offset_ttbr1 conditional 2019-08-09 11:17:24 +01:00
hibernate.c arm64: hibernate: check pgd table allocation 2019-10-14 17:57:29 -07:00
hw_breakpoint.c arm64: hw_breakpoint: Don't invoke overflow handler on uaccess watchpoints 2020-06-24 17:50:47 +02:00
hyp-stub.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
image-vars.h arm64/efi: Move variable assignments after SECTIONS 2019-08-14 17:18:15 +01:00
image.h arm64/efi: Move variable assignments after SECTIONS 2019-08-14 17:18:15 +01:00
insn.c arm64: insn: consistently handle exit text 2020-10-01 13:17:23 +02:00
io.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
irq.c arm64 updates for 5.3: 2019-07-08 09:54:55 -07:00
jump_label.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
kaslr.c Merge branches 'for-next/52-bit-kva', 'for-next/cpu-topology', 'for-next/error-injection', 'for-next/perf', 'for-next/psci-cpuidle', 'for-next/rng', 'for-next/smpboot', 'for-next/tbi' and 'for-next/tlbi' into for-next/core 2019-08-30 12:46:12 +01:00
kexec_image.c arm64/kexec: Use consistent convention of initializing 'kxec_buf.mem' with KEXEC_BUF_MEM_UNKNOWN 2019-08-05 11:06:33 +01:00
kgdb.c arm64: kgdb: Fix single-step exception handling oops 2020-07-16 08:16:40 +02:00
kuser32.S docs: arm: convert docs to ReST and rename to *.rst 2019-07-15 09:20:24 -03:00
machine_kexec.c arm64: fix the flush_icache_range arguments in machine_kexec 2020-05-20 08:20:24 +02:00
machine_kexec_file.c Merge branches 'for-next/52-bit-kva', 'for-next/cpu-topology', 'for-next/error-injection', 'for-next/perf', 'for-next/psci-cpuidle', 'for-next/rng', 'for-next/smpboot', 'for-next/tbi' and 'for-next/tlbi' into for-next/core 2019-08-30 12:46:12 +01:00
module-plts.c arm64/module: set trampoline section flags regardless of CONFIG_DYNAMIC_FTRACE 2020-09-17 13:47:49 +02:00
module.c arm64: module: Mark expected switch fall-through 2019-07-29 11:59:36 +01:00
module.lds arm64: ftrace: emit ftrace-mod.o contents through code 2017-12-01 13:04:59 +00:00
paravirt.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
pci.c pci-v5.3-changes 2019-07-15 20:44:49 -07:00
perf_callchain.c arm64: stacktrace: Factor out backtrace initialisation 2019-07-22 11:44:08 +01:00
perf_event.c arm64: perf: Correct the event index in sysfs 2020-08-21 13:05:23 +02:00
perf_regs.c arm64: perf: Report the PC value in REGS_ABI_32 mode 2020-06-30 15:37:10 -04:00
pointer_auth.c arm64: ptr auth: Move per-thread keys from thread_info to thread_struct 2018-12-13 16:42:47 +00:00
process.c arm64: errata: Fix handling of 1418040 with late CPU onlining 2020-11-24 13:29:00 +01:00
psci.c arm64: psci: Avoid printing in cpu_psci_cpu_die() 2020-11-24 13:29:01 +01:00
ptrace.c arm64: ptrace: Consistently use pseudo-singlestep exceptions 2020-07-22 09:33:16 +02:00
reloc_test_core.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
reloc_test_syms.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
relocate_kernel.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
return_address.c arm64: unwind: Prohibit probing on return_address() 2019-08-01 15:00:26 +01:00
sdei.c arm64: fix wrong check of on_sdei_stack in nmi context 2019-04-04 16:02:25 +01:00
setup.c arm64: Fix __cpu_logical_map undefined issue 2020-09-03 11:26:49 +02:00
signal.c arm64: ptrace: Consistently use pseudo-singlestep exceptions 2020-07-22 09:33:16 +02:00
signal32.c arm64: compat: Get sigreturn trampolines from vDSO 2019-06-22 21:21:09 +02:00
sigreturn32.S arm64: compat: Split kuser32 2019-04-23 18:01:57 +01:00
sleep.S arm64: kernel: use aff3 instead of aff2 in comment 2019-06-04 14:51:01 +01:00
smccc-call.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
smp.c arm64: smp: Tell RCU about CPUs that fail to come online 2020-11-24 13:29:01 +01:00
smp_spin_table.c arm64: prefer __section from compiler_attributes.h 2019-08-13 18:32:15 +01:00
ssbd.c arm64: ssbd: explicitly depend on <linux/prctl.h> 2019-06-17 18:38:10 +01:00
stacktrace.c arm64: unwind: Prohibit probing on return_address() 2019-08-01 15:00:26 +01:00
suspend.c arm64: mm: Support Common Not Private translations 2018-09-18 12:02:27 +01:00
sys.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
sys32.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 452 2019-06-19 17:09:08 +02:00
sys_compat.c arm64: Silence clang warning on mismatched value/register sizes 2020-04-29 16:32:56 +02:00
syscall.c arm64: syscall: exit userspace before unmasking exceptions 2020-12-30 11:50:57 +01:00
time.c arm64: stacktrace: Factor out backtrace initialisation 2019-07-22 11:44:08 +01:00
topology.c arm64: topology: Stop using MPIDR for topology information 2020-11-05 11:43:16 +01:00
trace-events-emulation.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
traps.c arm64: Fake the IminLine size on systems affected by Neoverse-N1 #1542419 2020-04-29 16:32:56 +02:00
vdso.c arm64: vdso: don't free unallocated pages 2020-04-21 09:04:58 +02:00
vmlinux.lds.S arm64: insn: consistently handle exit text 2020-10-01 13:17:23 +02:00