ebpf: move read-only fields to bpf_prog and shrink bpf_prog_aux
is_gpl_compatible and prog_type should be moved directly into bpf_prog as they stay immutable during bpf_prog's lifetime, are core attributes and they can be locked as read-only later on via bpf_prog_select_runtime(). With a bit of rearranging, this also allows us to shrink bpf_prog_aux to exactly 1 cacheline. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Alexei Starovoitov <ast@plumgrid.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
96be4325f4
commit
24701ecea7
@@ -852,7 +852,7 @@ static int check_call(struct verifier_env *env, int func_id)
|
||||
}
|
||||
|
||||
/* eBPF programs must be GPL compatible to use GPL-ed functions */
|
||||
if (!env->prog->aux->is_gpl_compatible && fn->gpl_only) {
|
||||
if (!env->prog->gpl_compatible && fn->gpl_only) {
|
||||
verbose("cannot call GPL only function from proprietary program\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -1205,7 +1205,7 @@ static int check_ld_abs(struct verifier_env *env, struct bpf_insn *insn)
|
||||
struct reg_state *reg;
|
||||
int i, err;
|
||||
|
||||
if (!may_access_skb(env->prog->aux->prog_type)) {
|
||||
if (!may_access_skb(env->prog->type)) {
|
||||
verbose("BPF_LD_ABS|IND instructions not allowed for this program type\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user