mbox series

[0/6] BTF ABI

Message ID 20210611153319.778996-1-gprocida@google.com
Headers show
Series BTF ABI | expand

Message

Giuliano Procida June 11, 2021, 3:33 p.m. UTC
Hi.

This code was developed by Maria Teguiani who interned with Android
last summer and later by me.

BTF is the BPF type format.

See: https://www.kernel.org/doc/html/latest/bpf/btf.html

The Linux kernel can be compiled with BTF type information. Together
with the kernel and ELF symtabs, it can be used to as an alternative
basis for kernel ABI monitoring.

BTF has several limitations compared with libabigail ABI XML.
Foremost, it supports C types only. There are also some other
significant issues that may be resolved with time. The simplicity of
BTF makes it an ideal vehicle for experimentation.

An ELF object file containing DWARF debug information can be augmented
with BTF debug information using pahole -J. pahole is part of dwarves.

These patches contribute:

- a BTF parser / BTF graph builder
- code to dump BTF information as it is parsed
- a BTF graph difference algorithm to generate graphs of differences
- a C type name generator
- code to serialise a difference graph as a text report

The graph difference algorithm uses a strongly-connected component
finder based on the path-based SCC algorithm. My main contribution
here was the design which allows the BTF graph difference algorithm to
be written in a straightforward recursive style.

Missing from these patches are:

- Some documentation I wrote in markdown format.
- A suite of small tests, of which the C language ones have been used to
  validate the BTF utilities.

I hope this work will be useful to anyone wishing to experiment with
BTF as an ABI representation or who has an interest in graph diff
algorithms.

Feedback is very welcome.

Regards,
Giuliano.

Giuliano Procida (6):
  Tweak clang-format
  Allow C++17 code to be compiled
  BTF: add SCC finder and test
  BTF: add core functionality
  BTF: add btfinfo and btfdiff tools
  BTF: clang-format all the new source files

 .clang-format     |    9 +-
 COMPILING         |    5 +
 configure.ac      |   21 +-
 include/abg-btf.h |  888 ++++++++++++++++++++++++
 include/abg-scc.h |  122 ++++
 src/Makefile.am   |    9 +-
 src/abg-btf.cc    | 1649 +++++++++++++++++++++++++++++++++++++++++++++
 tests/Makefile.am |    7 +
 tests/test-scc.cc |  220 ++++++
 tools/Makefile.am |   14 +
 tools/btfdiff.cc  |   71 ++
 tools/btfinfo.cc  |   22 +
 12 files changed, 3034 insertions(+), 3 deletions(-)
 create mode 100644 include/abg-btf.h
 create mode 100644 include/abg-scc.h
 create mode 100644 src/abg-btf.cc
 create mode 100644 tests/test-scc.cc
 create mode 100644 tools/btfdiff.cc
 create mode 100644 tools/btfinfo.cc