lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200923044559.ag7ifrqwhd6o27xr@kafai-mbp.dhcp.thefacebook.com>
Date:   Tue, 22 Sep 2020 21:45:59 -0700
From:   Martin KaFai Lau <kafai@...com>
To:     Lorenz Bauer <lmb@...udflare.com>
CC:     bpf <bpf@...r.kernel.org>, Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Kernel Team <kernel-team@...com>,
        Networking <netdev@...r.kernel.org>
Subject: Re: [PATCH v3 bpf-next 01/11] bpf: Move the PTR_TO_BTF_ID check to
 check_reg_type()

On Tue, Sep 22, 2020 at 10:56:55AM +0100, Lorenz Bauer wrote:
> On Tue, 22 Sep 2020 at 08:04, Martin KaFai Lau <kafai@...com> wrote:
> >
> > check_reg_type() checks whether a reg can be used as an arg of a
> > func_proto.  For PTR_TO_BTF_ID, the check is actually not
> > completely done until the reg->btf_id is pointing to a
> > kernel struct that is acceptable by the func_proto.
> >
> > Thus, this patch moves the btf_id check into check_reg_type().
> > The compatible_reg_types[] usage is localized in check_reg_type() now.
> >
> > The "if (!btf_id) verbose(...); " is also removed since it won't happen.
> >
> > Signed-off-by: Martin KaFai Lau <kafai@...com>
> > ---
> >  kernel/bpf/verifier.c | 65 +++++++++++++++++++++++--------------------
> >  1 file changed, 35 insertions(+), 30 deletions(-)
> >
> > diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> > index 15ab889b0a3f..3ce61c412ea0 100644
> > --- a/kernel/bpf/verifier.c
> > +++ b/kernel/bpf/verifier.c
> > @@ -4028,20 +4028,29 @@ static const struct bpf_reg_types *compatible_reg_types[] = {
> >         [__BPF_ARG_TYPE_MAX]            = NULL,
> >  };
> >
> > -static int check_reg_type(struct bpf_verifier_env *env, u32 regno,
> > -                         const struct bpf_reg_types *compatible)
> > +static int check_reg_type(struct bpf_verifier_env *env, u32 arg,
> > +                         enum bpf_arg_type arg_type,
> > +                         const struct bpf_func_proto *fn)
> 
> How about (env, regno, arg_type, expected_btf_id) instead? Otherwise
Last reply cut off in the wrong line.  I will make this change in v4.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