BPF List
 help / color / mirror / Atom feed
* [PATCH v2] libbpf: Ignore exception frame section
@ 2026-08-24 13:01 Tw
  2026-08-24 13:08 ` Kumar Kartikeya Dwivedi
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tw @ 2026-08-24 13:01 UTC (permalink / raw)
  To: bpf; +Cc: Tw

Exception handling in BPF program is not supported right now, 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>
---
v2:
 Revise the commit message.

 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 v2] libbpf: Ignore exception frame section
  2026-08-24 13:01 [PATCH v2] libbpf: Ignore exception frame section Tw
@ 2026-08-24 13:08 ` Kumar Kartikeya Dwivedi
  2026-08-24 13:44 ` bot+bpf-ci
  2026-08-24 19:55 ` Andrii Nakryiko
  2 siblings, 0 replies; 4+ messages in thread
From: Kumar Kartikeya Dwivedi @ 2026-08-24 13:08 UTC (permalink / raw)
  To: Tw, bpf

On Mon Aug 24, 2026 at 3:01 PM CEST, Tw wrote:
> Exception handling in BPF program is not supported right now, 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>

You need to have your full real name in the SoB tag. Patches cannot be accepted
otherwise.

pw-bot: cr

> ---
> v2:
>  Revise the commit message.
>
>  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)


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

* Re: [PATCH v2] libbpf: Ignore exception frame section
  2026-08-24 13:01 [PATCH v2] libbpf: Ignore exception frame section Tw
  2026-08-24 13:08 ` Kumar Kartikeya Dwivedi
@ 2026-08-24 13:44 ` bot+bpf-ci
  2026-08-24 19:55 ` Andrii Nakryiko
  2 siblings, 0 replies; 4+ messages in thread
From: bot+bpf-ci @ 2026-08-24 13:44 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: 2823 bytes --]

>     libbpf: Ignore exception frame section
>
>     Exception handling in BPF program is not supported right now, 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>

Kumar Kartikeya Dwivedi pointed out in both v1 and v2 reviews that the
Signed-off-by tag must contain the author's full real name, not just
'Tw'. The v2 review explicitly stated: 'You need to have your full real
name in the SoB tag. Patches cannot be accepted otherwise.'

Could you update the Signed-off-by to include your full name?

> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index b749c01742ee..05727c418c40 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;

This isn't a bug, but could the continuation line be aligned under the
first operand (tab + 7 spaces) so the two operands line up? Every other
wrapped return statement in libbpf.c uses tab plus seven spaces to align
the continuation, like in bpf_map__is_ringbuf():

    return map->def.type == BPF_MAP_TYPE_RINGBUF ||
           map->def.type == BPF_MAP_TYPE_USER_RINGBUF;

>  }
>
>  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 78f92c39290a..1fb0efdbfae7 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;

This isn't a bug, but since the same .eh_frame check now has to be
extended in both is_sec_name_dwarf() and is_dwarf_sec_name(), and their
callers ignore_elf_section() and is_ignored_sec() are also near-verbatim
copies including the same .rel prefix-stripping and the same BTF section
exclusions, would it be worth moving the shared predicate into
libbpf_internal.h so future additions only need one edit?

>  }
>
>  static bool is_ignored_sec(struct src_sec *sec)


---
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/32731757949

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

* Re: [PATCH v2] libbpf: Ignore exception frame section
  2026-08-24 13:01 [PATCH v2] libbpf: Ignore exception frame section Tw
  2026-08-24 13:08 ` Kumar Kartikeya Dwivedi
  2026-08-24 13:44 ` bot+bpf-ci
@ 2026-08-24 19:55 ` Andrii Nakryiko
  2 siblings, 0 replies; 4+ messages in thread
From: Andrii Nakryiko @ 2026-08-24 19:55 UTC (permalink / raw)
  To: Tw; +Cc: bpf

On Mon, Aug 24, 2026 at 6:03 AM Tw <tw19881113@gmail.com> wrote:
>
> Exception handling in BPF program is not supported right now, let's skip it.
> BTW, I found this when building BPF with Zig compiler[1].
>

Instruct zig compiler to not generate .eh_frame for BPF object file,
which is not supported anyways? That's been a solution for C/C++
compilers so far.

> [1]: https://github.com/tw4452852/bb
>
> Signed-off-by: Tw <tw19881113@gmail.com>
> ---
> v2:
>  Revise the commit message.
>
>  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	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-24 19:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-24 13:01 [PATCH v2] libbpf: Ignore exception frame section Tw
2026-08-24 13:08 ` Kumar Kartikeya Dwivedi
2026-08-24 13:44 ` bot+bpf-ci
2026-08-24 19:55 ` Andrii Nakryiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox