<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/tools/lib/bpf/btf_dump.c, branch linux-5.16.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.16.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.16.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2022-04-08T12:06:12Z</updated>
<entry>
<title>libbpf: Skip forward declaration when counting duplicated type names</title>
<updated>2022-04-08T12:06:12Z</updated>
<author>
<name>Xu Kuohai</name>
</author>
<published>2022-03-01T05:32:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=346eb815e8593106dc1453168222d3b3c2e8e39d'/>
<id>urn:sha1:346eb815e8593106dc1453168222d3b3c2e8e39d</id>
<content type='text'>
[ Upstream commit 4226961b0019b2e1612029e8950a9e911affc995 ]

Currently if a declaration appears in the BTF before the definition, the
definition is dumped as a conflicting name, e.g.:

    $ bpftool btf dump file vmlinux format raw | grep "'unix_sock'"
    [81287] FWD 'unix_sock' fwd_kind=struct
    [89336] STRUCT 'unix_sock' size=1024 vlen=14

    $ bpftool btf dump file vmlinux format c | grep "struct unix_sock"
    struct unix_sock;
    struct unix_sock___2 {	&lt;--- conflict, the "___2" is unexpected
		    struct unix_sock___2 *unix_sk;

This causes a compilation error if the dump output is used as a header file.

Fix it by skipping declaration when counting duplicated type names.

Fixes: 351131b51c7a ("libbpf: add btf_dump API for BTF-to-C conversion")
Signed-off-by: Xu Kuohai &lt;xukuohai@huawei.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Song Liu &lt;songliubraving@fb.com&gt;
Link: https://lore.kernel.org/bpf/20220301053250.1464204-2-xukuohai@huawei.com
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>libbpf: Fix compilation warning due to mismatched printf format</title>
<updated>2022-04-08T12:06:05Z</updated>
<author>
<name>Andrii Nakryiko</name>
</author>
<published>2022-02-09T06:39:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e696ed9f7d7796efa27f4b5404cd57fb6f49ed96'/>
<id>urn:sha1:e696ed9f7d7796efa27f4b5404cd57fb6f49ed96</id>
<content type='text'>
[ Upstream commit dc37dc617fabfb1c3a16d49f5d8cc20e9e3608ca ]

On ppc64le architecture __s64 is long int and requires %ld. Cast to
ssize_t and use %zd to avoid architecture-specific specifiers.

Fixes: 4172843ed4a3 ("libbpf: Fix signedness bug in btf_dump_array_data()")
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Link: https://lore.kernel.org/bpf/20220209063909.1268319-1-andrii@kernel.org
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>libbpf: Fix signedness bug in btf_dump_array_data()</title>
<updated>2022-04-08T12:06:05Z</updated>
<author>
<name>Dan Carpenter</name>
</author>
<published>2022-02-08T07:15:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=db930b62d03fa22dd0432f5303e10314d7794b7c'/>
<id>urn:sha1:db930b62d03fa22dd0432f5303e10314d7794b7c</id>
<content type='text'>
[ Upstream commit 4172843ed4a38f97084032f74f07b2037b5da3a6 ]

The btf__resolve_size() function returns negative error codes so
"elem_size" must be signed for the error handling to work.

Fixes: 920d16af9b42 ("libbpf: BTF dumper support for typed data")
Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Yonghong Song &lt;yhs@fb.com&gt;
Link: https://lore.kernel.org/bpf/20220208071552.GB10495@kili
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>libbpf: Silence uninitialized warning/error in btf_dump_dump_type_data</title>
<updated>2022-01-27T11:01:35Z</updated>
<author>
<name>Alan Maguire</name>
</author>
<published>2021-11-29T10:00:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3b96878b06c414047134afbda2e0508f67419c6c'/>
<id>urn:sha1:3b96878b06c414047134afbda2e0508f67419c6c</id>
<content type='text'>
[ Upstream commit 43174f0d4597325cb91f1f1f55263eb6e6101036 ]

When compiling libbpf with gcc 4.8.5, we see:

  CC       staticobjs/btf_dump.o
btf_dump.c: In function ‘btf_dump_dump_type_data.isra.24’:
btf_dump.c:2296:5: error: ‘err’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  if (err &lt; 0)
     ^
cc1: all warnings being treated as errors
make: *** [staticobjs/btf_dump.o] Error 1

While gcc 4.8.5 is too old to build the upstream kernel, it's possible it
could be used to build standalone libbpf which suffers from the same problem.
Silence the error by initializing 'err' to 0.  The warning/error seems to be
a false positive since err is set early in the function.  Regardless we
shouldn't prevent libbpf from building for this.

Fixes: 920d16af9b42 ("libbpf: BTF dumper support for typed data")
Signed-off-by: Alan Maguire &lt;alan.maguire@oracle.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/1638180040-8037-1-git-send-email-alan.maguire@oracle.com
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>libbpf: Use __BYTE_ORDER__</title>
<updated>2021-10-26T03:39:41Z</updated>
<author>
<name>Ilya Leoshkevich</name>
</author>
<published>2021-10-26T01:08:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3930198dc9a0720a2b6561c67e55859ec51b73f9'/>
<id>urn:sha1:3930198dc9a0720a2b6561c67e55859ec51b73f9</id>
<content type='text'>
Use the compiler-defined __BYTE_ORDER__ instead of the libc-defined
__BYTE_ORDER for consistency.

Signed-off-by: Ilya Leoshkevich &lt;iii@linux.ibm.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20211026010831.748682-3-iii@linux.ibm.com
</content>
</entry>
<entry>
<title>libbpf: Add btf__type_cnt() and btf__raw_data() APIs</title>
<updated>2021-10-22T23:09:14Z</updated>
<author>
<name>Hengqi Chen</name>
</author>
<published>2021-10-22T13:06:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6a886de070fad850d6cb74a787c9ed017303d9ac'/>
<id>urn:sha1:6a886de070fad850d6cb74a787c9ed017303d9ac</id>
<content type='text'>
Add btf__type_cnt() and btf__raw_data() APIs and deprecate
btf__get_nr_type() and btf__get_raw_data() since the old APIs
don't follow the libbpf naming convention for getters which
omit 'get' in the name (see [0]). btf__raw_data() is just an
alias to the existing btf__get_raw_data(). btf__type_cnt()
now returns the number of all types of the BTF object
including 'void'.

  [0] Closes: https://github.com/libbpf/libbpf/issues/279

Signed-off-by: Hengqi Chen &lt;hengqi.chen@gmail.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20211022130623.1548429-2-hengqi.chen@gmail.com
</content>
</entry>
<entry>
<title>libbpf: Fix the use of aligned attribute</title>
<updated>2021-10-22T21:24:36Z</updated>
<author>
<name>Andrii Nakryiko</name>
</author>
<published>2021-10-22T19:25:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fae1b05e6f0acf116f6450535b0e1c13051102d3'/>
<id>urn:sha1:fae1b05e6f0acf116f6450535b0e1c13051102d3</id>
<content type='text'>
Building libbpf sources out of kernel tree (in Github repo) we run into
compilation error due to unknown __aligned attribute. It must be coming
from some kernel header, which is not available to Github sources. Use
explicit __attribute__((aligned(16))) instead.

Fixes: 961632d54163 ("libbpf: Fix dumping non-aligned __int128")
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20211022192502.2975553-1-andrii@kernel.org
</content>
</entry>
<entry>
<title>libbpf: Fix ptr_is_aligned() usages</title>
<updated>2021-10-21T22:50:04Z</updated>
<author>
<name>Ilya Leoshkevich</name>
</author>
<published>2021-10-21T10:46:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=632f96d2652e0d4188de837f88a977eedb55aee1'/>
<id>urn:sha1:632f96d2652e0d4188de837f88a977eedb55aee1</id>
<content type='text'>
Currently ptr_is_aligned() takes size, and not alignment, as a
parameter, which may be overly pessimistic e.g. for __i128 on s390,
which must be only 8-byte aligned. Fix by using btf__align_of().

Signed-off-by: Ilya Leoshkevich &lt;iii@linux.ibm.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20211021104658.624944-2-iii@linux.ibm.com
</content>
</entry>
<entry>
<title>libbpf: Fix dumping non-aligned __int128</title>
<updated>2021-10-20T18:40:45Z</updated>
<author>
<name>Ilya Leoshkevich</name>
</author>
<published>2021-10-13T16:09:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=961632d5416389a6f2e7478b674ac645c7e3ff01'/>
<id>urn:sha1:961632d5416389a6f2e7478b674ac645c7e3ff01</id>
<content type='text'>
Non-aligned integers are dumped as bitfields, which is supported for at
most 64-bit integers. Fix by using the same trick as
btf_dump_float_data(): copy non-aligned values to the local buffer.

Signed-off-by: Ilya Leoshkevich &lt;iii@linux.ibm.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20211013160902.428340-4-iii@linux.ibm.com
</content>
</entry>
<entry>
<title>libbpf: Fix dumping big-endian bitfields</title>
<updated>2021-10-20T18:40:01Z</updated>
<author>
<name>Ilya Leoshkevich</name>
</author>
<published>2021-10-13T16:09:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c9e982b879465ca74e3593ce82808aa259265a71'/>
<id>urn:sha1:c9e982b879465ca74e3593ce82808aa259265a71</id>
<content type='text'>
On big-endian arches not only bytes, but also bits are numbered in
reverse order (see e.g. S/390 ELF ABI Supplement, but this is also true
for other big-endian arches as well).

Signed-off-by: Ilya Leoshkevich &lt;iii@linux.ibm.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20211013160902.428340-3-iii@linux.ibm.com
</content>
</entry>
</feed>
