Thread (32 messages) 32 messages, 4 authors, 2021-02-26

Re: [PATCH bpf-next v3 01/11] bpf: factor out visit_func_call_insn() in check_cfg()

From: Alexei Starovoitov <hidden>
Date: 2021-02-25 22:02:53

On Thu, Feb 25, 2021 at 1:54 PM Andrii Nakryiko
[off-list ref] wrote:
On Thu, Feb 25, 2021 at 1:35 AM Yonghong Song [off-list ref] wrote:
quoted
During verifier check_cfg(), all instructions are
visited to ensure verifier can handle program control flows.
This patch factored out function visit_func_call_insn()
so it can be reused in later patch to visit callback function
calls. There is no functionality change for this patch.

Signed-off-by: Yonghong Song <redacted>
---
 kernel/bpf/verifier.c | 35 +++++++++++++++++++++++------------
 1 file changed, 23 insertions(+), 12 deletions(-)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 1dda9d81f12c..9cb182e91162 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -8592,6 +8592,27 @@ static int push_insn(int t, int w, int e, struct bpf_verifier_env *env,
        return DONE_EXPLORING;
 }

+static int visit_func_call_insn(int t, int insn_cnt,
+                               struct bpf_insn *insns,
both insns and insn_cnt seem to be derivatives of env
(env->prog->insnsi and env->prog->len), so it shouldn't be necessary
to pass them in.
Not really. 'env' is there only for logging.
When we do a cleanup later we can replace it with log.
So pls keep insns and len.
It's not the only place that will benefit from s/env/log/.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help