<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/tools/lib/bpf, branch v5.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=v5.2</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2019-06-06T23:53:12Z</updated>
<entry>
<title>bpf, libbpf: enable recvmsg attach types</title>
<updated>2019-06-06T23:53:12Z</updated>
<author>
<name>Daniel Borkmann</name>
<email>daniel@iogearbox.net</email>
</author>
<published>2019-06-06T23:48:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9bb59ac1f6c362f14b58187bc56e737780c52c19'/>
<id>urn:sha1:9bb59ac1f6c362f14b58187bc56e737780c52c19</id>
<content type='text'>
Another trivial patch to libbpf in order to enable identifying and
attaching programs to BPF_CGROUP_UDP{4,6}_RECVMSG by section name.

Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>libbpf: Return btf_fd for load_sk_storage_btf</title>
<updated>2019-06-01T00:03:39Z</updated>
<author>
<name>Michal Rostecki</name>
<email>mrostecki@opensuse.org</email>
</author>
<published>2019-05-29T18:31:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=cfd4921049269ee6765b4a1cb820b95d0df5dda5'/>
<id>urn:sha1:cfd4921049269ee6765b4a1cb820b95d0df5dda5</id>
<content type='text'>
Before this change, function load_sk_storage_btf expected that
libbpf__probe_raw_btf was returning a BTF descriptor, but in fact it was
returning an information about whether the probe was successful (0 or
1). load_sk_storage_btf was using that value as an argument of the close
function, which was resulting in closing stdout and thus terminating the
process which called that function.

That bug was visible in bpftool. `bpftool feature` subcommand was always
exiting too early (because of closed stdout) and it didn't display all
requested probes. `bpftool -j feature` or `bpftool -p feature` were not
returning a valid json object.

This change renames the libbpf__probe_raw_btf function to
libbpf__load_raw_btf, which now returns a BTF descriptor, as expected in
load_sk_storage_btf.

v2:
- Fix typo in the commit message.

v3:
- Simplify BTF descriptor handling in bpf_object__probe_btf_* functions.
- Rename libbpf__probe_raw_btf function to libbpf__load_raw_btf and
return a BTF descriptor.

v4:
- Fix typo in the commit message.

Fixes: d7c4b3980c18 ("libbpf: detect supported kernel BTF features and sanitize BTF")
Signed-off-by: Michal Rostecki &lt;mrostecki@opensuse.org&gt;
Acked-by: Andrii Nakryiko &lt;andriin@fb.com&gt;
Acked-by: Song Liu &lt;songliubraving@fb.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>libbpf: move logging helpers into libbpf_internal.h</title>
<updated>2019-05-16T19:47:47Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andriin@fb.com</email>
</author>
<published>2019-05-16T03:39:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d72386fe7a8472f859333b078fd8bb9d254d51f2'/>
<id>urn:sha1:d72386fe7a8472f859333b078fd8bb9d254d51f2</id>
<content type='text'>
libbpf_util.h header was recently exposed as public as a dependency of
xsk.h. In addition to memory barriers, it contained logging helpers,
which are not supposed to be exposed. This patch moves those into
libbpf_internal.h, which is kept as an internal header.

Cc: Stanislav Fomichev &lt;sdf@google.com&gt;
Cc: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Fixes: 7080da890984 ("libbpf: add libbpf_util.h to header install.")
Signed-off-by: Andrii Nakryiko &lt;andriin@fb.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>libbpf: don't fail when feature probing fails</title>
<updated>2019-05-15T23:32:19Z</updated>
<author>
<name>Stanislav Fomichev</name>
<email>sdf@google.com</email>
</author>
<published>2019-05-15T03:38:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=15ea164ef11abc0a2d3001ca40e5e509cd06091f'/>
<id>urn:sha1:15ea164ef11abc0a2d3001ca40e5e509cd06091f</id>
<content type='text'>
Otherwise libbpf is unusable from unprivileged process with
kernel.kernel.unprivileged_bpf_disabled=1.
All I get is EPERM from the probes, even if I just want to
open an ELF object and look at what progs/maps it has.

Instead of dying on probes, let's just pr_debug the error and
try to continue.

