<feed xmlns='http://www.w3.org/2005/Atom'>
<title>talos-op-linux/tools/testing/selftests/bpf, branch master</title>
<subtitle>Talos™ II Linux sources for OpenPOWER</subtitle>
<id>https://git.raptorcs.com/git/talos-op-linux/atom?h=master</id>
<link rel='self' href='https://git.raptorcs.com/git/talos-op-linux/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-op-linux/'/>
<updated>2020-02-07T21:36:26+00:00</updated>
<entry>
<title>selftests/bpf: Test freeing sockmap/sockhash with a socket in it</title>
<updated>2020-02-07T21:36:26+00:00</updated>
<author>
<name>Jakub Sitnicki</name>
<email>jakub@cloudflare.com</email>
</author>
<published>2020-02-06T11:16:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-op-linux/commit/?id=5d3919a953c3c96c02fc7a337f8376cde43ae31f'/>
<id>urn:sha1:5d3919a953c3c96c02fc7a337f8376cde43ae31f</id>
<content type='text'>
Commit 7e81a3530206 ("bpf: Sockmap, ensure sock lock held during tear
down") introduced sleeping issues inside RCU critical sections and while
holding a spinlock on sockmap/sockhash tear-down. There has to be at least
one socket in the map for the problem to surface.

This adds a test that triggers the warnings for broken locking rules. Not a
fix per se, but rather tooling to verify the accompanying fixes. Run on a
VM with 1 vCPU to reproduce the warnings.

Fixes: 7e81a3530206 ("bpf: Sockmap, ensure sock lock held during tear down")
Signed-off-by: Jakub Sitnicki &lt;jakub@cloudflare.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: John Fastabend &lt;john.fastabend@gmail.com&gt;
Link: https://lore.kernel.org/bpf/20200206111652.694507-4-jakub@cloudflare.com
</content>
</entry>
<entry>
<title>selftests/bpf: Fix trampoline_count.c selftest compilation warning</title>
<updated>2020-02-03T23:08:49+00:00</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andriin@fb.com</email>
</author>
<published>2020-02-02T06:51:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-op-linux/commit/?id=8fc91b972b734a62a3f3ef45db06d06617f739ea'/>
<id>urn:sha1:8fc91b972b734a62a3f3ef45db06d06617f739ea</id>
<content type='text'>
Fix missing braces compilation warning in trampoline_count test:

  .../prog_tests/trampoline_count.c: In function ‘test_trampoline_count’:
  .../prog_tests/trampoline_count.c:49:9: warning: missing braces around initializer [-Wmissing-braces]
  struct inst inst[MAX_TRAMP_PROGS] = { 0 };
         ^
  .../prog_tests/trampoline_count.c:49:9: warning: (near initialization for ‘inst[0]’) [-Wmissing-braces]

Fixes: d633d57902a5 ("selftest/bpf: Add test for allowed trampolines count")
Signed-off-by: Andrii Nakryiko &lt;andriin@fb.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Yonghong Song &lt;yhs@fb.com&gt;
Link: https://lore.kernel.org/bpf/20200202065152.2718142-1-andriin@fb.com
</content>
</entry>
<entry>
<title>selftests/bpf: Add test based on port range for BPF flow dissector</title>
<updated>2020-01-27T10:25:07+00:00</updated>
<author>
<name>Yoshiki Komachi</name>
<email>komachi.yoshiki@gmail.com</email>
</author>
<published>2020-01-17T07:05:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-op-linux/commit/?id=265bb359061db6ef825dec3912f341a604966371'/>
<id>urn:sha1:265bb359061db6ef825dec3912f341a604966371</id>
<content type='text'>
Add a simple test to make sure that a filter based on specified port
range classifies packets correctly.

Signed-off-by: Yoshiki Komachi &lt;komachi.yoshiki@gmail.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Petar Penkov &lt;ppenkov@google.com&gt;
Acked-by: John Fastabend &lt;john.fastabend@gmail.com&gt;
Link: https://lore.kernel.org/bpf/20200117070533.402240-3-komachi.yoshiki@gmail.com
</content>
</entry>
<entry>
<title>selftest/bpf: Add test for allowed trampolines count</title>
<updated>2020-01-25T15:12:40+00:00</updated>
<author>
<name>Jiri Olsa</name>
<email>jolsa@kernel.org</email>
</author>
<published>2020-01-23T16:15:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-op-linux/commit/?id=d633d57902a510debd4ec5b7a374a009c8c2d620'/>
<id>urn:sha1:d633d57902a510debd4ec5b7a374a009c8c2d620</id>
<content type='text'>
There's limit of 40 programs tht can be attached
to trampoline for one function. Adding test that
tries to attach that many plus one extra that needs
to fail.

Signed-off-by: Jiri Olsa &lt;jolsa@kernel.org&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20200123161508.915203-4-jolsa@kernel.org
</content>
</entry>
<entry>
<title>selftests: bpf: Reset global state between reuseport test runs</title>
<updated>2020-01-24T21:12:13+00:00</updated>
<author>
<name>Lorenz Bauer</name>
<email>lmb@cloudflare.com</email>
</author>
<published>2020-01-24T11:27:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-op-linux/commit/?id=51bad0f05616c43d6d34b0a19bcc9bdab8e8fb39'/>
<id>urn:sha1:51bad0f05616c43d6d34b0a19bcc9bdab8e8fb39</id>
<content type='text'>
Currently, there is a lot of false positives if a single reuseport test
fails. This is because expected_results and the result map are not cleared.

Zero both after individual test runs, which fixes the mentioned false
positives.

Fixes: 91134d849a0e ("bpf: Test BPF_PROG_TYPE_SK_REUSEPORT")
Signed-off-by: Lorenz Bauer &lt;lmb@cloudflare.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Reviewed-by: Jakub Sitnicki &lt;jakub@cloudflare.com&gt;
Acked-by: Martin KaFai Lau &lt;kafai@fb.com&gt;
Acked-by: John Fastabend &lt;john.fastabend@gmail.com&gt;
Link: https://lore.kernel.org/bpf/20200124112754.19664-5-lmb@cloudflare.com
</content>
</entry>
<entry>
<title>selftests: bpf: Make reuseport test output more legible</title>
<updated>2020-01-24T21:12:13+00:00</updated>
<author>
<name>Lorenz Bauer</name>
<email>lmb@cloudflare.com</email>
</author>
<published>2020-01-24T11:27:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-op-linux/commit/?id=603fba9dfd0b2e2a844ece9ed98ce874c38aa98e'/>
<id>urn:sha1:603fba9dfd0b2e2a844ece9ed98ce874c38aa98e</id>
<content type='text'>
Include the name of the mismatching result in human readable format
when reporting an error. The new output looks like the following:

  unexpected result
   result: [1, 0, 0, 0, 0, 0]
  expected: [0, 0, 0, 0, 0, 0]
  mismatch on DROP_ERR_INNER_MAP (bpf_prog_linum:153)
  check_results:FAIL:382

Signed-off-by: Lorenz Bauer &lt;lmb@cloudflare.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Reviewed-by: Jakub Sitnicki &lt;jakub@cloudflare.com&gt;
Acked-by: Martin KaFai Lau &lt;kafai@fb.com&gt;
Acked-by: John Fastabend &lt;john.fastabend@gmail.com&gt;
Link: https://lore.kernel.org/bpf/20200124112754.19664-4-lmb@cloudflare.com
</content>
</entry>
<entry>
<title>selftests: bpf: Ignore FIN packets for reuseport tests</title>
<updated>2020-01-24T21:12:13+00:00</updated>
<author>
<name>Lorenz Bauer</name>
<email>lmb@cloudflare.com</email>
</author>
<published>2020-01-24T11:27:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-op-linux/commit/?id=8bec4f665e0baecb5f1b683379fc10b3745eb612'/>
<id>urn:sha1:8bec4f665e0baecb5f1b683379fc10b3745eb612</id>
<content type='text'>
The reuseport tests currently suffer from a race condition: FIN
packets count towards DROP_ERR_SKB_DATA, since they don't contain
a valid struct cmd. Tests will spuriously fail depending on whether
check_results is called before or after the FIN is processed.

Exit the BPF program early if FIN is set.

Fixes: 91134d849a0e ("bpf: Test BPF_PROG_TYPE_SK_REUSEPORT")
Signed-off-by: Lorenz Bauer &lt;lmb@cloudflare.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Reviewed-by: Jakub Sitnicki &lt;jakub@cloudflare.com&gt;
Acked-by: Martin KaFai Lau &lt;kafai@fb.com&gt;
Acked-by: John Fastabend &lt;john.fastabend@gmail.com&gt;
Link: https://lore.kernel.org/bpf/20200124112754.19664-3-lmb@cloudflare.com
</content>
</entry>
<entry>
<title>selftests: bpf: Use a temporary file in test_sockmap</title>
<updated>2020-01-24T21:12:13+00:00</updated>
<author>
<name>Lorenz Bauer</name>
<email>lmb@cloudflare.com</email>
</author>
<published>2020-01-24T11:27:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-op-linux/commit/?id=c31dbb1e41d1857b403f9bf58c87f5898519a0bc'/>
<id>urn:sha1:c31dbb1e41d1857b403f9bf58c87f5898519a0bc</id>
<content type='text'>
Use a proper temporary file for sendpage tests. This means that running
the tests doesn't clutter the working directory, and allows running the
test on read-only filesystems.

Fixes: 16962b2404ac ("bpf: sockmap, add selftests")
Signed-off-by: Lorenz Bauer &lt;lmb@cloudflare.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Reviewed-by: Jakub Sitnicki &lt;jakub@cloudflare.com&gt;
Acked-by: Martin KaFai Lau &lt;kafai@fb.com&gt;
Acked-by: John Fastabend &lt;john.fastabend@gmail.com&gt;
Link: https://lore.kernel.org/bpf/20200124112754.19664-2-lmb@cloudflare.com
</content>
</entry>
<entry>
<title>selftests/bpf: Improve bpftool changes detection</title>
<updated>2020-01-24T10:09:21+00:00</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andriin@fb.com</email>
</author>
<published>2020-01-24T05:41:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-op-linux/commit/?id=03506297d205e5fa25b5ead0f6338b5a4a996a93'/>
<id>urn:sha1:03506297d205e5fa25b5ead0f6338b5a4a996a93</id>
<content type='text'>
Detect when bpftool source code changes and trigger rebuild within
selftests/bpf Makefile. Also fix few small formatting problems.

Signed-off-by: Andrii Nakryiko &lt;andriin@fb.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Martin KaFai Lau &lt;kafai@fb.com&gt;
Acked-by: Toke Høiland-Jørgensen &lt;toke@redhat.com&gt;
Link: https://lore.kernel.org/bpf/20200124054148.2455060-1-andriin@fb.com
</content>
</entry>
<entry>
<title>selftests/bpf: Initialize duration variable before using</title>
<updated>2020-01-24T10:05:45+00:00</updated>
<author>
<name>John Sperbeck</name>
<email>jsperbeck@google.com</email>
</author>
<published>2020-01-23T23:51:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-op-linux/commit/?id=1a6fa10640d97e16d4184fa1c24aa8c3337d4653'/>
<id>urn:sha1:1a6fa10640d97e16d4184fa1c24aa8c3337d4653</id>
<content type='text'>
The 'duration' variable is referenced in the CHECK() macro, and there are
some uses of the macro before 'duration' is set.  The clang compiler
(validly) complains about this.

Sample error:

.../selftests/bpf/prog_tests/fexit_test.c:23:6: warning: variable 'duration' is uninitialized when used here [-Wuninitialized]
        if (CHECK(err, "prog_load sched cls", "err %d errno %d\n", err, errno))
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../selftests/bpf/test_progs.h:134:25: note: expanded from macro 'CHECK'
        if (CHECK(err, "prog_load sched cls", "err %d errno %d\n", err, errno))
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        _CHECK(condition, tag, duration, format)
                               ^~~~~~~~

Signed-off-by: John Sperbeck &lt;jsperbeck@google.com&gt;
Signed-off-by: Stanislav Fomichev &lt;sdf@google.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Martin KaFai Lau &lt;kafai@fb.com&gt;
Link: https://lore.kernel.org/bpf/20200123235144.93610-1-sdf@google.com
</content>
</entry>
</feed>
