diff mbox series

[bpf-next] bpf, selftests: test_maps generating unrecognized data section

Message ID 161731595664.74613.1603087410166945302.stgit@john-XPS-13-9370 (mailing list archive)
State Accepted
Commit 007bdc12d4b466566784c1a39b9fb3985f875b3d
Delegated to: BPF
Headers show
Series [bpf-next] bpf, selftests: test_maps generating unrecognized data section | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for bpf-next
netdev/subject_prefix success Link
netdev/cc_maintainers warning 13 maintainers not CCed: linux-kselftest@vger.kernel.org netdev@vger.kernel.org yhs@fb.com kpsingh@kernel.org daniel@iogearbox.net andrii@kernel.org kafai@fb.com clang-built-linux@googlegroups.com ast@kernel.org nathan@kernel.org songliubraving@fb.com ndesaulniers@google.com shuah@kernel.org
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 18 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

John Fastabend April 1, 2021, 10:25 p.m. UTC
With a relatively recent clang master branch test_map skips a section,

 libbpf: elf: skipping unrecognized data section(5) .rodata.str1.1

the cause is some pointless strings from bpf_printks in the BPF program
loaded during testing. After just removing the prints to fix above
error Daniel points out the program is a bit pointless and could
be simply the empty program returning SK_PASS.

Here we do just that and return simply SK_PASS. This program is used with
test_maps selftests to test insert/remove of a program into the sockmap
and sockhash maps. Its not testing actual functionality of the TCP sockmap
programs, these are tested from test_sockmap. So we shouldn't lose in
test coverage and fix above warnings. This original test was added before
test_sockmap existed and has been copied around ever since, clean it up
now.

Signed-off-by: John Fastabend <john.fastabend@gmail.com>
---
 .../selftests/bpf/progs/sockmap_tcp_msg_prog.c     |   12 ------------
 1 file changed, 12 deletions(-)

Comments

Song Liu April 1, 2021, 10:47 p.m. UTC | #1
On Thu, Apr 1, 2021 at 3:28 PM John Fastabend <john.fastabend@gmail.com> wrote:
>
> With a relatively recent clang master branch test_map skips a section,
>
>  libbpf: elf: skipping unrecognized data section(5) .rodata.str1.1
>
> the cause is some pointless strings from bpf_printks in the BPF program
> loaded during testing. After just removing the prints to fix above
> error Daniel points out the program is a bit pointless and could
> be simply the empty program returning SK_PASS.
>
> Here we do just that and return simply SK_PASS. This program is used with
> test_maps selftests to test insert/remove of a program into the sockmap
> and sockhash maps. Its not testing actual functionality of the TCP sockmap
> programs, these are tested from test_sockmap. So we shouldn't lose in
> test coverage and fix above warnings. This original test was added before
> test_sockmap existed and has been copied around ever since, clean it up
> now.
>
> Signed-off-by: John Fastabend <john.fastabend@gmail.com>

Acked-by: Song Liu <songliubraving@fb.com>
patchwork-bot+netdevbpf@kernel.org April 2, 2021, 11:30 p.m. UTC | #2
Hello:

This patch was applied to bpf/bpf-next.git (refs/heads/master):

On Thu, 01 Apr 2021 15:25:56 -0700 you wrote:
> With a relatively recent clang master branch test_map skips a section,
> 
>  libbpf: elf: skipping unrecognized data section(5) .rodata.str1.1
> 
> the cause is some pointless strings from bpf_printks in the BPF program
> loaded during testing. After just removing the prints to fix above
> error Daniel points out the program is a bit pointless and could
> be simply the empty program returning SK_PASS.
> 
> [...]

Here is the summary with links:
  - [bpf-next] bpf, selftests: test_maps generating unrecognized data section
    https://git.kernel.org/bpf/bpf-next/c/007bdc12d4b4

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/progs/sockmap_tcp_msg_prog.c b/tools/testing/selftests/bpf/progs/sockmap_tcp_msg_prog.c
index fdb4bf4408fa..eeaf6e75c9a2 100644
--- a/tools/testing/selftests/bpf/progs/sockmap_tcp_msg_prog.c
+++ b/tools/testing/selftests/bpf/progs/sockmap_tcp_msg_prog.c
@@ -8,18 +8,6 @@  int _version SEC("version") = 1;
 SEC("sk_msg1")
 int bpf_prog1(struct sk_msg_md *msg)
 {
-	void *data_end = (void *)(long) msg->data_end;
-	void *data = (void *)(long) msg->data;
-
-	char *d;
-
-	if (data + 8 > data_end)
-		return SK_DROP;
-
-	bpf_printk("data length %i\n", (__u64)msg->data_end - (__u64)msg->data);
-	d = (char *)data;
-	bpf_printk("hello sendmsg hook %i %i\n", d[0], d[1]);
-
 	return SK_PASS;
 }