platform_system_bpf/libbpf_android
Maciej Żenczykowski aa295c8355 implement support for functions which may optionally fail to load
This is useful for critical functions with fallbacks, but
may even be useful for non-critical functions, where a function
in the middle of the file may fail to load, but you still want
other (later) functions to be attempted.

Critical applies to the entire .c file (or to be more correct to
the entire resulting .o).  Optional applies to a specific section
of that .o (ie. a specific individual function).

This new optional attribute is necessary to be able to declare
a .c/.o file critical even if *some* of the individual functions
might fail to load due to missing kernel patches.

(Note: we currently have no way to specify a map as optional)

Critical guarantees that all non-optional programs, and all maps,
have been created, pinned, chowned, and chmoded successfully
(or that they already existed).

For an example of use see:
  system/netd/bpf_progs/offload.c

(while at it also add retrieveProgram() and mapRetrieve{RW,RO,WO}()
 helpers to BpfUtils.h)

Test: builds, atest, see paired netd change for extra details
Bug: 150040815
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I50b292c061b05fc8f4b4b8574f128345c45c78db
2020-06-17 10:44:19 +00:00
..
include implement support for functions which may optionally fail to load 2020-06-17 10:44:19 +00:00
Android.bp libbpf_android: remove libnetdutils dep 2020-01-21 10:47:33 -08:00
BpfLoadTest.cpp Warn loudly and do not set bpf.progs_loaded property on critical bpf load failure. 2020-06-15 08:01:50 +00:00
BpfMapTest.cpp More missing calls to Result::ok() in libbpf_android tests 2020-02-10 07:28:13 +09:00
BpfUtils.cpp change to ro.kernel.ebpf.supported property 2020-04-23 18:36:56 -07:00
Loader.cpp implement support for functions which may optionally fail to load 2020-06-17 10:44:19 +00:00
LoaderUtils.h add support for marking ebpf programs as being only for some kernel versions 2020-02-19 15:46:23 -08:00
TEST_MAPPING TEST_MAPPING += libbpf_android_test 2020-01-15 08:28:44 +00:00