linux/arch/arm64/kernel
Catalin Marinas 39bc88e5e3 arm64: Disable TTBR0_EL1 during normal kernel execution
When the TTBR0 PAN feature is enabled, the kernel entry points need to
disable access to TTBR0_EL1. The PAN status of the interrupted context
is stored as part of the saved pstate, reusing the PSR_PAN_BIT (22).
Restoring access to TTBR0_EL1 is done on exception return if returning
to user or returning to a context where PAN was disabled.

Context switching via switch_mm() must defer the update of TTBR0_EL1
until a return to user or an explicit uaccess_enable() call.

Special care needs to be taken for two cases where TTBR0_EL1 is set
outside the normal kernel context switch operation: EFI run-time
services (via efi_set_pgd) and CPU suspend (via cpu_(un)install_idmap).
Code has been added to avoid deferred TTBR0_EL1 switching as in
switch_mm() and restore the reserved TTBR0_EL1 when uninstalling the
special TTBR0_EL1.

User cache maintenance (user_cache_maint_handler and
__flush_cache_user_range) needs the TTBR0_EL1 re-instated since the
operations are performed by user virtual address.

This patch also removes a stale comment on the switch_mm() function.

Cc: Will Deacon <will.deacon@arm.com>
Cc: James Morse <james.morse@arm.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-11-21 18:48:54 +00:00
..
probes arm64: fix error: conflicting types for 'kprobe_fault_handler' 2016-11-07 18:15:21 +00:00
vdso
.gitignore
acpi.c ARM64: ACPI: enable ACPI_SPCR_TABLE 2016-09-28 17:46:57 +02:00
acpi_numa.c arm64/numa: avoid inconsistent information to be printed 2016-09-09 14:59:08 +01:00
acpi_parking_protocol.c
alternative.c arm64: alternative: Add support for patching adrp instructions 2016-09-09 15:03:28 +01:00
arm64ksyms.c
armv8_deprecated.c arm64: Factor out PAN enabling/disabling into separate uaccess_* macros 2016-11-21 17:33:47 +00:00
asm-offsets.c arm64: Introduce uaccess_{disable,enable} functionality based on TTBR0_EL1 2016-11-21 18:48:53 +00:00
cacheinfo.c arm64: simplify sysreg manipulation 2016-09-09 11:43:50 +01:00
cpu-reset.h
cpu-reset.S
cpu_errata.c arm64: cpufeature: Schedule enable() calls instead of calling them via IPI 2016-10-20 09:50:53 +01:00
cpu_ops.c arm64: apply __ro_after_init to some objects 2016-08-22 12:32:29 +01:00
cpufeature.c arm64: Introduce uaccess_{disable,enable} functionality based on TTBR0_EL1 2016-11-21 18:48:53 +00:00
cpuidle.c
cpuinfo.c arm64: Rearrange CPU errata workaround checks 2016-09-09 15:03:28 +01:00
debug-monitors.c arm64: Handle TRAP_BRKPT for user mode as well 2016-11-07 18:15:21 +00:00
efi-entry.S
efi.c arm64: mm: replace 'block_mappings_allowed' with 'page_mappings_only' 2016-11-07 18:15:04 +00:00
entry-fpsimd.S
entry-ftrace.S ftrace: Remove CONFIG_HAVE_FUNCTION_GRAPH_FP_TEST from config 2016-08-24 12:15:13 +02:00
entry.S arm64: Disable TTBR0_EL1 during normal kernel execution 2016-11-21 18:48:54 +00:00
entry32.S
fpsimd.c arm64: Support systems without FP/ASIMD 2016-11-16 18:05:10 +00:00
ftrace.c ftrace: Add return address pointer to ftrace_ret_stack 2016-08-24 12:15:14 +02:00
head.S arm64: Introduce uaccess_{disable,enable} functionality based on TTBR0_EL1 2016-11-21 18:48:53 +00:00
hibernate-asm.S arm64: Introduce raw_{d,i}cache_line_size 2016-09-09 15:03:29 +01:00
hibernate.c Revert "arm64: hibernate: Refuse to hibernate if the boot cpu is offline" 2016-08-26 11:21:25 +01:00
hw_breakpoint.c arm64: hw_breakpoint: convert CPU hotplug notifier to new infrastructure 2016-09-01 13:45:51 +01:00
hyp-stub.S
image.h
insn.c arm64: insn: Add helpers for adrp offsets 2016-09-09 15:03:28 +01:00
io.c
irq.c
jump_label.c
kaslr.c arm64: apply __ro_after_init to some objects 2016-08-22 12:32:29 +01:00
kgdb.c arm64: kgdb_step_brk_fn: ignore other's exception 2016-11-07 18:15:20 +00:00
kuser32.S
machine_kexec.c
Makefile arm64: Set UTS_MACHINE in the Makefile 2016-08-31 12:31:38 +01:00
module-plts.c
module.c
module.lds
paravirt.c
pci.c
perf_callchain.c
perf_event.c arm64: pmu: Hoist pmu platform device name 2016-09-16 17:11:34 +01:00
perf_regs.c
process.c arm64: Add hypervisor safe helper for checking constant capabilities 2016-11-16 17:50:51 +00:00
psci.c
ptrace.c
relocate_kernel.S arm64: Introduce raw_{d,i}cache_line_size 2016-09-09 15:03:29 +01:00
return_address.c arm64: factor out current_stack_pointer 2016-11-11 18:25:43 +00:00
setup.c arm64: Disable TTBR0_EL1 during normal kernel execution 2016-11-21 18:48:54 +00:00
signal.c arm64: Add uprobe support 2016-11-07 18:15:21 +00:00
signal32.c
sleep.S arm64: move sp_el0 and tpidr_el1 into cpu_suspend_ctx 2016-11-11 18:25:44 +00:00
smccc-call.S
smp.c arm64: split thread_info from task stack 2016-11-11 18:25:46 +00:00
smp_spin_table.c arm64: vmlinux.ld: Add mmuoff data sections and move mmuoff text into idmap 2016-08-25 18:00:30 +01:00
stacktrace.c arm64: prep stack walkers for THREAD_INFO_IN_TASK 2016-11-11 18:25:44 +00:00
suspend.c arm64: move sp_el0 and tpidr_el1 into cpu_suspend_ctx 2016-11-11 18:25:44 +00:00
sys.c
sys32.c
sys_compat.c arm64: simplify sysreg manipulation 2016-09-09 11:43:50 +01:00
time.c
topology.c arm64: add sysfs cpu_capacity attribute 2016-11-07 18:15:03 +00:00
trace-events-emulation.h
traps.c arm64: Disable TTBR0_EL1 during normal kernel execution 2016-11-21 18:48:54 +00:00
vdso.c arm/arm64: arch_timer: Use archdata to indicate vdso suitability 2016-09-23 17:19:25 +01:00
vmlinux.lds.S arm64: Introduce uaccess_{disable,enable} functionality based on TTBR0_EL1 2016-11-21 18:48:53 +00:00