All of lore.kernel.org
 help / color / mirror / Atom feed
* [bpf PATCH] small test_maps fix
@ 2021-03-24 21:07 John Fastabend
  2021-03-24 21:07 ` [bpf PATCH] bpf, selftests: test_maps generating unrecognized data section John Fastabend
  0 siblings, 1 reply; 5+ messages in thread
From: John Fastabend @ 2021-03-24 21:07 UTC (permalink / raw)
  To: andrii, daniel; +Cc: netdev, bpf, ast

Small fix to silence a warning running ./test_maps on my local test boxes.
Pushed to 'bpf' but can also apply against 'bpf-next' if folks would
prefer.

Thanks.

---

John Fastabend (1):
      bpf, selftests: test_maps generating unrecognized data section


 .../selftests/bpf/progs/sockmap_tcp_msg_prog.c     |    3 ---
 1 file changed, 3 deletions(-)

--
Signature

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

* [bpf PATCH] bpf, selftests: test_maps generating unrecognized data section
  2021-03-24 21:07 [bpf PATCH] small test_maps fix John Fastabend
@ 2021-03-24 21:07 ` John Fastabend
  2021-03-25 21:07   ` Daniel Borkmann
  2021-03-26  3:03   ` Andrii Nakryiko
  0 siblings, 2 replies; 5+ messages in thread
From: John Fastabend @ 2021-03-24 21:07 UTC (permalink / raw)
  To: andrii, daniel; +Cc: netdev, bpf, ast

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. Remove them so we stop tripping our test bots.

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

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..0f603253f4ed 100644
--- a/tools/testing/selftests/bpf/progs/sockmap_tcp_msg_prog.c
+++ b/tools/testing/selftests/bpf/progs/sockmap_tcp_msg_prog.c
@@ -16,10 +16,7 @@ int bpf_prog1(struct sk_msg_md *msg)
 	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;
 }
 


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

* Re: [bpf PATCH] bpf, selftests: test_maps generating unrecognized data section
  2021-03-24 21:07 ` [bpf PATCH] bpf, selftests: test_maps generating unrecognized data section John Fastabend
@ 2021-03-25 21:07   ` Daniel Borkmann
  2021-03-26  0:35     ` John Fastabend
  2021-03-26  3:03   ` Andrii Nakryiko
  1 sibling, 1 reply; 5+ messages in thread
From: Daniel Borkmann @ 2021-03-25 21:07 UTC (permalink / raw)
  To: John Fastabend, andrii; +Cc: netdev, bpf, ast

On 3/24/21 10:07 PM, John Fastabend 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. Remove them so we stop tripping our test bots.
> 
> Signed-off-by: John Fastabend <john.fastabend@gmail.com>
> ---
>   .../selftests/bpf/progs/sockmap_tcp_msg_prog.c     |    3 ---
>   1 file changed, 3 deletions(-)
> 
> 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..0f603253f4ed 100644
> --- a/tools/testing/selftests/bpf/progs/sockmap_tcp_msg_prog.c
> +++ b/tools/testing/selftests/bpf/progs/sockmap_tcp_msg_prog.c
> @@ -16,10 +16,7 @@ int bpf_prog1(struct sk_msg_md *msg)
>   	if (data + 8 > data_end)
>   		return SK_DROP;
>   
> -	bpf_printk("data length %i\n", (__u64)msg->data_end - (__u64)msg->data);
>   	d = (char *)data;

Do we still need 'd' as well in that case, or the data + 8 > data_end test if we don't
read any of the data? I'm not sure what was the original purpose of the prog, perhaps
just to test that we can attach /something/ in general? Maybe in that case empty prog
is sufficient if we don't do anything useful with the rest?

> -	bpf_printk("hello sendmsg hook %i %i\n", d[0], d[1]);
> -
>   	return SK_PASS;
>   }
>   
> 


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

* Re: [bpf PATCH] bpf, selftests: test_maps generating unrecognized data section
  2021-03-25 21:07   ` Daniel Borkmann
@ 2021-03-26  0:35     ` John Fastabend
  0 siblings, 0 replies; 5+ messages in thread
From: John Fastabend @ 2021-03-26  0:35 UTC (permalink / raw)
  To: Daniel Borkmann, John Fastabend, andrii; +Cc: netdev, bpf, ast

