<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/tools/testing/selftests/bpf/progs, branch linux-5.12.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.12.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.12.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2021-05-14T08:53:04Z</updated>
<entry>
<title>selftests/bpf: Fix field existence CO-RE reloc tests</title>
<updated>2021-05-14T08:53:04Z</updated>
<author>
<name>Andrii Nakryiko</name>
</author>
<published>2021-04-26T19:29:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=dade94cf32233b13e3e672fc10e2a4dc0eb871b5'/>
<id>urn:sha1:dade94cf32233b13e3e672fc10e2a4dc0eb871b5</id>
<content type='text'>
[ Upstream commit 5a30eb23922b52f33222c6729b6b3ff1c37a6c66 ]

Negative field existence cases for have a broken assumption that FIELD_EXISTS
CO-RE relo will fail for fields that match the name but have incompatible type
signature. That's not how CO-RE relocations generally behave. Types and fields
that match by name but not by expected type are treated as non-matching
candidates and are skipped. Error later is reported if no matching candidate
was found. That's what happens for most relocations, but existence relocations
(FIELD_EXISTS and TYPE_EXISTS) are more permissive and they are designed to
return 0 or 1, depending if a match is found. This allows to handle
name-conflicting but incompatible types in BPF code easily. Combined with
___flavor suffixes, it's possible to handle pretty much any structural type
changes in kernel within the compiled once BPF source code.

So, long story short, negative field existence test cases are invalid in their
assumptions, so this patch reworks them into a single consolidated positive
case that doesn't match any of the fields.

Fixes: c7566a69695c ("selftests/bpf: Add field existence CO-RE relocs tests")
Reported-by: Lorenz Bauer &lt;lmb@cloudflare.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Acked-by: Lorenz Bauer &lt;lmb@cloudflare.com&gt;
Link: https://lore.kernel.org/bpf/20210426192949.416837-5-andrii@kernel.org
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>bpf/selftests: Test that kernel rejects a TCP CC with an invalid license</title>
<updated>2021-03-26T16:51:02Z</updated>
<author>
<name>Toke Høiland-Jørgensen</name>
</author>
<published>2021-03-26T10:03:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d8e8052e42d0f8ff59898b9b4142b16958627ac9'/>
<id>urn:sha1:d8e8052e42d0f8ff59898b9b4142b16958627ac9</id>
<content type='text'>
This adds a selftest to check that the verifier rejects a TCP CC struct_ops
with a non-GPL license.

Signed-off-by: Toke Høiland-Jørgensen &lt;toke@redhat.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/20210326100314.121853-2-toke@redhat.com
</content>
</entry>
<entry>
<title>selftests/bpf: Add selftest for pointer-to-array-of-struct BTF dump</title>
<updated>2021-03-19T21:14:44Z</updated>
<author>
<name>Jean-Philippe Brucker</name>
</author>
<published>2021-03-19T11:25:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f118aac651d87c1811d2abd940f73c45c16b29d7'/>
<id>urn:sha1:f118aac651d87c1811d2abd940f73c45c16b29d7</id>
<content type='text'>
Bpftool used to issue forward declarations for a struct used as part of
a pointer to array, which is invalid. Add a test to check that the
struct is fully defined in this case:

	@@ -134,9 +134,9 @@
	 	};
	 };

	-struct struct_in_array {};
	+struct struct_in_array;

	-struct struct_in_array_typed {};
	+struct struct_in_array_typed;

	 typedef struct struct_in_array_typed struct_in_array_t[2];

	@@ -189,3 +189,7 @@
	 	struct struct_with_embedded_stuff _14;
	 };

	+struct struct_in_array {};
	+
	+struct struct_in_array_typed {};
	+
	...
	#13/1 btf_dump: syntax:FAIL

