<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/lib/test_bpf.c, branch v4.3</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v4.3</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v4.3'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2015-08-07T05:02:32Z</updated>
<entry>
<title>test_bpf: add tests checking that JIT/interpreter sets A and X to 0.</title>
<updated>2015-08-07T05:02:32Z</updated>
<author>
<name>Nicolas Schichan</name>
<email>nschichan@freebox.fr</email>
</author>
<published>2015-08-04T13:19:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=86bf1721b2263607588b23b22e78c971379972b5'/>
<id>urn:sha1:86bf1721b2263607588b23b22e78c971379972b5</id>
<content type='text'>
It is mandatory for the JIT or interpreter to reset the A and X
registers to 0 before running the filter. Check that it is the case on
various ALU and JMP instructions.

Signed-off-by: Nicolas Schichan &lt;nschichan@freebox.fr&gt;
Acked-by: Alexei Starovoitov &lt;ast@plumgrid.com&gt;
Acked-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>test_bpf: add more tests for LD_ABS and LD_IND.</title>
<updated>2015-08-07T05:02:32Z</updated>
<author>
<name>Nicolas Schichan</name>
<email>nschichan@freebox.fr</email>
</author>
<published>2015-08-04T13:19:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=08fcb08fc06758411d099bcd6a60d6cdee2d50a7'/>
<id>urn:sha1:08fcb08fc06758411d099bcd6a60d6cdee2d50a7</id>
<content type='text'>
This exerces the LD_ABS and LD_IND instructions for various sizes and
alignments. This also checks that X when used as an offset to a
BPF_IND instruction first in a filter is correctly set to 0.

Signed-off-by: Nicolas Schichan &lt;nschichan@freebox.fr&gt;
Acked-by: Alexei Starovoitov &lt;ast@plumgrid.com&gt;
Acked-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>test_bpf: add module parameters to filter the tests to run.</title>
<updated>2015-08-07T05:02:32Z</updated>
<author>
<name>Nicolas Schichan</name>
<email>nschichan@freebox.fr</email>
</author>
<published>2015-08-04T13:19:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d2648d4e268cee60c9c917a04c3fbc4e8c3bbc7e'/>
<id>urn:sha1:d2648d4e268cee60c9c917a04c3fbc4e8c3bbc7e</id>
<content type='text'>
When developping on the interpreter or a particular JIT, it can be
interesting to restrict the tests list to a specific test or a
particular range of tests.

This patch adds the following module parameters to the test_bpf module:

* test_name=&lt;string&gt;: only the specified named test will be run.

* test_id=&lt;number&gt;: only the test with the specified id will be run
  (see the output of test_bpf without parameters to get the test id).

* test_range=&lt;number&gt;,&lt;number&gt;: only the tests within IDs in the
  specified id range are run (see the output of test_bpf without
  parameters to get the test ids).

Any invalid range, test id or test name will result in -EINVAL being
returned and no tests being run.

Signed-off-by: Nicolas Schichan &lt;nschichan@freebox.fr&gt;
Acked-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Alexei Starovoitov &lt;ast@plumgrid.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>test_bpf: test LD_ABS and LD_IND instructions on fragmented skbs.</title>
<updated>2015-08-07T05:02:32Z</updated>
<author>
<name>Nicolas Schichan</name>
<email>nschichan@freebox.fr</email>
</author>
<published>2015-08-04T13:19:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2cf1ad759307f4ef2a27a59f3071e357ec487841'/>
<id>urn:sha1:2cf1ad759307f4ef2a27a59f3071e357ec487841</id>
<content type='text'>
These new tests exercise various load sizes and offsets crossing the
head/fragment boundary.

Signed-off-by: Nicolas Schichan &lt;nschichan@freebox.fr&gt;
Acked-by: Alexei Starovoitov &lt;ast@plumgrid.com&gt;
Acked-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>test_bpf: allow tests to specify an skb fragment.</title>
<updated>2015-08-07T05:02:31Z</updated>
<author>
<name>Nicolas Schichan</name>
<email>nschichan@freebox.fr</email>
</author>
<published>2015-08-04T13:19:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=bac142acb90e952899cb8204fad12ef7d1e42f94'/>
<id>urn:sha1:bac142acb90e952899cb8204fad12ef7d1e42f94</id>
<content type='text'>
This introduce a new test-&gt;aux flag (FLAG_SKB_FRAG) to tell the
populate_skb() function to add a fragment to the test skb containing
the data specified in test-&gt;frag_data).

