<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/samples/bpf, branch v6.2</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=v6.2</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2022-11-24T23:21:29Z</updated>
<entry>
<title>samples/bpf: Fix wrong allocation size in xdp_router_ipv4_user</title>
<updated>2022-11-24T23:21:29Z</updated>
<author>
<name>Rong Tao</name>
<email>rongtao@cestc.cn</email>
</author>
<published>2022-11-22T02:32:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=19a2bdbaaddc71405494bd35fa034d9cf582b05e'/>
<id>urn:sha1:19a2bdbaaddc71405494bd35fa034d9cf582b05e</id>
<content type='text'>
prefix_key-&gt;data allocates three bytes using alloca(), but four bytes are
actually accessed in the program.

Signed-off-by: Rong Tao &lt;rongtao@cestc.cn&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Link: https://lore.kernel.org/bpf/tencent_F9E2E81922B0C181D05B96DAE5AB0ACE6B06@qq.com
</content>
</entry>
<entry>
<title>bpf, samples: Use "grep -E" instead of "egrep"</title>
<updated>2022-11-18T22:55:02Z</updated>
<author>
<name>Tiezhu Yang</name>
<email>yangtiezhu@loongson.cn</email>
</author>
<published>2022-11-18T09:50:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ee748cd95e3adf4acdb05194b2ea68e4073e09b6'/>
<id>urn:sha1:ee748cd95e3adf4acdb05194b2ea68e4073e09b6</id>
<content type='text'>
The latest version of grep (3.8+) claims the egrep is now obsolete so the
build now contains warnings that look like:

  egrep: warning: egrep is obsolescent; using grep -E

Fix this up by moving the related file to use "grep -E" instead.

Signed-off-by: Tiezhu Yang &lt;yangtiezhu@loongson.cn&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Jiri Olsa &lt;jolsa@kernel.org&gt;
Link: https://lore.kernel.org/bpf/1668765001-12477-1-git-send-email-yangtiezhu@loongson.cn
</content>
</entry>
<entry>
<title>samples/bpf: Fix sockex3 error: Missing BPF prog type</title>
<updated>2022-11-08T01:13:35Z</updated>
<author>
<name>Rong Tao</name>
<email>rongtao@cestc.cn</email>
</author>
<published>2022-11-05T06:48:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e5659e4e19e49f1eac58bb07ce8bc2d78a89fe65'/>
<id>urn:sha1:e5659e4e19e49f1eac58bb07ce8bc2d78a89fe65</id>
<content type='text'>
since commit 450b167fb9be("libbpf: clean up SEC() handling"),
sec_def_matches() does not recognize "socket/xxx" as "socket", therefore,
the BPF program type is not recognized.

Instead of sockex3_user.c parsing section names to get the BPF program fd.
We use the program array map to assign a static index to each BPF program
(get inspired by selftests/bpf progs/test_prog_array_init.c).
Therefore, use SEC("socket") as section name instead of SEC("socket/xxx"),
so that the BPF program is parsed to SOCKET_FILTER type. The "missing BPF
prog type" problem is solved.

How to reproduce this error:
$ cd samples/bpf
$ sudo ./sockex3
libbpf: prog 'bpf_func_PARSE_IP': missing BPF prog type, check ELF section name 'socket/3'
libbpf: prog 'bpf_func_PARSE_IP': failed to load: -22
libbpf: failed to load object './sockex3_kern.o'
ERROR: loading BPF object file failed

Signed-off-by: Rong Tao &lt;rongtao@cestc.cn&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/tencent_EBA3C18864069E42175946973C2ACBAF5408@qq.com
</content>
</entry>
<entry>
<title>samples/bpf: Fix tracex2 error: No such file or directory</title>
<updated>2022-11-04T21:57:31Z</updated>
<author>
<name>Rong Tao</name>
<email>rongtao@cestc.cn</email>
</author>
<published>2022-10-29T09:11:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1baa7e38002111aee62b489ac343960ae75ce2e9'/>
<id>urn:sha1:1baa7e38002111aee62b489ac343960ae75ce2e9</id>
<content type='text'>
since commit c504e5c2f964("net: skb: introduce kfree_skb_reason()")
kfree_skb() is replaced by kfree_skb_reason() and kfree_skb() is set to
the inline function. So, we replace kprobe/kfree_skb with
kprobe/kfree_skb_reason to solve the tracex2 error.

 $ cd samples/bpf
 $ sudo ./tracex2
 libbpf: prog 'bpf_prog2': failed to create kprobe 'kfree_skb+0x0' perf event: No such file or directory
 ERROR: bpf_program__attach failed

Signed-off-by: Rong Tao &lt;rongtao@cestc.cn&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/tencent_0F0DAE84C0B3C42E0B550E5E9F47A9114D09@qq.com
</content>
</entry>
<entry>
<title>samples/bpf: Fix typo in README</title>
<updated>2022-11-01T14:25:21Z</updated>
<author>
<name>Kang Minchul</name>
<email>tegongkang@gmail.com</email>
</author>
<published>2022-10-30T18:02:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3a07dcf8f57b9a90b1c07df3e9091fd04baa3036'/>
<id>urn:sha1:3a07dcf8f57b9a90b1c07df3e9091fd04baa3036</id>
<content type='text'>
Fix 'cofiguration' typo in BPF samples README.