Suggested-by: Andrii Nakryiko &lt;andrii.nakryiko@gmail.com&gt;
Signed-off-by: Jean-Philippe Brucker &lt;jean-philippe@linaro.org&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20210319112554.794552-3-jean-philippe@linaro.org
</content>
</entry>
<entry>
<title>selftest/bpf: Add a test to check trampoline freeing logic.</title>
<updated>2021-03-18T16:13:42Z</updated>
<author>
<name>Alexei Starovoitov</name>
</author>
<published>2021-03-18T00:45:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=eddbe8e6521401003e37e7848ef72e75c10ee2aa'/>
<id>urn:sha1:eddbe8e6521401003e37e7848ef72e75c10ee2aa</id>
<content type='text'>
Add a selftest for commit e21aa341785c ("bpf: Fix fexit trampoline.")
to make sure that attaching fexit prog to a sleeping kernel function
will trigger appropriate trampoline and program destruction.

Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Link: https://lore.kernel.org/bpf/20210318004523.55908-1-alexei.starovoitov@gmail.com
</content>
</entry>
<entry>
<title>selftests/bpf: Set gopt opt_class to 0 if get tunnel opt failed</title>
<updated>2021-03-15T16:28:58Z</updated>
<author>
<name>Hangbin Liu</name>
</author>
<published>2021-03-09T03:22:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=31254dc9566221429d2cfb45fd5737985d70f2b6'/>
<id>urn:sha1:31254dc9566221429d2cfb45fd5737985d70f2b6</id>
<content type='text'>
When fixing the bpf test_tunnel.sh geneve failure. I only fixed the IPv4
part but forgot the IPv6 issue. Similar with the IPv4 fixes 557c223b643a
("selftests/bpf: No need to drop the packet when there is no geneve opt"),
when there is no tunnel option and bpf_skb_get_tunnel_opt() returns error,
there is no need to drop the packets and break all geneve rx traffic.
Just set opt_class to 0 and keep returning TC_ACT_OK at the end.

Fixes: 557c223b643a ("selftests/bpf: No need to drop the packet when there is no geneve opt")
Fixes: 933a741e3b82 ("selftests/bpf: bpf tunnel test.")
Signed-off-by: Hangbin Liu &lt;liuhangbin@gmail.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: William Tu &lt;u9012063@gmail.com&gt;
Link: https://lore.kernel.org/bpf/20210309032214.2112438-1-liuhangbin@gmail.com
</content>
</entry>
<entry>
<title>selftests/bpf: Tests using bpf_check_mtu BPF-helper input mtu_len param</title>
<updated>2021-03-08T21:45:56Z</updated>
<author>
<name>Jesper Dangaard Brouer</name>
</author>
<published>2021-03-08T14:59:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e5e010a3063ad801cb3f85793cbada9c2a654e40'/>
<id>urn:sha1:e5e010a3063ad801cb3f85793cbada9c2a654e40</id>
<content type='text'>
Add tests that use mtu_len as input parameter in BPF-helper
bpf_check_mtu().

The BPF-helper is avail from both XDP and TC context. Add two tests
per context, one that tests below MTU and one that exceeds the MTU.

Signed-off-by: Jesper Dangaard Brouer &lt;brouer@redhat.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/161521556358.3515614.5915221479709358964.stgit@firesoul
</content>
</entry>
<entry>
<title>selftests/bpf: Use the last page in test_snprintf_btf on s390</title>
<updated>2021-03-02T10:30:59Z</updated>
<author>
<name>Ilya Leoshkevich</name>
</author>
<published>2021-02-27T05:17:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=42a382a466a967dc053c73b969cd2ac2fec502cf'/>
<id>urn:sha1:42a382a466a967dc053c73b969cd2ac2fec502cf</id>
<content type='text'>
test_snprintf_btf fails on s390, because NULL points to a readable
struct lowcore there. Fix by using the last page instead.

Error message example:

    printing fffffffffffff000 should generate error, got (361)

