From: Andrii Nakryiko <andrii@kernel.org>
To: bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net,
martin.lau@kernel.org
Cc: andrii@kernel.org, kernel-team@meta.com
Subject: [PATCH bpf-next 2/2] selftests/bpf: add subprog to BPF object file with no entry programs
Date: Thu, 10 Oct 2024 14:17:31 -0700 [thread overview]
Message-ID: <20241010211731.4121837-2-andrii@kernel.org> (raw)
In-Reply-To: <20241010211731.4121837-1-andrii@kernel.org>
Add a subprogram to BPF object file that otherwise has no entry BPF
programs to validate that libbpf can still load this correctly.
Until this was fixed, user could expect this very confusing error message:
libbpf: prog 'dangling_subprog': missing BPF prog type, check ELF section name '.text'
libbpf: prog 'dangling_subprog': failed to load: -22
libbpf: failed to load object 'struct_ops_detach'
libbpf: failed to load BPF skeleton 'struct_ops_detach': -22
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
tools/testing/selftests/bpf/progs/struct_ops_detach.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tools/testing/selftests/bpf/progs/struct_ops_detach.c b/tools/testing/selftests/bpf/progs/struct_ops_detach.c
index 56b787a89876..5222d58592a7 100644
--- a/tools/testing/selftests/bpf/progs/struct_ops_detach.c
+++ b/tools/testing/selftests/bpf/progs/struct_ops_detach.c
@@ -6,5 +6,11 @@
char _license[] SEC("license") = "GPL";
+int dangling_subprog(void)
+{
+ /* do nothing, just be here */
+ return 0;
+}
+
SEC(".struct_ops.link")
struct bpf_testmod_ops testmod_do_detach;
--
2.43.5
next prev parent reply other threads:[~2024-10-10 21:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-10 21:17 [PATCH bpf-next 1/2] libbpf: never interpret subprogs in .text as entry programs Andrii Nakryiko
2024-10-10 21:17 ` Andrii Nakryiko [this message]
2024-10-10 21:22 ` [PATCH bpf-next 2/2] selftests/bpf: add subprog to BPF object file with no " Andrii Nakryiko
2024-10-11 18:32 ` [PATCH bpf-next 1/2] libbpf: never interpret subprogs in .text as " patchwork-bot+netdevbpf
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=20241010211731.4121837-2-andrii@kernel.org \
--to=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@meta.com \
--cc=martin.lau@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox