summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorJoey Gouly <joey.gouly@arm.com>2024-10-01 16:36:17 +0300
committerWill Deacon <will@kernel.org>2024-10-14 19:22:47 +0300
commite3e85271330b18f487ab3032ea9ca0601efeafaf (patch)
tree0ff5a0449c5c9b99ed840aba998c4d999f519003 /arch
parent13f8f1e05f1dc36dbba6cba0ae03354c0dafcde7 (diff)
downloadlinux-e3e85271330b18f487ab3032ea9ca0601efeafaf.tar.xz
arm64: set POR_EL0 for kernel threads
Restrict kernel threads to only have RWX overlays for pkey 0. This matches what arch/x86 does, by defaulting to a restrictive PKRU. Signed-off-by: Joey Gouly <joey.gouly@arm.com> Cc: Will Deacon <will@kernel.org> Cc: Catalin Marinas <catalin.marinas@arm.com> Reviewed-by: Kevin Brodsky <Kevin.Brodsky@arm.com> Link: https://lore.kernel.org/r/20241001133618.1547996-2-joey.gouly@arm.com Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm64/kernel/process.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index 0540653fbf38..3e7c8c8195c3 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -412,6 +412,9 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
p->thread.cpu_context.x19 = (unsigned long)args->fn;
p->thread.cpu_context.x20 = (unsigned long)args->fn_arg;
+
+ if (system_supports_poe())
+ p->thread.por_el0 = POR_EL0_INIT;
}
p->thread.cpu_context.pc = (unsigned long)ret_from_fork;
p->thread.cpu_context.sp = (unsigned long)childregs;