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]
Date:   Thu, 18 Mar 2021 19:53:35 -0700
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Martin KaFai Lau <kafai@...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 bpf-next 08/15] libbpf: Refactor bpf_object__resolve_ksyms_btf_id

On Tue, Mar 16, 2021 at 12:02 AM Martin KaFai Lau <kafai@...com> wrote:
>
> This patch refactors most of the logic from
> bpf_object__resolve_ksyms_btf_id() into a new function
> bpf_object__resolve_ksym_var_btf_id().
> It is to get ready for a later patch adding
> bpf_object__resolve_ksym_func_btf_id() which resolves
> a kernel function to the running kernel btf_id.
>
> Signed-off-by: Martin KaFai Lau <kafai@...com>
> ---

Acked-by: Andrii Nakryiko <andrii@...nel.org>

>  tools/lib/bpf/libbpf.c | 125 ++++++++++++++++++++++-------------------
>  1 file changed, 68 insertions(+), 57 deletions(-)
>

[...]

> +static int bpf_object__resolve_ksyms_btf_id(struct bpf_object *obj)
> +{
> +       struct extern_desc *ext;
> +       int i, err;
> +
> +       for (i = 0; i < obj->nr_extern; i++) {
> +               ext = &obj->externs[i];
> +               if (ext->type != EXT_KSYM || !ext->ksym.type_id)
> +                       continue;
> +
> +               err = bpf_object__resolve_ksym_var_btf_id(obj, ext);
>

we usually put error checking right on the next line without empty
lines, please remove this distracting empty line


> -               ext->is_set = true;
> -               ext->ksym.kernel_btf_obj_fd = btf_fd;
> -               ext->ksym.kernel_btf_id = id;
> -               pr_debug("extern (ksym) '%s': resolved to [%d] %s %s\n",
> -                        ext->name, id, btf_kind_str(targ_var), targ_var_name);
> +               if (err)
> +                       return err;
>         }
>         return 0;
>  }
> --
> 2.30.2
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