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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 25, 2021 at 1:54 PM Andrii Nakryiko
<andrii.nakryiko@xxxxxxxxx> wrote:
>
> On Thu, Feb 25, 2021 at 1:35 AM Yonghong Song <yhs@xxxxxx> wrote:
> >
> > 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 <yhs@xxxxxx>
> > ---
> >  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/.




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux