All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libbpf: Ignore exception frame section
@ 2026-08-23  9:20 Tw
  2026-08-23  9:30 ` sashiko-bot
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tw @ 2026-08-23  9:20 UTC (permalink / raw)
  To: bpf; +Cc: Tw

Exception handing should not be the interest yet, let's skip it.
BTW, I found this when building BPF with Zig compiler[1].

[1]: https://github.com/tw4452852/bb

Signed-off-by: Tw <tw19881113@gmail.com>
Change-Id: I5ee6c05bd8a684261c53effe9c95d9f26a6a6964
---
 tools/lib/bpf/libbpf.c | 3 ++-
 tools/lib/bpf/linker.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index b749c0174..05727c418 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;
 }
 
 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 78f92c392..1fb0efdbf 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;
 }
 
 static bool is_ignored_sec(struct src_sec *sec)
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] libbpf: Ignore exception frame section
  2026-08-23  9:20 [PATCH] libbpf: Ignore exception frame section Tw
@ 2026-08-23  9:30 ` sashiko-bot
  2026-08-23 10:00 ` bot+bpf-ci
  2026-08-23 18:54 ` Kumar Kartikeya Dwivedi
  2 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-08-23  9:30 UTC (permalink / raw)
  To: Tw; +Cc: bpf

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] libbpf: Ignore exception frame section
  2026-08-23  9:20 [PATCH] libbpf: Ignore exception frame section Tw
  2026-08-23  9:30 ` sashiko-bot
@ 2026-08-23 10:00 ` bot+bpf-ci
  2026-08-23 18:54 ` Kumar Kartikeya Dwivedi
  2 siblings, 0 replies; 4+ messages in thread
From: bot+bpf-ci @ 2026-08-23 10:00 UTC (permalink / raw)
  To: tw19881113, bpf
  Cc: tw19881113, ast, andrii, daniel, martin.lau, eddyz87,
	yonghong.song, clm, ihor.solodrai

[-- Attachment #1: Type: text/plain, Size: 680 bytes --]

> libbpf: Ignore exception frame section
>
> Exception handing should not be the interest yet, let's skip it.
> BTW, I found this when building BPF with Zig compiler[1].
>
> [1]: https://github.com/tw4452852/bb
>
> Signed-off-by: Tw <tw19881113@gmail.com>
> Change-Id: I5ee6c05bd8a684261c53effe9c95d9f26a6a6964

This isn't a bug, but should 'Exception handing' be corrected to
'Exception handling' in the first line of the commit message?


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/32631556401

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] libbpf: Ignore exception frame section
  2026-08-23  9:20 [PATCH] libbpf: Ignore exception frame section Tw
  2026-08-23  9:30 ` sashiko-bot
  2026-08-23 10:00 ` bot+bpf-ci
@ 2026-08-23 18:54 ` Kumar Kartikeya Dwivedi
  2 siblings, 0 replies; 4+ messages in thread
From: Kumar Kartikeya Dwivedi @ 2026-08-23 18:54 UTC (permalink / raw)
  To: Tw, bpf

On Sun Aug 23, 2026 at 11:20 AM CEST, Tw wrote:
> Exception handing should not be the interest yet, let's skip it.
> BTW, I found this when building BPF with Zig compiler[1].
>

Please write a more meaningful commit message. "should not be the interest yet"?

> [1]: https://github.com/tw4452852/bb
>
> Signed-off-by: Tw <tw19881113@gmail.com>

Please use your full real name.

> Change-Id: I5ee6c05bd8a684261c53effe9c95d9f26a6a6964

Drop this.

pw-bot: cr

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-23 18:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-23  9:20 [PATCH] libbpf: Ignore exception frame section Tw
2026-08-23  9:30 ` sashiko-bot
2026-08-23 10:00 ` bot+bpf-ci
2026-08-23 18:54 ` Kumar Kartikeya Dwivedi

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.