<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/tools/bpf/resolve_btfids, branch linux-5.13.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.13.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.13.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2021-07-14T15:07:07Z</updated>
<entry>
<title>bpf: Fix libelf endian handling in resolv_btfids</title>
<updated>2021-07-14T15:07:07Z</updated>
<author>
<name>Tony Ambardar</name>
</author>
<published>2021-06-18T06:14:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3cb841954361cb296f22e1f00d2532c4feb870d6'/>
<id>urn:sha1:3cb841954361cb296f22e1f00d2532c4feb870d6</id>
<content type='text'>
[ Upstream commit 61e8aeda9398925f8c6fc290585bdd9727d154c4 ]

The vmlinux ".BTF_ids" ELF section is declared in btf_ids.h to hold a list
of zero-filled BTF IDs, which is then patched at link-time with correct
values by resolv_btfids. The section is flagged as "allocable" to preclude
compression, but notably the section contents (BTF IDs) are untyped.

When patching the BTF IDs, resolve_btfids writes in host-native endianness
and relies on libelf for any required translation on reading and updating
vmlinux. However, since the type of the .BTF_ids section content defaults
to ELF_T_BYTE (i.e. unsigned char), no translation occurs. This results in
incorrect patched values when cross-compiling to non-native endianness,
and can manifest as kernel Oops and test failures which are difficult to
troubleshoot [1].

Explicitly set the type of patched data to ELF_T_WORD, the architecture-
neutral ELF type corresponding to the u32 BTF IDs. This enables libelf to
transparently perform any needed endian conversions.

Fixes: fbbb68de80a4 ("bpf: Add resolve_btfids tool to resolve BTF IDs in ELF object")
Signed-off-by: Tony Ambardar &lt;Tony.Ambardar@gmail.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Jiri Olsa &lt;jolsa@redhat.com&gt;
Cc: Frank Eigler &lt;fche@redhat.com&gt;
Cc: Mark Wielaard &lt;mark@klomp.org&gt;
Cc: Jiri Olsa &lt;jolsa@kernel.org&gt;
Cc: Yonghong Song &lt;yhs@fb.com&gt;
Link: https://lore.kernel.org/bpf/CAPGftE_eY-Zdi3wBcgDfkz_iOr1KF10n=9mJHm1_a_PykcsoeA@mail.gmail.com [1]
Link: https://lore.kernel.org/bpf/20210618061404.818569-1-Tony.Ambardar@gmail.com
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>tools/resolve_btfids: Fix warnings</title>
<updated>2021-03-31T19:09:12Z</updated>
<author>
<name>Stanislav Fomichev</name>
</author>
<published>2021-03-29T22:31:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e27bfefb21f28d5295432f042b5d9d7871100c35'/>
<id>urn:sha1:e27bfefb21f28d5295432f042b5d9d7871100c35</id>
<content type='text'>
* make eprintf static, used only in main.c
* initialize ret in eprintf
* remove unused *tmp

v3:
* remove another err (Song Liu)

v2:
* remove unused 'int err = -1'

Signed-off-by: Stanislav Fomichev &lt;sdf@google.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Song Liu &lt;songliubraving@fb.com&gt;
Link: https://lore.kernel.org/bpf/20210329223143.3659983-1-sdf@google.com
</content>
</entry>
<entry>
<title>tools/resolve_btfids: Fix build error with older host toolchains</title>
<updated>2021-02-24T16:19:11Z</updated>
<author>
<name>Kun-Chuan Hsieh</name>
</author>
<published>2021-02-24T05:27:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=41462c6e730ca0e63f5fed5a517052385d980c54'/>
<id>urn:sha1:41462c6e730ca0e63f5fed5a517052385d980c54</id>
<content type='text'>
Older libelf.h and glibc elf.h might not yet define the ELF compression
types.

Checking and defining SHF_COMPRESSED fix the build error when compiling
with older toolchains. Also, the tool resolve_btfids is compiled with host
toolchain. The host toolchain is more likely to be older than the cross
compile toolchain.

Fixes: 51f6463aacfb ("tools/resolve_btfids: Fix sections with wrong alignment")
Signed-off-by: Kun-Chuan Hsieh &lt;jetswayss@gmail.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Jiri Olsa &lt;jolsa@redhat.com&gt;
Link: https://lore.kernel.org/bpf/20210224052752.5284-1-jetswayss@gmail.com
</content>
</entry>
<entry>
<title>tools/resolve_btfids: Add /libbpf to .gitignore</title>
<updated>2021-02-12T21:08:26Z</updated>
<author>
<name>Stanislav Fomichev</name>
</author>
<published>2021-02-12T01:00:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=90a82b1fa40d0cee33d1c9306dc54412442d1e57'/>
<id>urn:sha1:90a82b1fa40d0cee33d1c9306dc54412442d1e57</id>
<content type='text'>
This is what I see after compiling the kernel:

 # bpf-next...bpf-next/master
 ?? tools/bpf/resolve_btfids/libbpf/

Fixes: fc6b48f692f8 ("tools/resolve_btfids: Build libbpf and libsubcmd in separate directories")
Signed-off-by: Stanislav Fomichev &lt;sdf@google.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20210212010053.668700-1-sdf@google.com
</content>
</entry>
<entry>
<title>tools/resolve_btfids: Set srctree variable unconditionally</title>
<updated>2021-02-09T05:21:39Z</updated>
<author>
<name>Jiri Olsa</name>
</author>
<published>2021-02-05T12:40:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7962cb9b640af98ccb577f46c8b894319e6c5c20'/>
<id>urn:sha1:7962cb9b640af98ccb577f46c8b894319e6c5c20</id>
<content type='text'>
We want this clean to be called from tree's root Makefile,
which defines same srctree variable and that will screw
the make setup.