Fixes: 076a95f5aff2 ("selftests/bpf: Add bpf_snprintf_btf helper tests")
Signed-off-by: Ilya Leoshkevich &lt;iii@linux.ibm.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Heiko Carstens &lt;hca@linux.ibm.com&gt;
Acked-by: Yonghong Song &lt;yhs@fb.com&gt;
Link: https://lore.kernel.org/bpf/20210227051726.121256-1-iii@linux.ibm.com
</content>
</entry>
<entry>
<title>selftests/bpf: No need to drop the packet when there is no geneve opt</title>
<updated>2021-02-24T20:28:30Z</updated>
<author>
<name>Hangbin Liu</name>
</author>
<published>2021-02-24T08:14:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=557c223b643a35effec9654958d8edc62fd2603a'/>
<id>urn:sha1:557c223b643a35effec9654958d8edc62fd2603a</id>
<content type='text'>
In bpf geneve tunnel test we set geneve option on tx side. On rx side we
only call bpf_skb_get_tunnel_opt(). Since commit 9c2e14b48119 ("ip_tunnels:
Set tunnel option flag when tunnel metadata is present") geneve_rx() will
not add TUNNEL_GENEVE_OPT flag if there is no geneve option, which cause
bpf_skb_get_tunnel_opt() return ENOENT and _geneve_get_tunnel() in
test_tunnel_kern.c drop the packet.

As it should be valid that bpf_skb_get_tunnel_opt() return error when
there is not tunnel option, there is no need to drop the packet and
break all geneve rx traffic. Just set opt_class to 0 in this test and
keep returning TC_ACT_OK.

Fixes: 933a741e3b82 ("selftests/bpf: bpf tunnel test.")
Signed-off-by: Hangbin Liu &lt;liuhangbin@gmail.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: William Tu &lt;u9012063@gmail.com&gt;
Link: https://lore.kernel.org/bpf/20210224081403.1425474-1-liuhangbin@gmail.com
</content>
</entry>
<entry>
<title>selftests/bpf: Fix a compiler warning in global func test</title>
<updated>2021-02-24T15:48:16Z</updated>
<author>
<name>Dmitrii Banshchikov</name>
</author>
<published>2021-02-23T08:22:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c41d81bfbb4579c3e583457e383dd63d026bf947'/>
<id>urn:sha1:c41d81bfbb4579c3e583457e383dd63d026bf947</id>
<content type='text'>
Add an explicit 'const void *' cast to pass program ctx pointer type into
a global function that expects pointer to structure.

warning: incompatible pointer types
passing 'struct __sk_buff *' to parameter of type 'const struct S *'
[-Wincompatible-pointer-types]
        return foo(skb);
                   ^~~
progs/test_global_func11.c:10:36: note: passing argument to parameter 's' here
__noinline int foo(const struct S *s)
                                   ^

Fixes: 8b08807d039a ("selftests/bpf: Add unit tests for pointers in global functions")
Signed-off-by: Dmitrii Banshchikov &lt;me@ubique.spb.ru&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Link: https://lore.kernel.org/bpf/20210223082211.302596-1-me@ubique.spb.ru
</content>
</entry>
<entry>
<title>selftests/bpf: Add unit tests for pointers in global functions</title>
<updated>2021-02-13T01:37:23Z</updated>
<author>
<name>Dmitrii Banshchikov</name>
</author>
<published>2021-02-12T20:56:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8b08807d039a843163fd4aeca93aec69dfc4fbcf'/>
<id>urn:sha1:8b08807d039a843163fd4aeca93aec69dfc4fbcf</id>
<content type='text'>
test_global_func9  - check valid pointer's scenarios
test_global_func10 - check that a smaller type cannot be passed as a
                     larger one
test_global_func11 - check that CTX pointer cannot be passed
test_global_func12 - check access to a null pointer
test_global_func13 - check access to an arbitrary pointer value
test_global_func14 - check that an opaque pointer cannot be passed
test_global_func15 - check that a variable has an unknown value after
		     it was passed to a global function by pointer
test_global_func16 - check access to uninitialized stack memory

test_global_func_args - check read and write operations through a pointer

Signed-off-by: Dmitrii Banshchikov &lt;me@ubique.spb.ru&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Acked-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20210212205642.620788-5-me@ubique.spb.ru
</content>
</entry>
</feed>
