To allow probing if constant blinding will be applied, support calling bpf_jit_blinding_enabled() with a NULL program. This allows to tailor the creation of a BPF program accordingly. Signed-off-by: Mathias Krause <minipli@xxxxxxxxxxxxxx> --- include/linux/filter.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/linux/filter.h b/include/linux/filter.h index 7d7578a8eac1..a1b4a9739f81 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h @@ -1297,11 +1297,12 @@ static inline bool bpf_jit_blinding_enabled(struct bpf_prog *prog) */ if (!bpf_jit_is_ebpf()) return false; - if (!prog->jit_requested) + if (prog && !prog->jit_requested) return false; if (!bpf_jit_harden) return false; - if (bpf_jit_harden == 1 && bpf_token_capable(prog->aux->token, CAP_BPF)) + if (bpf_jit_harden == 1 && + bpf_token_capable(prog ? prog->aux->token : NULL, CAP_BPF)) return false; return true; -- 2.30.2