linux-stable/arch/powerpc/lib
Nicholas Piggin 00ff1eaac1 powerpc: Fix reschedule bug in KUAP-unlocked user copy
schedule must not be explicitly called while KUAP is unlocked, because
the AMR register will not be saved across the context switch on
64s (preemption is allowed because that is driven by interrupts which do
save the AMR).

exit_vmx_usercopy() runs inside an unlocked user access region, and it
calls preempt_enable() which will call schedule() if need_resched() was
set while non-preemptible. This can cause tasks to run unprotected when
the should not, and can cause the user copy to be improperly blocked
when scheduling back to it.

Fix this by avoiding the explicit resched for preempt kernels by
generating an interrupt to reschedule the context if need_resched() got
set.

Reported-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20221013151647.1857994-3-npiggin@gmail.com
2022-10-18 22:46:19 +11:00
..
alloc.c
checksum_32.S powerpc/32: Remove remaining .stabs annotations 2022-02-07 21:03:10 +11:00
checksum_64.S ppc: propagate the calling conventions change down to csum_partial_copy_generic() 2020-08-20 15:45:22 -04:00
checksum_wrappers.c net: unexport csum_and_copy_{from,to}_user 2022-04-29 14:37:59 -07:00
code-patching.c powerpc/code-patching: Speed up page mapping/unmapping 2022-09-01 13:56:01 +10:00
copy_32.S powerpc/32: Remove remaining .stabs annotations 2022-02-07 21:03:10 +11:00
copy_mc_64.S x86, powerpc: Rename memcpy_mcsafe() to copy_mc_to_{user, kernel}() 2020-10-06 11:18:04 +02:00
copypage_64.S powerpc/64: asm use consistent global variable declaration and access 2022-09-28 19:22:12 +10:00
copypage_power7.S
copyuser_64.S
copyuser_power7.S
crtsavres.S
div64.S
error-inject.c powerpc/64s: avoid reloading (H)SRR registers if they are still valid 2021-06-25 00:06:55 +10:00
feature-fixups-test.S
feature-fixups.c powerpc: Remove CONFIG_PPC_FSL_BOOK3E 2022-09-26 23:00:13 +10:00
hweight_64.S
ldstfp.S
locks.c
Makefile powerpc/kasan: Don't instrument non-maskable or raw interrupts 2022-05-22 15:58:29 +10:00
mem_64.S
memcmp_32.S
memcmp_64.S
memcpy_64.S
memcpy_power7.S
pmem.c powerpc/pmem: Include pmem prototypes 2021-01-30 11:39:28 +11:00
quad.S
restart_table.c powerpc/64s: add a table of implicit soft-masked addresses 2021-06-30 22:21:20 +10:00
rheap.c
sstep.c powerpc/64: remove system call instruction emulation 2022-05-06 00:00:20 +10:00
string.S
string_32.S
string_64.S powerpc/64: asm use consistent global variable declaration and access 2022-09-28 19:22:12 +10:00
strlen_32.S
test-code-patching.c powerpc/code-patching: Replace patch_instruction() by ppc_inst_write() in selftests 2021-12-23 22:36:58 +11:00
test_emulate_step.c powerpc/ppc-opcode: Define and use PPC_RAW_SETB() 2022-07-27 21:36:05 +10:00
test_emulate_step_exec_instr.S powerpc: flexible GPR range save/restore macros 2021-11-29 23:15:20 +11:00
vmx-helper.c powerpc: Fix reschedule bug in KUAP-unlocked user copy 2022-10-18 22:46:19 +11:00
xor_vmx.c lib/xor: make xor prototypes more friendly to compiler vectorization 2022-02-11 20:39:39 +11:00
xor_vmx.h lib/xor: make xor prototypes more friendly to compiler vectorization 2022-02-11 20:39:39 +11:00
xor_vmx_glue.c lib/xor: make xor prototypes more friendly to compiler vectorization 2022-02-11 20:39:39 +11:00