Re: [PATCH bpf-next] libbpf: demote log message about unrecognised data sections back down to debug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 4, 2021 at 5:29 AM Toke Høiland-Jørgensen <toke@xxxxxxxxxx> wrote:
>
> When loading a BPF object, libbpf will output a log message when it
> encounters an unrecognised data section. Since commit
> 50e09460d9f8 ("libbpf: Skip well-known ELF sections when iterating ELF")
> they are printed at "info" level so they will show up on the console by
> default.
>
> The rationale in the commit cited above is to "increase visibility" of such
> errors, but there can be legitimate, and completely harmless, uses of extra
> data sections. In particular, libxdp uses custom data sections to store

What if we make those extra sections to be ".rodata.something" and
".data.something", but without ALLOC flag in ELF, so that libbpf won't
create maps for them. Libbpf also will check that program code never
references anything from those sections.

The worry I have about allowing arbitrary sections is that if in the
future we want to add other special sections, then we might run into a
conflict with some applications. So having some enforced naming
convention would help prevent this. WDYT?

> metadata and run priority configuration of XDP programs, which triggers the
> log message. Ciara noticed that when porting XSK code to use libxdp instead
> of libbpf as part of the deprecation, libbpf would output messages like:
>
> libbpf: elf: skipping unrecognized data section(7) .xdp_run_config
> libbpf: elf: skipping unrecognized data section(8) xdp_metadata
> libbpf: elf: skipping unrecognized data section(8) xdp_metadata
> libbpf: elf: skipping unrecognized data section(8) xdp_metadata
>
> In light of this, let's demote the message severity back down to debug so
> that it won't clutter up the default output of applications.
>
> Cc: Magnus Karlsson <magnus.karlsson@xxxxxxxxx>
> Reported-by: Ciara Loftus <ciara.loftus@xxxxxxxxx>
> Signed-off-by: Toke Høiland-Jørgensen <toke@xxxxxxxxxx>
> ---
>  tools/lib/bpf/libbpf.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index a1bea1953df6..ac0eadbe1475 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -3297,8 +3297,8 @@ static int bpf_object__elf_collect(struct bpf_object *obj)
>                                 obj->efile.st_ops_data = data;
>                                 obj->efile.st_ops_shndx = idx;
>                         } else {
> -                               pr_info("elf: skipping unrecognized data section(%d) %s\n",
> -                                       idx, name);
> +                               pr_debug("elf: skipping unrecognized data section(%d) %s\n",
> +                                        idx, name);
>                         }
>                 } else if (sh->sh_type == SHT_REL) {
>                         int targ_sec_idx = sh->sh_info; /* points to other section */
> --
> 2.33.0
>




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux