bpfloader: load map BTF via btfloader

btfloader uses upstream libbpf & libelf to parse the BTF sections of a
bpf .o file, load BTF information into the kernel, and identify the
BTF type ids corresponding to each map's keys and values.

Extend bpfloader to run btfloader on any .o file with a .BTF
section. We pass btfloader socket and pipe fds, which it will use to
send back a BTF fd and the key & value type ids, respectively.

To ensure a btfloader bug can't block bpfloader indefinitely, wait for
btfloader to run with a short timeout and use nonblocking socket &
pipe for communication.

Finally, add a check to BpfLoadTest to verify that map BTF is loaded
as expected.

Test: build & boot; existing programs load successfully
Test: libbpf_load_test
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: I7bac83a08c2dc452bdb9030f1e74781116c1dd5c
3 files changed
tree: 1addf60d269a6bff12b5c8b79e104adf288dfc61
  1. bpfloader/
  2. libbpf_android/
  3. progs/
  4. Android.bp
  5. NOTICE
  6. OWNERS
  7. OWNERS_bpf
  8. PREUPLOAD.cfg