arm64: bpf: Add BHB mitigation to the epilogue for cBPF programs

commit 0dfefc2ea2 upstream.

A malicious BPF program may manipulate the branch history to influence
what the hardware speculates will happen next.

On exit from a BPF program, emit the BHB mititgation sequence.

This is only applied for 'classic' cBPF programs that are loaded by
seccomp.

Signed-off-by: James Morse <james.morse@arm.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
James Morse 2021-12-09 15:13:24 +00:00 • committed by Greg Kroah-Hartman
commit 38c345fd54
3 changed files with 52 additions and 5 deletions