Signed-off-by: Kang Minchul &lt;tegongkang@gmail.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Link: https://lore.kernel.org/bpf/20221030180254.34138-1-tegongkang@gmail.com
</content>
</entry>
<entry>
<title>samples/bpf: Fix typos in README</title>
<updated>2022-10-19T18:30:09Z</updated>
<author>
<name>Daniel Müller</name>
<email>deso@posteo.net</email>
</author>
<published>2022-10-18T16:32:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2c4d72d66b548f1404ff43c01b7b81f4c4c6fafd'/>
<id>urn:sha1:2c4d72d66b548f1404ff43c01b7b81f4c4c6fafd</id>
<content type='text'>
This change fixes some typos found in the BPF samples README file.

Signed-off-by: Daniel Müller &lt;deso@posteo.net&gt;
Acked-by: David Vernet &lt;void@manifault.com&gt;
Link: https://lore.kernel.org/r/20221018163231.1926462-1-deso@posteo.net
Signed-off-by: Martin KaFai Lau &lt;martin.lau@kernel.org&gt;
</content>
</entry>
<entry>
<title>samples/bpf: Fix double word in comments</title>
<updated>2022-10-19T18:21:49Z</updated>
<author>
<name>Shaomin Deng</name>
<email>dengshaomin@cdjrlc.com</email>
</author>
<published>2022-10-17T14:23:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=01dea9548f6c88dc23dc5916eecd3555b82c8fec'/>
<id>urn:sha1:01dea9548f6c88dc23dc5916eecd3555b82c8fec</id>
<content type='text'>
Remove the repeated word "by" in comments.

Signed-off-by: Shaomin Deng &lt;dengshaomin@cdjrlc.com&gt;
Link: https://lore.kernel.org/r/20221017142303.8299-1-dengshaomin@cdjrlc.com
Signed-off-by: Martin KaFai Lau &lt;martin.lau@kernel.org&gt;
</content>
</entry>
<entry>
<title>samples/bpf: Fix MAC address swapping in xdp2_kern</title>
<updated>2022-10-19T18:06:29Z</updated>
<author>
<name>Gerhard Engleder</name>
<email>gerhard@engleder-embedded.com</email>
</author>
<published>2022-10-15T21:30:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7a698edf954cb3f8b6e8dacdb77615355170420c'/>
<id>urn:sha1:7a698edf954cb3f8b6e8dacdb77615355170420c</id>
<content type='text'>
xdp2_kern rewrites and forwards packets out on the same interface.
Forwarding still works but rewrite got broken when xdp multibuffer
support has been added.

With xdp multibuffer a local copy of the packet has been introduced. The
MAC address is now swapped in the local copy, but the local copy in not
written back.

Fix MAC address swapping be adding write back of modified packet.

Fixes: 772251742262 ("samples/bpf: fixup some tools to be able to support xdp multibuffer")
Signed-off-by: Gerhard Engleder &lt;gerhard@engleder-embedded.com&gt;
Reviewed-by: Andy Gospodarek &lt;gospo@broadcom.com&gt;
Link: https://lore.kernel.org/r/20221015213050.65222-1-gerhard@engleder-embedded.com
Signed-off-by: Martin KaFai Lau &lt;martin.lau@kernel.org&gt;
</content>
</entry>
<entry>
<title>samples/bpf: Fix map iteration in xdp1_user</title>
<updated>2022-10-19T17:56:21Z</updated>
<author>
<name>Gerhard Engleder</name>
<email>gerhard@engleder-embedded.com</email>
</author>
<published>2022-10-13T20:09:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=05ee658c654bacda03f7fecef367e62aaf8e1cfe'/>
<id>urn:sha1:05ee658c654bacda03f7fecef367e62aaf8e1cfe</id>
<content type='text'>
BPF map iteration in xdp1_user results in endless loop without any
output, because the return value of bpf_map_get_next_key() is checked
against the wrong value.

Other call locations of bpf_map_get_next_key() check for equal 0 for
continuing the iteration. xdp1_user checks against unequal -1. This is
wrong for a function which can return arbitrary negative errno values,
because a return value of e.g. -2 results in an endless loop.

With this fix xdp1_user is printing statistics again:
proto 0:          1 pkt/s
proto 0:          1 pkt/s
proto 17:     107383 pkt/s
proto 17:     881655 pkt/s
proto 17:     882083 pkt/s
proto 17:     881758 pkt/s

Fixes: bd054102a8c7 ("libbpf: enforce strict libbpf 1.0 behaviors")
Signed-off-by: Gerhard Engleder &lt;gerhard@engleder-embedded.com&gt;
Acked-by: Song Liu &lt;song@kernel.org&gt;
Link: https://lore.kernel.org/r/20221013200922.17167-1-gerhard@engleder-embedded.com
Signed-off-by: Martin KaFai Lau &lt;martin.lau@kernel.org&gt;
</content>
</entry>
<entry>
<title>samples/bpf: Fix typo in xdp_router_ipv4 sample</title>
<updated>2022-09-30T22:04:23Z</updated>
<author>
<name>Deming Wang</name>
<email>wangdeming@inspur.com</email>
</author>
<published>2022-09-27T19:25:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b59cc7fcbaebde52ed97f63c6c50e49b8dd5be37'/>
<id>urn:sha1:b59cc7fcbaebde52ed97f63c6c50e49b8dd5be37</id>
<content type='text'>
Fix typo in xdp_router_ipv4 sample.

Signed-off-by: Deming Wang &lt;wangdeming@inspur.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20220927192527.8722-1-wangdeming@inspur.com
</content>
</entry>
</feed>
