All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yonghong Song <yhs@fb.com>
To: Hengqi Chen <hengqi.chen@gmail.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: Sun, 25 Jul 2021 20:32:44 -0700	[thread overview]
Message-ID: <dde36573-f6b9-8570-0878-e313e771345a@fb.com> (raw)
In-Reply-To: <20210725141814.2000828-2-hengqi.chen@gmail.com>



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.

>   		return -1;
>   	}
> 
[...]

  reply	other threads:[~2021-07-26  3:33 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 [this message]
2021-07-26  4:41     ` Hengqi Chen
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=dde36573-f6b9-8570-0878-e313e771345a@fb.com \
    --to=yhs@fb.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=hengqi.chen@gmail.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=yanivagman@gmail.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.