This allows it to be used from outside this header file,
and provides slightly more type safety.
Test: TreeHugger
Bug: 286369326
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I98e5e37a002188813b602e51fd4fcbb9ca4466cc
This implements the bare minimum to read from BPF ring buffers in
userspace. The implementation uses two shared memory regions with
atomic-like access. Currently, the class only guarantees that the
element type has the same size (later can add btf support).
The alternative would be to use libbpf or bcc, but since this is a small
header-only library that seemed like it could end up being more
difficulty than it was worth.
Bug: 246985031
Test: atest libbpf_android_test
Change-Id: I7f08e76db9cb9672ef66c629bccb3db63d3c2229
This will allow healthd to filter uevent packets, if needed
Bug: 203462310
Test: Ensure that healthd can build if it uses bpf filters
Change-Id: I97bfe9509a6934444f656508176495bba38381be
The art apex already has access to bpf_headers which includes bpf_syscall_wrappers,
but this extra line is needed to switch it away from needlessly linking libbpf_android.
Since these are header files only, this annotation is kind of pointless,
but it does turn out to be needed...
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I9e4d3373cea488080304e31ed7c8708aec988933
this doesn't appear to make sense now that it's available to vendors
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: If2d24fa8eccfb5c12832fb191a8560b024751db7
Attach bpf program to cgroup with flags, support 'BPF_F_ALLOW_OVERRIDE'
and 'BPF_F_ALLOW_MULTI'; corresponding to detach a single bpf program in
a cgroup.
Test: m
Signed-off-by: KaiWen Zheng <zhengkaiwen5@xiaomi.corp-partner.google.com>
Change-Id: I9a4d2dcb249c6c628e3f1287d7d5d1879b722bd6
Correct the indentation style of libclat in the follows
bpf_headers/Android.bp
bpf_syscall_wrappers/Android.bp
Test: build
Change-Id: I7cdd354141124fa8f7b4a864ddd937bef4676302
Needed because ClatdController and clatd binary are moved
into apex. libclat is used for accessing BPF map.
Bug: 212345928
Test: manual test
1. Connect to ipv6-only wifi.
2. Try IPv4 traffic.
$ ping 8.8.8.8
Change-Id: I95a1c21927ba95f6094152e1013761d79c73e981
retrieveProgram() in bpf_syscall_wrappers is used by libnetd_mainline.
Bug: 202086915
Test: m; flash; boot
Change-Id: I69573a6925fd9f5fcd65935d681e7a340ee73f17
The FUSE daemon in MediaProvider needs to access the file descriptor of
its pinned BPF program.
The BPF syscall wrappers are handy and would avoid code duplication,
thus extend this project visibility to MediaProvider.
Bug: 202785178
Test: adb logcat FuseDaemon:V \*:S (in git_master)
Signed-off-by: Alessio Balsini <balsini@google.com>
Change-Id: I406c760bb96d74597ca7d8f701cd12c3bd318f68
Multiple packages need access to bpf maps. Moving to common
location to allow access from all necessary packages.
Test: atest BpfMapTest
Bug: 179733303
Change-Id: Idae7b620c15c781b2e7980c3a3157f396cfaf66e
Export BPF headers to connectivity service for use with
VendorConnectivityService aidl.
Bug: 179733303
Change-Id: Ibc098facde54aeb621e53b73ac59eb6416ba9ebb
LMKD needs access to map_gpu_mem_gpu_mem_total_map
BPF map to record the total size of GPU allocations
at the time of a kill. Change bpf_syscall_wrappers
visibility to allow lmkd to use bpf_syscall_wrappers
library.
Bug: 189366037
Test: lmkd_unit_test
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Ia1f75852a853f62b504351271119714f3fd95232
This isn't new code, this is basically copied verbatim from
//system/bpf/libbpf_android/include/bpf/BpfUtils.h
Test: atest BpfMapTest, TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I80523c9ee0c1e4431f3192eb409ad68c737390a6