Signed-off-by: Nicolas Schichan &lt;nschichan@freebox.fr&gt;
Acked-by: Alexei Starovoitov &lt;ast@plumgrid.com&gt;
Acked-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>test_bpf: avoid oopsing the kernel when generate_test_data() fails.</title>
<updated>2015-08-07T05:02:31Z</updated>
<author>
<name>Nicolas Schichan</name>
<email>nschichan@freebox.fr</email>
</author>
<published>2015-08-04T13:19:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e34684f88efd9cf29ad5ff4750a0f5586383141f'/>
<id>urn:sha1:e34684f88efd9cf29ad5ff4750a0f5586383141f</id>
<content type='text'>
Signed-off-by: Nicolas Schichan &lt;nschichan@freebox.fr&gt;
Acked-by: Alexei Starovoitov &lt;ast@plumgrid.com&gt;
Acked-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>test_bpf: assign type to native eBPF test cases</title>
<updated>2015-07-30T18:13:20Z</updated>
<author>
<name>Daniel Borkmann</name>
<email>daniel@iogearbox.net</email>
</author>
<published>2015-07-30T10:42:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4962fa10f30d7b563f38467feeae10314b166c77'/>
<id>urn:sha1:4962fa10f30d7b563f38467feeae10314b166c77</id>
<content type='text'>
As JITs start to perform optimizations whether to clear A and X on eBPF
programs in the prologue, we should actually assign a program type to the
native eBPF test cases. It doesn't really matter which program type, as
these instructions don't go through the verifier, but it needs to be a
type != BPF_PROG_TYPE_UNSPEC. This reflects eBPF programs loaded via bpf(2)
system call (!= type unspec) vs. classic BPF to eBPF migrations (== type
unspec).

Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Cc: Michael Holzheu &lt;holzheu@linux.vnet.ibm.com&gt;
Acked-by: Alexei Starovoitov &lt;ast@plumgrid.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>test_bpf: add bpf_skb_vlan_push/pop() tests</title>
<updated>2015-07-21T03:52:32Z</updated>
<author>
<name>Alexei Starovoitov</name>
<email>ast@plumgrid.com</email>
</author>
<published>2015-07-21T03:34:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4d9c5c53ac99e4cb5d031897863203d7817b36e0'/>
<id>urn:sha1:4d9c5c53ac99e4cb5d031897863203d7817b36e0</id>
<content type='text'>
improve accuracy of timing in test_bpf and add two stress tests:
- {skb-&gt;data[0], get_smp_processor_id} repeated 2k times
- {skb-&gt;data[0], vlan_push} x 68 followed by {skb-&gt;data[0], vlan_pop} x 68

1st test is useful to test performance of JIT implementation of BPF_LD_ABS
together with BPF_CALL instructions.
2nd test is stressing skb_vlan_push/pop logic together with skb-&gt;data access
via BPF_LD_ABS insn which checks that re-caching of skb-&gt;data is done correctly.

In order to call bpf_skb_vlan_push() from test_bpf.ko have to add
three export_symbol_gpl.

Signed-off-by: Alexei Starovoitov &lt;ast@plumgrid.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>test_bpf: extend tests for 32-bit endianness conversion</title>
<updated>2015-07-08T23:19:53Z</updated>
<author>
<name>Xi Wang</name>
<email>xi.wang@gmail.com</email>
</author>
<published>2015-07-08T21:00:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ba29becd770ffec90f3af896daffac6b9acec608'/>
<id>urn:sha1:ba29becd770ffec90f3af896daffac6b9acec608</id>
<content type='text'>
Currently "ALU_END_FROM_BE 32" and "ALU_END_FROM_LE 32" do not test if
the upper bits of the result are zeros (the arm64 JIT had such bugs).
Extend the two tests to catch this.

Acked-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Alexei Starovoitov &lt;ast@plumgrid.com&gt;
Signed-off-by: Xi Wang &lt;xi.wang@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>test_bpf: add similarly conflicting jump test case only for classic</title>
<updated>2015-05-27T18:05:59Z</updated>
<author>
<name>Daniel Borkmann</name>
<email>daniel@iogearbox.net</email>
</author>
<published>2015-05-26T20:35:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=bde28bc6ad0c575f8b4eebe8cd27e36d6c3b09c6'/>
<id>urn:sha1:bde28bc6ad0c575f8b4eebe8cd27e36d6c3b09c6</id>
<content type='text'>
While 3b52960266a3 ("test_bpf: add more eBPF jump torture cases")
added the int3 bug test case only for eBPF, which needs exactly 11
passes to converge, here's a version for classic BPF with 11 passes,
and one that would need 70 passes on x86_64 to actually converge for
being successfully JITed. Effectively, all jumps are being optimized
out resulting in a JIT image of just 89 bytes (from originally max
BPF insns), only returning K.

Might be useful as a receipe for folks wanting to craft a test case
when backporting the fix in commit 3f7352bf21f8 ("x86: bpf_jit: fix
compilation of large bpf programs") while not having eBPF. The 2nd
one is delegated to the interpreter as the last pass still results
in shrinking, in other words, this one won't be JITed on x86_64.

Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Alexei Starovoitov &lt;ast@plumgrid.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
