<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/tools/testing/selftests/bpf/test_sockmap.c, branch linux-6.10.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.10.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.10.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2024-08-03T06:59:36Z</updated>
<entry>
<title>selftests/bpf: Check length of recv in test_sockmap</title>
<updated>2024-08-03T06:59:36Z</updated>
<author>
<name>Geliang Tang</name>
</author>
<published>2024-05-23T06:50:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=bd334e2f45a813c270776583d3a97b31a2979191'/>
<id>urn:sha1:bd334e2f45a813c270776583d3a97b31a2979191</id>
<content type='text'>
[ Upstream commit de1b5ea789dc28066cc8dc634b6825bd6148f38b ]

The value of recv in msg_loop may be negative, like EWOULDBLOCK, so it's
necessary to check if it is positive before accumulating it to bytes_recvd.

Fixes: 16962b2404ac ("bpf: sockmap, add selftests")
Signed-off-by: Geliang Tang &lt;tanggeliang@kylinos.cn&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Tested-by: Jakub Sitnicki &lt;jakub@cloudflare.com&gt;
Acked-by: John Fastabend &lt;john.fastabend@gmail.com&gt;
Link: https://lore.kernel.org/bpf/5172563f7c7b2a2e953cef02e89fc34664a7b190.1716446893.git.tanggeliang@kylinos.cn
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests/bpf: Fix prog numbers in test_sockmap</title>
<updated>2024-08-03T06:59:32Z</updated>
<author>
<name>Geliang Tang</name>
</author>
<published>2024-05-17T06:21:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=eab9ecfa8ed3da7fe724ce5516948d116fdbc481'/>
<id>urn:sha1:eab9ecfa8ed3da7fe724ce5516948d116fdbc481</id>
<content type='text'>
[ Upstream commit 6c8d7598dfed759bf1d9d0322b4c2b42eb7252d8 ]

bpf_prog5 and bpf_prog7 are removed from progs/test_sockmap_kern.h in
commit d79a32129b21 ("bpf: Selftests, remove prints from sockmap tests"),
now there are only 9 progs in it, not 11:

	SEC("sk_skb1")
	int bpf_prog1(struct __sk_buff *skb)
	SEC("sk_skb2")
	int bpf_prog2(struct __sk_buff *skb)
	SEC("sk_skb3")
	int bpf_prog3(struct __sk_buff *skb)
	SEC("sockops")
	int bpf_sockmap(struct bpf_sock_ops *skops)
	SEC("sk_msg1")
	int bpf_prog4(struct sk_msg_md *msg)
	SEC("sk_msg2")
	int bpf_prog6(struct sk_msg_md *msg)
	SEC("sk_msg3")
	int bpf_prog8(struct sk_msg_md *msg)
	SEC("sk_msg4")
	int bpf_prog9(struct sk_msg_md *msg)
	SEC("sk_msg5")
	int bpf_prog10(struct sk_msg_md *msg)

This patch updates the array sizes of prog_fd[], prog_attach_type[] and
prog_type[] from 11 to 9 accordingly.

Fixes: d79a32129b21 ("bpf: Selftests, remove prints from sockmap tests")
Signed-off-by: Geliang Tang &lt;tanggeliang@kylinos.cn&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/9c10d9f974f07fcb354a43a8eca67acb2fafc587.1715926605.git.tanggeliang@kylinos.cn
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests/bpf: Free strdup memory in test_sockmap</title>
<updated>2024-04-29T23:17:15Z</updated>
<author>
<name>Geliang Tang</name>
</author>
<published>2024-04-29T07:07:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=237c522c1d5d19e8d3057a38ce690c753020c7d1'/>
<id>urn:sha1:237c522c1d5d19e8d3057a38ce690c753020c7d1</id>
<content type='text'>
The strdup() function returns a pointer to a new string which is a
duplicate of the string "ptr". Memory for the new string is obtained
with malloc(), and need to be freed with free().

This patch adds these missing "free(ptr)" in check_whitelist() and
check_blacklist() to avoid memory leaks in test_sockmap.c.

Signed-off-by: Geliang Tang &lt;tanggeliang@kylinos.cn&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Yonghong Song &lt;yonghong.song@linux.dev&gt;
Acked-by: John Fastabend &lt;john.fastabend@gmail.com&gt;
Link: https://lore.kernel.org/bpf/b76f2f4c550aebe4ab8ea73d23c4cbe4f06ea996.1714374022.git.tanggeliang@kylinos.cn
</content>
</entry>
<entry>
<title>selftests/bpf: Fix umount cgroup2 error in test_sockmap</title>
<updated>2024-04-11T17:29:25Z</updated>
<author>
<name>Geliang Tang</name>
</author>
<published>2024-04-09T05:18:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d75142dbeb2bd1587b9cc19f841578f541275a64'/>
<id>urn:sha1:d75142dbeb2bd1587b9cc19f841578f541275a64</id>
<content type='text'>
This patch fixes the following "umount cgroup2" error in test_sockmap.c:

 (cgroup_helpers.c:353: errno: Device or resource busy) umount cgroup2

Cgroup fd cg_fd should be closed before cleanup_cgroup_environment().

