linux-stable/arch/powerpc
Aneesh Kumar K.V 8e560921b5 powerpc/book3s64/pkeys: Store/restore userspace AMR/IAMR correctly on entry and exit from kernel
This prepare kernel to operate with a different value than userspace AMR/IAMR.
For this, AMR/IAMR need to be saved and restored on entry and return from the
kernel.

With KUAP we modify kernel AMR when accessing user address from the kernel
via copy_to/from_user interfaces. We don't need to modify IAMR value in
similar fashion.

If MMU_FTR_PKEY is enabled we need to save AMR/IAMR in pt_regs on entering
kernel from userspace. If not we can assume that AMR/IAMR is not modified
from userspace.

We need to save AMR if we have MMU_FTR_BOOK3S_KUAP feature enabled and we are
interrupted within kernel. This is required so that if we get interrupted
within copy_to/from_user we continue with the right AMR value.

If we hae MMU_FTR_BOOK3S_KUEP enabled we need to restore IAMR on
return to userspace beause kernel will be running with a different
IAMR value.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Reviewed-by: Sandipan Das <sandipan@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20201127044424.40686-11-aneesh.kumar@linux.ibm.com
2020-12-04 01:01:25 +11:00
..
boot powerpc/boot: Make use of REL16 relocs in powerpc/boot/util.S 2020-12-04 01:00:44 +11:00
configs powerpc updates for 5.10 2020-10-16 12:21:15 -07:00
crypto crypto: powerpc/crc-vpmsum_test - Fix sparse endianness warning 2020-09-04 17:57:15 +10:00
include powerpc/book3s64/pkeys: Store/restore userspace AMR/IAMR correctly on entry and exit from kernel 2020-12-04 01:01:25 +11:00
kernel powerpc/book3s64/pkeys: Store/restore userspace AMR/IAMR correctly on entry and exit from kernel 2020-12-04 01:01:25 +11:00
kexec arch, drivers: replace for_each_membock() with for_each_mem_range() 2020-10-13 18:38:35 -07:00
kvm KVM: PPC: BOOK3S: PR: Ignore UAMOR SPR 2020-12-04 01:01:24 +11:00
lib powerpc/feature-fixups: use a semicolon rather than a comma 2020-12-04 01:01:20 +11:00
math-emu
mm powerpc/book3s64/kuap: Use Key 3 for kernel mapping with hash translation 2020-12-04 01:01:25 +11:00
net bpf, powerpc: Fix misuse of fallthrough in bpf_jit_comp() 2020-09-29 16:39:11 +02:00
oprofile powerpc/oprofile: fix spelling mistake "contex" -> "context" 2020-08-25 01:31:33 +10:00
perf powerpc/perf: Invoke per-CPU variable access with disabled interrupts 2020-12-04 01:01:21 +11:00
platforms powerpc/book3s64/kuap/kuep: Add PPC_PKEY config on book3s64 2020-12-04 01:01:24 +11:00
purgatory powerpc/kexec_file: Enable early kernel OPAL calls 2020-07-29 23:47:55 +10:00
sysdev powerpc: sysdev: add missing iounmap() on error in mpic_msgr_probe() 2020-11-19 14:50:14 +11:00
tools powerpc/tools: Remove 90 line limit in checkpatch script 2020-09-08 22:57:11 +10:00
xmon powerpc: Allow relative pointers in bug table entries 2020-12-04 01:01:20 +11:00
Kbuild
Kconfig powerpc: Allow relative pointers in bug table entries 2020-12-04 01:01:20 +11:00
Kconfig.debug powerpc: Remove Xilinx PPC405/PPC440 support 2020-05-28 23:24:34 +10:00
Makefile powerpc/vdso: Retrieve sigtramp offsets at buildtime 2020-12-04 01:01:17 +11:00
Makefile.postlink powerpc: unrel_branch_check.sh: use nm to find symbol value 2020-09-02 11:00:22 +10:00