[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201204015358.sk5zl5l73zmcu7t2@ast-mbp>
Date: Thu, 3 Dec 2020 17:53:58 -0800
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Andrii Nakryiko <andrii@...nel.org>
Cc: bpf@...r.kernel.org, netdev@...r.kernel.org, ast@...com,
daniel@...earbox.net, kernel-team@...com
Subject: Re: [PATCH v6 bpf-next 10/14] bpf: allow to specify kernel module
BTFs when attaching BPF programs
On Thu, Dec 03, 2020 at 12:46:30PM -0800, Andrii Nakryiko wrote:
> + if (attr->attach_prog_fd) {
> + dst_prog = bpf_prog_get(attr->attach_prog_fd);
> + if (IS_ERR(dst_prog)) {
> + dst_prog = NULL;
> + attach_btf = btf_get_by_fd(attr->attach_btf_obj_fd);
> + if (IS_ERR(attach_btf))
> + return -EINVAL;
> + if (!btf_is_kernel(attach_btf)) {
> + btf_put(attach_btf);
> + return -EINVAL;
Applied, but please consider follow up with different err code here.
I think we might support this case in the future.
Specifying prog's BTF as a base and attach_btf_id within it might make
user space simpler in some cases. prog's btf covers the whole elf file.
Where prog_fd is a specific prog. That narrow scope isn't really necessary.
So may be return ENOTSUPP here for now? With a hint that this might
work in the future?
Powered by blists - more mailing lists