From: Hengqi Chen <hengqi.chen@gmail.com>
To: Yonghong Song <yhs@fb.com>, bpf@vger.kernel.org
Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
john.fastabend@gmail.com, jolsa@kernel.org, yanivagman@gmail.com
Subject: Re: [PATCH bpf-next 1/2] tools/resolve_btfids: emit warnings and patch zero id for missing symbols
Date: Mon, 26 Jul 2021 12:41:42 +0800 [thread overview]
Message-ID: <95d1c440-bb99-13ad-0227-f9ab20a001f2@gmail.com> (raw)
In-Reply-To: <dde36573-f6b9-8570-0878-e313e771345a@fb.com>
On 2021/7/26 11:32 AM, Yonghong Song wrote:
>
>
> On 7/25/21 7:18 AM, Hengqi Chen wrote:
>> Kernel functions referenced by .BTF_ids may changed from global to static
>> and get inlined and thus disappears from BTF. This causes kernel build
>
> the function could be renamed or removed too.
>
>> failure when resolve_btfids do id patch for symbols in .BTF_ids in vmlinux.
>> Update resolve_btfids to emit warning messages and patch zero id for missing
>> symbols instead of aborting kernel build process.
>>
>> Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com>
>
> LGTM with one minor comment below.
>
> Acked-by: Yonghong Song <yhs@fb.com>
>
>> ---
>> tools/bpf/resolve_btfids/main.c | 13 +++++++------
>> 1 file changed, 7 insertions(+), 6 deletions(-)
>>
>> diff --git a/tools/bpf/resolve_btfids/main.c b/tools/bpf/resolve_btfids/main.c
>> index 3ad9301b0f00..3ea19e33250d 100644
>> --- a/tools/bpf/resolve_btfids/main.c
>> +++ b/tools/bpf/resolve_btfids/main.c
>> @@ -291,7 +291,7 @@ static int compressed_section_fix(Elf *elf, Elf_Scn *scn, GElf_Shdr *sh)
>> sh->sh_addralign = expected;
>>
>> if (gelf_update_shdr(scn, sh) == 0) {
>> - printf("FAILED cannot update section header: %s\n",
>> + pr_err("FAILED cannot update section header: %s\n",
>> elf_errmsg(-1));
>> return -1;
>> }
>> @@ -317,6 +317,7 @@ static int elf_collect(struct object *obj)
>>
>> elf = elf_begin(fd, ELF_C_RDWR_MMAP, NULL);
>> if (!elf) {
>> + close(fd);
>> pr_err("FAILED cannot create ELF descriptor: %s\n",
>> elf_errmsg(-1));
>> return -1;
>> @@ -484,7 +485,7 @@ static int symbols_resolve(struct object *obj)
>> err = libbpf_get_error(btf);
>> if (err) {
>> pr_err("FAILED: load BTF from %s: %s\n",
>> - obj->path, strerror(-err));
>> + obj->btf ?: obj->path, strerror(-err));
>
> Why you change "obj->path" to "obj->btf ?: obj->path"?
> Note that obj->path cannot be NULL.
The diff didn't see the whole picture. Let me quote it here:
```
btf = btf__parse(obj->btf ?: obj->path, NULL);
err = libbpf_get_error(btf);
if (err) {
pr_err("FAILED: load BTF from %s: %s\n",
obj->path, strerror(-err));
return -1;
}
```
Because btf__parse parses either obj->btf or obj->path,
I think the error message should reveal this.
>
>> return -1;
>> }
>>
> [...]
next prev parent reply other threads:[~2021-07-26 4:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-25 14:18 [PATCH bpf-next 0/2] expand bpf_d_path helper allowlist Hengqi Chen
2021-07-25 14:18 ` [PATCH bpf-next 1/2] tools/resolve_btfids: emit warnings and patch zero id for missing symbols Hengqi Chen
2021-07-26 3:32 ` Yonghong Song
2021-07-26 4:41 ` Hengqi Chen [this message]
2021-07-26 4:56 ` Yonghong Song
2021-07-26 5:22 ` Hengqi Chen
2021-07-26 5:33 ` Yonghong Song
2021-07-26 20:16 ` Andrii Nakryiko
2021-07-27 2:59 ` Hengqi Chen
2021-07-25 14:18 ` [PATCH bpf-next 2/2] bpf: expose bpf_d_path helper to vfs_* and security_* functions Hengqi Chen
2021-07-26 6:20 ` Yonghong Song
2021-07-26 7:16 ` Hengqi Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=95d1c440-bb99-13ad-0227-f9ab20a001f2@gmail.com \
--to=hengqi.chen@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=yanivagman@gmail.com \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.