Daniel Borkmann wrote:
> On 3/24/21 10:07 PM, John Fastabend 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. Remove them so we stop tripping our test bots.
> > 
> > Signed-off-by: John Fastabend <john.fastabend@gmail.com>
> > ---
> >   .../selftests/bpf/progs/sockmap_tcp_msg_prog.c     |    3 ---
> >   1 file changed, 3 deletions(-)
> > 
> > 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..0f603253f4ed 100644
> > --- a/tools/testing/selftests/bpf/progs/sockmap_tcp_msg_prog.c
> > +++ b/tools/testing/selftests/bpf/progs/sockmap_tcp_msg_prog.c
> > @@ -16,10 +16,7 @@ int bpf_prog1(struct sk_msg_md *msg)
> >   	if (data + 8 > data_end)
> >   		return SK_DROP;
> >   
> > -	bpf_printk("data length %i\n", (__u64)msg->data_end - (__u64)msg->data);
> >   	d = (char *)data;
> 
> Do we still need 'd' as well in that case, or the data + 8 > data_end test if we don't
> read any of the data? I'm not sure what was the original purpose of the prog, perhaps
> just to test that we can attach /something/ in general? Maybe in that case empty prog
> is sufficient if we don't do anything useful with the rest?

This program and test existed before test_sockmap was running and doing a
more complete test set. At that time it was the only thing verifying that
we could read the d[] and check lengths.

At this point these cases are covered there so it should be OK to just
make it an empty program. Then it is _just_ testing the map attach/detach
logic not that the programs themselves work correctly.

By the way without d marked violatile my compiler removes the load there
so its pointless as you note.

Because this is used for test maps I'll just make this an empty program.

> 
> > -	bpf_printk("hello sendmsg hook %i %i\n", d[0], d[1]);
> > -
> >   	return SK_PASS;
> >   }
> >   
> > 
> 



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

* Re: [bpf PATCH] bpf, selftests: test_maps generating unrecognized data section
  2021-03-24 21:07 ` [bpf PATCH] bpf, selftests: test_maps generating unrecognized data section John Fastabend
  2021-03-25 21:07   ` Daniel Borkmann
@ 2021-03-26  3:03   ` Andrii Nakryiko
  1 sibling, 0 replies; 5+ messages in thread
From: Andrii Nakryiko @ 2021-03-26  3:03 UTC (permalink / raw)
  To: John Fastabend
  Cc: Andrii Nakryiko, Daniel Borkmann, Networking, bpf, Alexei Starovoitov

On Wed, Mar 24, 2021 at 2:07 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
>

So it was on my TODO list for a while to get rid of this by combining
all .rodata* sections into one at load time. I even outline that in
"libbpf v1.0" doc ([0]). I just haven't gotten to implementing this
yet. You can safely ignore this for now. But I also have nothing
against cleaning up tests, of course.

  [0] https://docs.google.com/document/d/1UyjTZuPFWiPFyKk1tV5an11_iaRuec6U-ZESZ54nNTY


> the cause is some pointless strings from bpf_printks in the BPF program
> loaded during testing. Remove them so we stop tripping our test bots.
>
> Signed-off-by: John Fastabend <john.fastabend@gmail.com>
> ---
>  .../selftests/bpf/progs/sockmap_tcp_msg_prog.c     |    3 ---
>  1 file changed, 3 deletions(-)
>
> 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..0f603253f4ed 100644
> --- a/tools/testing/selftests/bpf/progs/sockmap_tcp_msg_prog.c
> +++ b/tools/testing/selftests/bpf/progs/sockmap_tcp_msg_prog.c
> @@ -16,10 +16,7 @@ int bpf_prog1(struct sk_msg_md *msg)
>         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;
>  }
>
>

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

end of thread, other threads:[~2021-03-26  3:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-24 21:07 [bpf PATCH] small test_maps fix John Fastabend
2021-03-24 21:07 ` [bpf PATCH] bpf, selftests: test_maps generating unrecognized data section John Fastabend
2021-03-25 21:07   ` Daniel Borkmann
2021-03-26  0:35     ` John Fastabend
2021-03-26  3:03   ` Andrii Nakryiko

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.