Skip to content

Commit 6e52d04

Browse files
James Morsegregkh
authored andcommitted
arm64: bpf: Only mitigate cBPF programs loaded by unprivileged users
commit f300769ead032513a68e4a02e806393402e626f8 upstream. Support for eBPF programs loaded by unprivileged users is typically disabled. This means only cBPF programs need to be mitigated for BHB. In addition, only mitigate cBPF programs that were loaded by an unprivileged user. Privileged users can also load the same program via eBPF, making the mitigation pointless. Signed-off-by: James Morse <[email protected]> Reviewed-by: Catalin Marinas <[email protected]> Acked-by: Daniel Borkmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 8fe5c37 commit 6e52d04

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arch/arm64/net/bpf_jit_comp.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,9 @@ static void __maybe_unused build_bhb_mitigation(struct jit_ctx *ctx)
666666
arm64_get_spectre_v2_state() == SPECTRE_VULNERABLE)
667667
return;
668668

669+
if (capable(CAP_SYS_ADMIN))
670+
return;
671+
669672
if (supports_clearbhb(SCOPE_SYSTEM)) {
670673
emit(aarch64_insn_gen_hint(AARCH64_INSN_HINT_CLEARBHB), ctx);
671674
return;

0 commit comments

Comments
 (0)