Signed-off-by: Stanislav Fomichev &lt;sdf@google.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
<entry>
<title>libbpf: detect supported kernel BTF features and sanitize BTF</title>
<updated>2019-05-12T23:31:20Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andriin@fb.com</email>
</author>
<published>2019-05-10T21:13:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d7c4b3980c18e81c0470f5df6d96d832f446d26f'/>
<id>urn:sha1:d7c4b3980c18e81c0470f5df6d96d832f446d26f</id>
<content type='text'>
Depending on used versions of libbpf, Clang, and kernel, it's possible to
have valid BPF object files with valid BTF information, that still won't
load successfully due to Clang emitting newer BTF features (e.g.,
BTF_KIND_FUNC, .BTF.ext's line_info/func_info, BTF_KIND_DATASEC, etc), that
are not yet supported by older kernel.

This patch adds detection of BTF features and sanitizes BPF object's BTF
by substituting various supported BTF kinds, which have compatible layout:
  - BTF_KIND_FUNC -&gt; BTF_KIND_TYPEDEF
  - BTF_KIND_FUNC_PROTO -&gt; BTF_KIND_ENUM
  - BTF_KIND_VAR -&gt; BTF_KIND_INT
  - BTF_KIND_DATASEC -&gt; BTF_KIND_STRUCT

Replacement is done in such a way as to preserve as much information as
possible (names, sizes, etc) where possible without violating kernel's
validation rules.

v2-&gt;v3:
  - remove duplicate #defines from libbpf_util.h

v1-&gt;v2:
  - add internal libbpf_internal.h w/ common stuff
  - switch SK storage BTF to use new libbpf__probe_raw_btf()

Reported-by: Alexei Starovoitov &lt;ast@fb.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andriin@fb.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
<entry>
<title>libbpf: remove unnecessary cast-to-void</title>
<updated>2019-05-06T09:35:17Z</updated>
<author>
<name>Björn Töpel</name>
<email>bjorn.topel@intel.com</email>
</author>
<published>2019-05-06T09:24:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d24ed99b3b270c6de8f47c25d709b5f6ef7d3807'/>
<id>urn:sha1:d24ed99b3b270c6de8f47c25d709b5f6ef7d3807</id>
<content type='text'>
The patches with fixes tags added a cast-to-void in the places when
the return value of a function was ignored.

This is not common practice in the kernel, and is therefore removed in
this patch.

Reported-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Fixes: 5750902a6e9b ("libbpf: proper XSKMAP cleanup")
Fixes: 0e6741f09297 ("libbpf: fix invalid munmap call")
Signed-off-by: Björn Töpel &lt;bjorn.topel@intel.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
</content>
</entry>
<entry>
<title>libbpf: add libbpf_util.h to header install.</title>
<updated>2019-05-05T07:06:59Z</updated>
<author>
<name>William Tu</name>
<email>u9012063@gmail.com</email>
</author>
<published>2019-05-02T18:33:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7080da8909844602b650c8959ecd7814d2829ea5'/>
<id>urn:sha1:7080da8909844602b650c8959ecd7814d2829ea5</id>
<content type='text'>
The libbpf_util.h is used by xsk.h, so add it to
the install headers.

Reported-by: Ben Pfaff &lt;blp@ovn.org&gt;
Signed-off-by: William Tu &lt;u9012063@gmail.com&gt;
Acked-by: Yonghong Song &lt;yhs@fb.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>tools/bpf: fix perf build error with uClibc (seen on ARC)</title>
<updated>2019-05-05T07:04:01Z</updated>
<author>
<name>Vineet Gupta</name>
<email>Vineet.Gupta1@synopsys.com</email>
</author>
<published>2019-05-02T15:56:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ca31ca8247e2d3807ff5fa1d1760616a2292001c'/>
<id>urn:sha1:ca31ca8247e2d3807ff5fa1d1760616a2292001c</id>
<content type='text'>
When build perf for ARC recently, there was a build failure due to lack
of __NR_bpf.

| Auto-detecting system features:
|
| ...                     get_cpuid: [ OFF ]
| ...                           bpf: [ on  ]
|
| #  error __NR_bpf not defined. libbpf does not support your arch.
    ^~~~~
| bpf.c: In function 'sys_bpf':
| bpf.c:66:17: error: '__NR_bpf' undeclared (first use in this function)
|  return syscall(__NR_bpf, cmd, attr, size);
|                 ^~~~~~~~
|                 sys_bpf

Signed-off-by: Vineet Gupta &lt;vgupta@synopsys.com&gt;
Acked-by: Yonghong Song &lt;yhs@fb.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>libbpf: proper XSKMAP cleanup</title>
<updated>2019-05-05T06:26:22Z</updated>
<author>
<name>Björn Töpel</name>
<email>bjorn.topel@intel.com</email>
</author>
<published>2019-04-30T12:45:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5750902a6e9bc6adb77da8257c0e34db2bfdebb2'/>
<id>urn:sha1:5750902a6e9bc6adb77da8257c0e34db2bfdebb2</id>
<content type='text'>
The bpf_map_update_elem() function, when used on an XSKMAP, will fail
if not a valid AF_XDP socket is passed as value. Therefore, this is
function cannot be used to clear the XSKMAP. Instead, the
bpf_map_delete_elem() function should be used for that.

This patch also simplifies the code by breaking up
xsk_update_bpf_maps() into three smaller functions.

Reported-by: William Tu &lt;u9012063@gmail.com&gt;
Fixes: 1cad07884239 ("libbpf: add support for using AF_XDP sockets")
Signed-off-by: Björn Töpel &lt;bjorn.topel@intel.com&gt;
Tested-by: William Tu &lt;u9012063@gmail.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>libbpf: fix invalid munmap call</title>
<updated>2019-05-05T06:26:22Z</updated>
<author>
<name>Björn Töpel</name>
<email>bjorn.topel@intel.com</email>
</author>
<published>2019-04-30T12:45:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0e6741f092979535d159d5a851f12c88bfb7cb9a'/>
<id>urn:sha1:0e6741f092979535d159d5a851f12c88bfb7cb9a</id>
<content type='text'>
When unmapping the AF_XDP memory regions used for the rings, an
invalid address was passed to the munmap() calls. Instead of passing
the beginning of the memory region, the descriptor region was passed
to munmap.

When the userspace application tried to tear down an AF_XDP socket,
the operation failed and the application would still have a reference
to socket it wished to get rid of.

Reported-by: William Tu &lt;u9012063@gmail.com&gt;
Fixes: 1cad07884239 ("libbpf: add support for using AF_XDP sockets")
Signed-off-by: Björn Töpel &lt;bjorn.topel@intel.com&gt;
Tested-by: William Tu &lt;u9012063@gmail.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
</feed>
