--- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -11570,6 +11570,11 @@ static int check_struct_ops_btf_id(struc u32 btf_id, member_idx; const char *mname; + if (!prog->gpl_compatible) { + verbose(env, "struct ops programs must have a GPL compatible license\n"); + return -EINVAL; + } + btf_id = prog->aux->attach_btf_id; st_ops = bpf_struct_ops_find(btf_id); if (!st_ops) {