We actually do not use srctree being passed from outside,
so we can solve this by setting current srctree value
directly.

Also changing the way how srctree is initialized as suggested
by Andrri.

Also root Makefile does not define the implicit RM variable,
so adding RM initialization.

Signed-off-by: Jiri Olsa &lt;jolsa@kernel.org&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20210205124020.683286-4-jolsa@kernel.org
</content>
</entry>
<entry>
<title>tools/resolve_btfids: Check objects before removing</title>
<updated>2021-02-09T05:21:39Z</updated>
<author>
<name>Jiri Olsa</name>
</author>
<published>2021-02-05T12:40:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f23130979c2f15ea29a431cd9e1ea7916337bbd4'/>
<id>urn:sha1:f23130979c2f15ea29a431cd9e1ea7916337bbd4</id>
<content type='text'>
We want this clean to be called from tree's root clean
and that one is silent if there's nothing to clean.

Adding check for all object to clean and display CLEAN
messages only if there are objects to remove.

Signed-off-by: Jiri Olsa &lt;jolsa@kernel.org&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20210205124020.683286-3-jolsa@kernel.org
</content>
</entry>
<entry>
<title>tools/resolve_btfids: Build libbpf and libsubcmd in separate directories</title>
<updated>2021-02-09T05:21:39Z</updated>
<author>
<name>Jiri Olsa</name>
</author>
<published>2021-02-05T12:40:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fc6b48f692f89cc48bfb7fd1aa65454dfe9b2d77'/>
<id>urn:sha1:fc6b48f692f89cc48bfb7fd1aa65454dfe9b2d77</id>
<content type='text'>
Setting up separate build directories for libbpf and libpsubcmd,
so it's separated from other objects and we don't get them mixed
in the future.

It also simplifies cleaning, which is now simple rm -rf.

Also there's no need for FEATURE-DUMP.libbpf and bpf_helper_defs.h
files in .gitignore anymore.

Signed-off-by: Jiri Olsa &lt;jolsa@kernel.org&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Song Liu &lt;songliubraving@fb.com&gt;
Acked-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20210205124020.683286-2-jolsa@kernel.org
</content>
</entry>
<entry>
<title>tools/resolve_btfids: Warn when having multiple IDs for single type</title>
<updated>2021-01-06T02:11:55Z</updated>
<author>
<name>Jiri Olsa</name>
</author>
<published>2021-01-05T23:42:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=67208692802ce3cacfa00fe586dc0cb1bef0a51c'/>
<id>urn:sha1:67208692802ce3cacfa00fe586dc0cb1bef0a51c</id>
<content type='text'>
The kernel image can contain multiple types (structs/unions)
with the same name. This causes distinct type hierarchies in
BTF data and makes resolve_btfids fail with error like:

  BTFIDS  vmlinux
FAILED unresolved symbol udp6_sock

as reported by Qais Yousef [1].

This change adds warning when multiple types of the same name
are detected:

  BTFIDS  vmlinux
WARN: multiple IDs found for 'file': 526, 113351 - using 526
WARN: multiple IDs found for 'sk_buff': 2744, 113958 - using 2744

We keep the lower ID for the given type instance and let the
build continue.

Also changing the 'nr' variable name to 'nr_types' to avoid confusion.

[1] https://lore.kernel.org/lkml/20201229151352.6hzmjvu3qh6p2qgg@e107158-lin/

Signed-off-by: Jiri Olsa &lt;jolsa@kernel.org&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/20210105234219.970039-1-jolsa@kernel.org
</content>
</entry>
<entry>
<title>tools/resolve_btfids: Fix some error messages</title>
<updated>2020-12-03T18:25:47Z</updated>
<author>
<name>Brendan Jackman</name>
</author>
<published>2020-12-03T10:22:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=22e8ebe35a2e30ee19e02c41cacc99c2f896bc4b'/>
<id>urn:sha1:22e8ebe35a2e30ee19e02c41cacc99c2f896bc4b</id>
<content type='text'>
Add missing newlines and fix polarity of strerror argument.

Signed-off-by: Brendan Jackman &lt;jackmanb@google.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Acked-by: Jiri Olsa &lt;jolsa@redhat.com&gt;
Link: https://lore.kernel.org/bpf/20201203102234.648540-1-jackmanb@google.com
</content>
</entry>
<entry>
<title>tools: Factor HOSTCC, HOSTLD, HOSTAR definitions</title>
<updated>2020-11-11T20:18:22Z</updated>
<author>
<name>Jean-Philippe Brucker</name>
</author>
<published>2020-11-10T16:43:05Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c8a950d0d3b926a02c7b2e713850d38217cec3d1'/>
<id>urn:sha1:c8a950d0d3b926a02c7b2e713850d38217cec3d1</id>
<content type='text'>
Several Makefiles in tools/ need to define the host toolchain variables.
Move their definition to tools/scripts/Makefile.include

Signed-off-by: Jean-Philippe Brucker &lt;jean-philippe@linaro.org&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Jiri Olsa &lt;jolsa@redhat.com&gt;
Acked-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Link: https://lore.kernel.org/bpf/20201110164310.2600671-2-jean-philippe@linaro.org
</content>
</entry>
</feed>
