powerpc/bpf: Emit stf barrier instruction sequences for BPF_NOSPEC
authorNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Mon, 15 Nov 2021 11:06:04 +0000 (16:36 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Nov 2021 08:48:49 +0000 (09:48 +0100)
commitc6f9a5c11a91d5a5539e9b37eb859d66b620ecc1
treebc5286bd1a894437dd83120c79537786ab74e1b6
parent453b779d2b8fe523eba4b44d3c67c9946ce6664b
powerpc/bpf: Emit stf barrier instruction sequences for BPF_NOSPEC

upstream commit b7540d62509453263604a155bf2d5f0ed450cba2

Emit similar instruction sequences to commit a048a07d7f4535
("powerpc/64s: Add support for a store forwarding barrier at kernel
entry/exit") when encountering BPF_NOSPEC.

Mitigations are enabled depending on what the firmware advertises. In
particular, we do not gate these mitigations based on current settings,
just like in x86. Due to this, we don't need to take any action if
mitigations are enabled or disabled at runtime.

Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/956570cbc191cd41f8274bed48ee757a86dac62a.1633464148.git.naveen.n.rao@linux.vnet.ibm.com
[adjust macros to account for commits 0654186510a40e3a181237916310 and ef909ba954145e.
adjust security feature checks to account for commit 84ed26fd00c514]
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/net/bpf_jit64.h
arch/powerpc/net/bpf_jit_comp64.c