Fixes: 13a5f3ffd202 ("bpf: Selftests, sockmap test prog run without setting cgroup")
Signed-off-by: Geliang Tang &lt;tanggeliang@kylinos.cn&gt;
Acked-by: Yonghong Song &lt;yonghong.song@linux.dev&gt;
Link: https://lore.kernel.org/r/0399983bde729708773416b8488bac2cd5e022b8.1712639568.git.tanggeliang@kylinos.cn
Signed-off-by: Martin KaFai Lau &lt;martin.lau@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests/bpf: Add ingress tests for txmsg with apply_bytes</title>
<updated>2022-12-01T00:07:41Z</updated>
<author>
<name>Pengcheng Yang</name>
</author>
<published>2022-11-29T10:40:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=89903dcb3c2e134fb101de7921a19dd9f8418b4c'/>
<id>urn:sha1:89903dcb3c2e134fb101de7921a19dd9f8418b4c</id>
<content type='text'>
Currently, the ingress redirect is not covered in "txmsg test apply".

Signed-off-by: Pengcheng Yang &lt;yangpc@wangsu.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Jakub Sitnicki &lt;jakub@cloudflare.com&gt;
Link: https://lore.kernel.org/bpf/1669718441-2654-5-git-send-email-yangpc@wangsu.com
</content>
</entry>
<entry>
<title>selftests/bpf: Add wait send memory test for sockmap redirect</title>
<updated>2022-09-26T15:45:31Z</updated>
<author>
<name>Liu Jian</name>
</author>
<published>2022-08-23T13:37:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=043a7356dbd0f44b2a2161649d89f4a43f3b0180'/>
<id>urn:sha1:043a7356dbd0f44b2a2161649d89f4a43f3b0180</id>
<content type='text'>
Add one test for wait redirect sock's send memory test for sockmap.

Signed-off-by: Liu Jian &lt;liujian56@huawei.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/20220823133755.314697-3-liujian56@huawei.com
</content>
</entry>
<entry>
<title>selftests/bpf: Store BPF object files with .bpf.o extension</title>
<updated>2022-09-02T13:55:37Z</updated>
<author>
<name>Daniel Müller</name>
</author>
<published>2022-09-01T22:22:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=afef88e65554c3e8691513b8350d6445e292560e'/>
<id>urn:sha1:afef88e65554c3e8691513b8350d6445e292560e</id>
<content type='text'>
BPF object files are, in a way, the final artifact produced as part of
the ahead-of-time compilation process. That makes them somewhat special
compared to "regular" object files, which are a intermediate build
artifacts that can typically be removed safely. As such, it can make
sense to name them differently to make it easier to spot this difference
at a glance.

Among others, libbpf-bootstrap [0] has established the extension .bpf.o
for BPF object files. It seems reasonable to follow this example and
establish the same denomination for selftest build artifacts. To that
end, this change adjusts the corresponding part of the build system and
the test programs loading BPF object files to work with .bpf.o files.

  [0] https://github.com/libbpf/libbpf-bootstrap

Suggested-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Signed-off-by: Daniel Müller &lt;deso@posteo.net&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Link: https://lore.kernel.org/bpf/20220901222253.1199242-1-deso@posteo.net
</content>
</entry>
<entry>
<title>selftests/bpf: Use libbpf 1.0 API mode instead of RLIMIT_MEMLOCK</title>
<updated>2022-04-11T03:17:16Z</updated>
<author>
<name>Yafang Shao</name>
</author>
<published>2022-04-09T12:59:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b858ba8c52b64c038de156c455a39a89bfd214e8'/>
<id>urn:sha1:b858ba8c52b64c038de156c455a39a89bfd214e8</id>
<content type='text'>
We have switched to memcg-based memory accouting and thus the rlimit is
not needed any more. LIBBPF_STRICT_AUTO_RLIMIT_MEMLOCK was introduced in
libbpf for backward compatibility, so we can use it instead now. After
this change, the header tools/testing/selftests/bpf/bpf_rlimit.h can be
removed.

This patch also removes the useless header sys/resource.h from many files
in tools/testing/selftests/bpf/.

Signed-off-by: Yafang Shao &lt;laoar.shao@gmail.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20220409125958.92629-3-laoar.shao@gmail.com
</content>
</entry>
<entry>
<title>selftests/bpf: Clean up array_size.cocci warnings</title>
<updated>2022-03-15T16:03:10Z</updated>
<author>
<name>Guo Zhengkui</name>
</author>
<published>2022-03-15T13:01:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f98d6dd1e79d4b04c2e13e91a9348473cfa805a6'/>
<id>urn:sha1:f98d6dd1e79d4b04c2e13e91a9348473cfa805a6</id>
<content type='text'>
Clean up the array_size.cocci warnings under tools/testing/selftests/bpf/:

Use `ARRAY_SIZE(arr)` instead of forms like `sizeof(arr)/sizeof(arr[0])`.

tools/testing/selftests/bpf/test_cgroup_storage.c uses ARRAY_SIZE() defined
in tools/include/linux/kernel.h (sys/sysinfo.h -&gt; linux/kernel.h), while
others use ARRAY_SIZE() in bpf_util.h.

Signed-off-by: Guo Zhengkui &lt;guozhengkui@vivo.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Link: https://lore.kernel.org/bpf/20220315130143.2403-1-guozhengkui@vivo.com
</content>
</entry>
<entry>
<title>selftests, bpf: Add one test for sockmap with strparser</title>
<updated>2021-11-01T16:08:21Z</updated>
<author>
<name>Liu Jian</name>
</author>
<published>2021-10-29T14:12:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d69672147faa2a7671c0779fa5b9ad99e4fca4e3'/>
<id>urn:sha1:d69672147faa2a7671c0779fa5b9ad99e4fca4e3</id>
<content type='text'>
Add the test to check sockmap with strparser is working well.

Signed-off-by: Liu Jian &lt;liujian56@huawei.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/20211029141216.211899-3-liujian56@huawei.com
</content>
</entry>
</feed>
