diff options
author | Mark Rutland <mark.rutland@arm.com> | 2020-11-13 13:49:21 +0100 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2020-12-02 20:44:02 +0100 |
commit | f80d034086d5bfcfd3bf4ab6f52b2df78c3ad2fa (patch) | |
tree | 73dbd05a9baf36f1d204f5be7b989e01c9d26ae1 /arch/arm64/kernel/proton-pack.c | |
parent | arm64: lto: Strengthen READ_ONCE() to acquire when CONFIG_LTO=y (diff) | |
download | linux-f80d034086d5bfcfd3bf4ab6f52b2df78c3ad2fa.tar.xz linux-f80d034086d5bfcfd3bf4ab6f52b2df78c3ad2fa.zip |
arm64: ensure ERET from kthread is illegal
For consistency, all tasks have a pt_regs reserved at the highest
portion of their task stack. Among other things, this ensures that a
task's SP is always pointing within its stack rather than pointing
immediately past the end.
While it is never legitimate to ERET from a kthread, we take pains to
initialize pt_regs for kthreads as if this were legitimate. As this is
never legitimate, the effects of an erroneous return are rarely tested.
Let's simplify things by initializing a kthread's pt_regs such that an
ERET is caught as an illegal exception return, and removing the explicit
initialization of other exception context. Note that as
spectre_v4_enable_task_mitigation() only manipulates the PSTATE within
the unused regs this is safe to remove.
As user tasks will have their exception context initialized via
start_thread() or start_compat_thread(), this should only impact cases
where something has gone very wrong and we'd like that to be clearly
indicated.
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: James Morse <james.morse@arm.com>
Cc: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20201113124937.20574-2-mark.rutland@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/kernel/proton-pack.c')
0 files changed, 0 insertions, 0 deletions