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:   Fri, 8 Nov 2019 18:57:41 +0000
From:   Song Liu <songliubraving@...com>
To:     Alexei Starovoitov <ast@...nel.org>
CC:     David Miller <davem@...emloft.net>,
        "daniel@...earbox.net" <daniel@...earbox.net>,
        "x86@...nel.org" <x86@...nel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "bpf@...r.kernel.org" <bpf@...r.kernel.org>,
        Kernel Team <Kernel-team@...com>
Subject: Re: [PATCH v3 bpf-next 16/18] libbpf: Add support for attaching BPF
 programs to other BPF programs



> On Nov 7, 2019, at 10:40 PM, Alexei Starovoitov <ast@...nel.org> wrote:
> 
> Extend libbpf api to pass attach_prog_fd into bpf_object__open.
> 
> Signed-off-by: Alexei Starovoitov <ast@...nel.org>
> ---

[...]

> +static int libbpf_find_prog_btf_id(const char *name, __u32 attach_prog_fd)
> +{
> +	struct bpf_prog_info_linear *info_linear;
> +	struct bpf_prog_info *info;
> +	struct btf *btf = NULL;
> +	int err = -EINVAL;
> +
> +	info_linear = bpf_program__get_prog_info_linear(attach_prog_fd, 0);
> +	if (IS_ERR_OR_NULL(info_linear)) {
> +		pr_warn("failed get_prog_info_linear for FD %d\n",
> +			attach_prog_fd);
> +		return -EINVAL;
> +	}
> +	info = &info_linear->info;
> +	if (!info->btf_id) {
> +		pr_warn("The target program doesn't have BTF\n");
> +		goto out;
> +	}
> +	if (btf__get_from_id(info->btf_id, &btf)) {
> +		pr_warn("Failed to get BTF of the program\n");
> +		goto out;
> +	}
> +	err = btf__find_by_name_kind(btf, name, BTF_KIND_FUNC);
> +	btf__free(btf);
> +	if (err <= 0) {
> +		pr_warn("%s is not found in prog's BTF\n", name);
> +		goto out;
		^^^ This goto doesn't really do much. 
> +	}
> +out:
> +	free(info_linear);
> +	return err;
> +}

Otherwise

Acked-by: Song Liu <songliubraving@...com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