]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: Rework valid_user_regs
authorMark Rutland <mark.rutland@arm.com>
Tue, 1 Mar 2016 14:18:50 +0000 (14:18 +0000)
committerCatalin Marinas <catalin.marinas@arm.com>
Wed, 2 Mar 2016 15:49:28 +0000 (15:49 +0000)
commitd85db3413ca87ae4181554e25d4430403dc6d4bf
tree35b33dd22bd899a75ad8be3f69e8165084a0d18f
parent0106c0362ae238add91a77f138aaa35d4753bbd9
arm64: Rework valid_user_regs

We validate pstate using PSR_MODE32_BIT, which is part of the
user-provided pstate (and cannot be trusted). Also, we conflate
validation of AArch32 and AArch64 pstate values, making the code
difficult to reason about.

Instead, validate the pstate value based on the associated task. The
task may or may not be current (e.g. when using ptrace), so this must be
passed explicitly by callers. To avoid circular header dependencies via
sched.h, is_compat_task is pulled out of asm/ptrace.h.

To make the code possible to reason about, the AArch64 and AArch32
validation is split into separate functions. Software must respect the
RES0 policy for SPSR bits, and thus the kernel mirrors the hardware
policy (RAZ/WI) for bits as-yet unallocated. When these acquire an
architected meaning writes may be permitted (potentially with additional
validation).

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Cc: Dave Martin <dave.martin@arm.com>
Cc: James Morse <james.morse@arm.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/include/asm/ptrace.h
arch/arm64/kernel/ptrace.c
arch/arm64/kernel/signal.c
arch/arm64/kernel/signal32.c