diff options
author | Quentin Monnet <quentin.monnet@netronome.com> | 2018-10-07 07:56:58 -0400 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2018-10-08 04:24:13 -0400 |
commit | e4052d06a5195b29271a7af262711d69f9ecfd04 (patch) | |
tree | 805eb07081b6db781ecd45da99bec51e242d512a | |
parent | 7ff0ccde43664e3de9fe60edc19466f16cda6b7a (diff) |
bpf: allow offload of programs with BPF-to-BPF function calls
Now that there is at least one driver supporting BPF-to-BPF function
calls, lift the restriction, in the verifier, on hardware offload of
eBPF programs containing such calls. But prevent jit_subprogs(), still
in the verifier, from being run for offloaded programs.
Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com>
Reviewed-by: Jiong Wang <jiong.wang@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
-rw-r--r-- | kernel/bpf/verifier.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index a0454cb299ba..73cc136915fe 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c | |||
@@ -1009,10 +1009,6 @@ static int check_subprogs(struct bpf_verifier_env *env) | |||
1009 | verbose(env, "function calls to other bpf functions are allowed for root only\n"); | 1009 | verbose(env, "function calls to other bpf functions are allowed for root only\n"); |
1010 | return -EPERM; | 1010 | return -EPERM; |
1011 | } | 1011 | } |
1012 | if (bpf_prog_is_dev_bound(env->prog->aux)) { | ||
1013 | verbose(env, "function calls in offloaded programs are not supported yet\n"); | ||
1014 | return -EINVAL; | ||
1015 | } | ||
1016 | ret = add_subprog(env, i + insn[i].imm + 1); | 1012 | ret = add_subprog(env, i + insn[i].imm + 1); |
1017 | if (ret < 0) | 1013 | if (ret < 0) |
1018 | return ret; | 1014 | return ret; |
@@ -5968,10 +5964,10 @@ static int fixup_call_args(struct bpf_verifier_env *env) | |||
5968 | struct bpf_insn *insn = prog->insnsi; | 5964 | struct bpf_insn *insn = prog->insnsi; |
5969 | int i, depth; | 5965 | int i, depth; |
5970 | #endif | 5966 | #endif |
5971 | int err; | 5967 | int err = 0; |
5972 | 5968 | ||
5973 | err = 0; | 5969 | if (env->prog->jit_requested && |
5974 | if (env->prog->jit_requested) { | 5970 | !bpf_prog_is_dev_bound(env->prog->aux)) { |
5975 | err = jit_subprogs(env); | 5971 | err = jit_subprogs(env); |
5976 | if (err == 0) | 5972 | if (err == 0) |
5977 | return 0; | 5973 | return 0; |