powerpc/dexcr: Support userspace ROP protection
authorBenjamin Gray <bgray@linux.ibm.com>
Mon, 19 Jun 2023 07:36:26 +0000 (17:36 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 19 Jun 2023 07:36:26 +0000 (17:36 +1000)
commitbe98fcf7c10dea74e9c3e2cd0018e47bdee67442
tree2536fca1dfd218dd60b68e8eb7b222e82e849f79
parent5bcba4e6c13f0c889da1f9e67ee10accd9ca4c19
powerpc/dexcr: Support userspace ROP protection

The ISA 3.1B hashst and hashchk instructions use a per-cpu SPR HASHKEYR
to hold a key used in the hash calculation. This key should be different
for each process to make it harder for a malicious process to recreate
valid hash values for a victim process.

Add support for storing a per-thread hash key, and setting/clearing
HASHKEYR appropriately.

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-6-bgray@linux.ibm.com
arch/powerpc/include/asm/processor.h
arch/powerpc/kernel/process.c