linux-stable/tools
Andrii Nakryiko 4fb877aaa1 libbpf: Fix btf_dump's packed struct determination
Fix bug in btf_dump's logic of determining if a given struct type is
packed or not. The notion of "natural alignment" is not needed and is
even harmful in this case, so drop it altogether. The biggest difference
in btf_is_struct_packed() compared to its original implementation is
that we don't really use btf__align_of() to determine overall alignment
of a struct type (because it could be 1 for both packed and non-packed
struct, depending on specifci field definitions), and just use field's
actual alignment to calculate whether any field is requiring packing or
struct's size overall necessitates packing.

Add two simple test cases that demonstrate the difference this change
would make.

Fixes: ea2ce1ba99 ("libbpf: Fix BTF-to-C converter's padding logic")
Reported-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/bpf/20221215183605.4149488-1-andrii@kernel.org
2022-12-15 22:50:17 +01:00
..
accounting tools/accounting/procacct: remove some unused variables 2022-11-18 13:55:09 -08:00
arch platform-drivers-x86 for v6.2-1 2022-12-12 10:47:10 -08:00
bootconfig
bpf bpftool: Fix memory leak in do_build_table_cb 2022-12-06 21:20:42 +01:00
build perf bpf: Fix build with libbpf 0.7.0 by checking if bpf_program__set_insns() is available 2022-10-25 17:40:48 -03:00
certs
cgroup
counter
debugging
edid
firewire
firmware
gpio
hv
iio tools: iio: iio_generic_buffer: Fix read size 2022-11-01 08:48:13 +00:00
include bpf: Rework process_dynptr_func 2022-12-08 18:25:31 -08:00
io_uring
kvm/kvm_stat tools/kvm_stat: update exit reasons for vmx/svm/aarch64/userspace 2022-11-09 12:26:52 -05:00
laptop
leds
lib libbpf: Fix btf_dump's packed struct determination 2022-12-15 22:50:17 +01:00
memory-model tools/memory-model: Weaken ctrl dependency definition in explanation.txt 2022-10-18 15:14:52 -07:00
objtool objtool, kcsan: Add volatile read/write instrumentation to whitelist 2022-10-18 15:07:33 -07:00
pci
pcmcia
perf Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-11-17 18:30:39 -08:00
power ACPI updates for 6.2-rc1 2022-12-12 13:38:17 -08:00
rcu
scripts
spi
testing libbpf: Fix btf_dump's packed struct determination 2022-12-15 22:50:17 +01:00
thermal
time
tracing rtla: Fix exit status when returning from calls to usage() 2022-12-09 18:06:24 -05:00
usb
verification Documentation/rv: Add verification/rv man pages 2022-12-09 18:06:24 -05:00
virtio
vm slab updates for 6.2-rc1 2022-12-12 09:13:06 -08:00
wmi
Makefile