As reported in [0], kernel and userspace can sometimes disagree on the definition of a typedef (in particular, the size). This leads to trouble when userspace maps the memory of a bpf program and reads/writes to it assuming a different memory layout. This series resolves most int-like typedefs and rewrites them as standard int16_t-like types. In particular, we don't touch __u32-like types, char, and _Bool, as changing them changes cast semantics and would break too many pre-existing programs. For example, int8_t* is not convertible to char* because int8_t is explicitly signed. [0]: https://github.com/iovisor/bcc/pull/3777 Delyan Kratunov (3): libbpf: btf_dump can produce explicitly sized ints bpftool: skeleton uses explicitly sized ints selftests/bpf: add test case for userspace and bpf type size mismatch tools/bpf/bpftool/gen.c | 3 + tools/lib/bpf/btf.h | 4 +- tools/lib/bpf/btf_dump.c | 80 ++++++++++++++++++- .../selftests/bpf/prog_tests/skeleton.c | 22 +++-- .../selftests/bpf/progs/test_skeleton.c | 8 ++ 5 files changed, 107 insertions(+), 10 deletions(-) -- 2.34.1