linux/arch/powerpc/kernel/ptrace
Benjamin Gray 97228ca375 powerpc/ptrace: Expose HASHKEYR register to ptrace
The HASHKEYR register contains a secret per-process key to enable unique
hashes per process. In general it should not be exposed to userspace
at all and a regular process has no need to know its key.

However, checkpoint restore in userspace (CRIU) functionality requires
that a process be able to set the HASHKEYR of another process, otherwise
existing hashes on the stack would be invalidated by a new random key.

Exposing HASHKEYR in this way also makes it appear in core dumps, which
is a security concern. Multiple threads may share a key, for example
just after a fork() call, where the kernel cannot know if the child is
going to return back along the parent's stack. If such a thread is
coerced into making a core dump, then the HASHKEYR value will be
readable and able to be used against all other threads sharing that key,
effectively undoing any protection offered by hashst/hashchk.

Therefore we expose HASHKEYR to ptrace when CONFIG_CHECKPOINT_RESTORE is
enabled, providing a choice of increased security or migratable ROP
protected processes. This is similar to how ARM exposes its PAC keys.

Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>
Reviewed-by: Russell Currey <ruscur@russell.cc>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230616034846.311705-8-bgray@linux.ibm.com
2023-06-19 17:36:27 +10:00
..
Makefile powerpc/ptrace: Don't return error when getting/setting FP regs without CONFIG_PPC_FPU_REGS 2021-04-02 00:15:37 +11:00
ptrace32.c powerpc: remove partial register save logic 2021-04-14 23:04:44 +10:00
ptrace-adv.c powerpc/64s: avoid reloading (H)SRR registers if they are still valid 2021-06-25 00:06:55 +10:00
ptrace-altivec.c powerpc: switch to ->regset_get() 2020-07-27 14:31:07 -04:00
ptrace-decl.h powerpc/ptrace: Expose HASHKEYR register to ptrace 2023-06-19 17:36:27 +10:00
ptrace-fpu.c powerpc/32: Fix overread/overwrite of thread_struct via ptrace 2022-06-09 23:32:56 +10:00
ptrace-noadv.c powerpc/64s: avoid reloading (H)SRR registers if they are still valid 2021-06-25 00:06:55 +10:00
ptrace-novsx.c powerpc/ptrace: Don't return error when getting/setting FP regs without CONFIG_PPC_FPU_REGS 2021-04-02 00:15:37 +11:00
ptrace-spe.c powerpc: switch to ->regset_get() 2020-07-27 14:31:07 -04:00
ptrace-tm.c powerpc: ptrace: user_regset_copyin_ignore() always returns 0 2022-11-15 14:30:40 -08:00
ptrace-view.c powerpc/ptrace: Expose HASHKEYR register to ptrace 2023-06-19 17:36:27 +10:00
ptrace-vsx.c powerpc: Fix all occurences of duplicate words 2022-07-25 12:05:15 +10:00
ptrace.c powerpc/32: Fix overread/overwrite of thread_struct via ptrace 2022-06-09 23:32:56 +10:00