[PATCH bpf-next] libbpf: fix printf formatter for ptrdiff_t argument

2019-04-16 Thread andrii.nakryiko
From: Andrii Nakryiko Using %ld for printing out value of ptrdiff_t type is not portable between 32-bit and 64-bit archs. This is causing compilation errors for libbpf on 32-bit platform (discovered as part of an effort to integrate libbpf into systemd ([0])). Proper formatter is %td, which is us

[PATCH bpf-next] libbpf: fix printf formatter for ptrdiff_t argument

2019-04-16 Thread andrii.nakryiko
From: Andrii Nakryiko Using %ld for printing out value of ptrdiff_t type is not portable between 32-bit and 64-bit archs. This is causing compilation errors for libbpf on 32-bit platform. Proper formatter is %td, which is used in this patch. Cc: Daniel Borkmann Cc: Alexei Starovoitov Cc: Yongh

[PATCH bpf-next 2/2] selftests/btf: add VAR and DATASEC case for dedup tests

2019-04-15 Thread andrii.nakryiko
From: Andrii Nakryiko Add test case verifying that dedup happens (INTs are deduped in this case) and VAR/DATASEC types are not deduped, but have their referenced type IDs adjusted correctly. Cc: Daniel Borkmann Cc: Yonghong Song Cc: Alexei Starovoitov Signed-off-by: Andrii Nakryiko --- tool

[PATCH bpf-next 0/2] add btf_dedup() support for VAR and DATASEC

2019-04-15 Thread andrii.nakryiko
From: Andrii Nakryiko This patchset adds support for new BTF_KIND_VAR and BTF_KIND_DATASEC BTF types in btf_dedup() algorithm. VAR and DATASEC are not deduplicated and are always considered to be unique, but they require referenced type IDs adjustment. Patch #1 adds VAR/DATASEC pass-through supp

[PATCH bpf-next 1/2] btf: add support for VAR and DATASEC in btf_dedup()

2019-04-15 Thread andrii.nakryiko
From: Andrii Nakryiko This patch adds support for VAR and DATASEC in btf_dedup(). VAR/DATASEC are never deduplicated, but they need to be processed anyway as types they refer to might need to be remapped due to deduplication and compaction. Cc: Daniel Borkmann Cc: Yonghong Song Cc: Alexei Star

[PATCH bpf-next] kbuild: handle old pahole more gracefully when generating BTF

2019-04-15 Thread andrii.nakryiko
From: Andrii Nakryiko When CONFIG_DEBUG_INFO_BTF is enabled but available version of pahole is too old to support BTF generation, build script is supposed to emit warning and proceed with the build. Due to using exit instead of return from BASH function, existing handling code prematurely exits e

[PATCH bpf-next] kbuild: add ability to generate BTF type info for vmlinux

2019-04-02 Thread andrii.nakryiko
From: Andrii Nakryiko This patch adds new config option to trigger generation of BTF type information from DWARF debuginfo for vmlinux and kernel modules through pahole, which in turn relies on libbpf for btf_dedup() algorithm. The intent is to record compact type information of all types used i

[PATCH bpf 1/2] libbpf: fix btf_dedup equivalence check handling of different kinds

2019-03-26 Thread andrii.nakryiko
From: Andrii Nakryiko btf_dedup_is_equiv() used to compare btf_type->info fields, before doing kind-specific equivalence check. This comparsion implicitly verified that candidate and canonical types are of the same kind. With enum fwd resolution logic this check couldn't be done generically anymo

[PATCH bpf 2/2] selftests/bpf: add btf_dedup test for VOID equivalence check

2019-03-26 Thread andrii.nakryiko
From: Andrii Nakryiko This patch adds specific test exposing bug in btf_dedup_is_equiv() when comparing candidate VOID type to a non-VOID canonical type. It's important for canonical type to be anonymous, otherwise name equality check will do the right thing and will exit early. Signed-off-by: A

[PATCH bpf 0/2] fix btf_dedup()'s type graph equivalence check

2019-03-26 Thread andrii.nakryiko
From: Andrii Nakryiko This patch set fixes bug in btf_dedup_is_equiv() check mishandling equivalence comparison between VOID kind in candidate type graph versus anonymous non-VOID kind in canonical type graph. Patch #1 fixes bug, by comparing candidate and canonical kinds for equality, before pr