Skip to content

Commit e3e8527

Browse files
jgoulywilldeacon
authored andcommitted
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>
1 parent 13f8f1e commit e3e8527

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arch/arm64/kernel/process.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,9 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
412412

413413
p->thread.cpu_context.x19 = (unsigned long)args->fn;
414414
p->thread.cpu_context.x20 = (unsigned long)args->fn_arg;
415+
416+
if (system_supports_poe())
417+
p->thread.por_el0 = POR_EL0_INIT;
415418
}
416419
p->thread.cpu_context.pc = (unsigned long)ret_from_fork;
417420
p->thread.cpu_context.sp = (unsigned long)childregs;

0 commit comments

Comments
 (0)