From: sashiko-bot@kernel.org
To: Tw <tw19881113@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH] libbpf: Ignore exception frame section
Date: Sun, 23 Aug 2026 09:30:21 +0000 [thread overview]
Message-ID: <20260823093021.EBF861F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260823092057.82200-1-tw19881113@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Incomplete handling of exception frame sections by using exact string matching instead of prefix matching.
--
--- Patch [1]: [PATCH] libbpf: Ignore exception frame section ---
commit 7e5607d9374ac0c905a5c8970316c258ed4eb5cf
Author: Tw <tw19881113@gmail.com>
libbpf: Ignore exception frame section
This commit updates the ELF section filtering logic to ignore ".eh_frame"
sections during BPF object linking and loading. This resolves issues when
building BPF programs with compilers that emit exception handling frames,
as they are not needed by the kernel.
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index b749c01742ee0..05727c418c402 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -3867,7 +3867,8 @@ static Elf64_Rel *elf_rel_by_idx(Elf_Data *data, size_t idx)
> static bool is_sec_name_dwarf(const char *name)
> {
> /* approximation, but the actual list is too long */
> - return str_has_pfx(name, ".debug_");
> + return str_has_pfx(name, ".debug_") ||
> + strcmp(name, ".eh_frame") == 0;
[Severity: Medium]
Does this exact string match correctly handle variants like ".eh_frame_hdr"
or function-split ".eh_frame.*" sections?
If a compiler emits these variant sections, they would bypass this filter and
could potentially cause build-time link failures against STT_SECTION. Would
it be more robust to use a prefix match like str_has_pfx() here, similar to
how ".debug_" is handled?
> }
>
> static bool ignore_elf_section(Elf64_Shdr *hdr, const char *name)
[ ... ]
> diff --git a/tools/lib/bpf/linker.c b/tools/lib/bpf/linker.c
> index 78f92c39290af..1fb0efdbfae7f 100644
> --- a/tools/lib/bpf/linker.c
> +++ b/tools/lib/bpf/linker.c
> @@ -599,7 +599,8 @@ int bpf_linker__add_buf(struct bpf_linker *linker, void *buf, size_t buf_sz,
> static bool is_dwarf_sec_name(const char *name)
> {
> /* approximation, but the actual list is too long */
> - return strncmp(name, ".debug_", sizeof(".debug_") - 1) == 0;
> + return strncmp(name, ".debug_", sizeof(".debug_") - 1) == 0 ||
> + strcmp(name, ".eh_frame") == 0;
[Severity: Medium]
Similarly, would it be beneficial to use a prefix match (e.g. strncmp) here
to ensure we also ignore related exception frame sections?
> }
>
> static bool is_ignored_sec(struct src_sec *sec)
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260823092057.82200-1-tw19881113@gmail.com?part=1
next prev parent reply other threads:[~2026-08-23 9:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-23 9:20 [PATCH] libbpf: Ignore exception frame section Tw
2026-08-23 9:30 ` sashiko-bot [this message]
2026-08-23 10:00 ` bot+bpf-ci
2026-08-23 18:54 ` Kumar Kartikeya Dwivedi
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=20260823093021.EBF861F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tw19881113@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.