From: Eduard Zingerman <eddyz87@gmail.com>
To: bpf@vger.kernel.org, ast@kernel.org
Cc: andrii@kernel.org, daniel@iogearbox.net, martin.lau@linux.dev,
kernel-team@fb.com, yhs@fb.com, james.hilliard1@gmail.com,
Eduard Zingerman <eddyz87@gmail.com>
Subject: [PATCH bpf-next 1/2] selftests/bpf: Test if bpftool linker handles empty sections
Date: Tue, 28 Mar 2023 03:47:37 +0300 [thread overview]
Message-ID: <20230328004738.381898-2-eddyz87@gmail.com> (raw)
In-Reply-To: <20230328004738.381898-1-eddyz87@gmail.com>
Adds two empty functions to linked_funcs[12].c. The functions are
annotated as "naked" and go to a separate section. This section ends
up having size 0. bpftool linker merges content for sections with
identical names. This tests if it can handle empty sections.
Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
---
tools/testing/selftests/bpf/progs/linked_funcs1.c | 3 +++
tools/testing/selftests/bpf/progs/linked_funcs2.c | 3 +++
2 files changed, 6 insertions(+)
diff --git a/tools/testing/selftests/bpf/progs/linked_funcs1.c b/tools/testing/selftests/bpf/progs/linked_funcs1.c
index c4b49ceea967..029bb5022ba2 100644
--- a/tools/testing/selftests/bpf/progs/linked_funcs1.c
+++ b/tools/testing/selftests/bpf/progs/linked_funcs1.c
@@ -86,4 +86,7 @@ int BPF_PROG(handler1, struct pt_regs *regs, long id)
return 0;
}
+SEC(".empty_section")
+__naked void empty_function1(void) {}
+
char LICENSE[] SEC("license") = "GPL";
diff --git a/tools/testing/selftests/bpf/progs/linked_funcs2.c b/tools/testing/selftests/bpf/progs/linked_funcs2.c
index 013ff0645f0c..4547c8dfc689 100644
--- a/tools/testing/selftests/bpf/progs/linked_funcs2.c
+++ b/tools/testing/selftests/bpf/progs/linked_funcs2.c
@@ -86,4 +86,7 @@ int BPF_PROG(handler2, struct pt_regs *regs, long id)
return 0;
}
+SEC(".empty_section")
+__naked void empty_function2(void) {}
+
char LICENSE[] SEC("license") = "GPL";
--
2.40.0
next prev parent reply other threads:[~2023-03-28 0:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-28 0:47 [PATCH bpf-next 0/2] Fix double-free when linker processes empty sections Eduard Zingerman
2023-03-28 0:47 ` Eduard Zingerman [this message]
2023-03-28 3:04 ` [PATCH bpf-next 1/2] selftests/bpf: Test if bpftool linker handles " Andrii Nakryiko
2023-03-28 0:47 ` [PATCH bpf-next 2/2] libbpf: Fix double-free when linker processes " Eduard Zingerman
2023-03-28 2:18 ` James Hilliard
2023-03-28 3:10 ` [PATCH bpf-next 0/2] " 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=20230328004738.381898-2-eddyz87@gmail.com \
--to=eddyz87@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=james.hilliard1@gmail.com \
--cc=kernel-team@fb.com \
--cc=martin.lau@linux.dev \
--cc=yhs@fb.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox