(due to switch to bpfloader from loading via netd)
Test: build, atest
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ic95cdfde26b8e7b905551a7fd2b465e0cf99bbce
Creating a function for this rather than having people copy/paste a loop
there.
It's very intentional that there is no timeout here. If bpfloader is
down, there is a serious problem, and we shouldn't let code move forward
in a state where it may not have been tested.
Bug: 140330870
Test: boot & use bpf/netd
Change-Id: I358d1fcf77ad5406e294dd57307bc411e2c8ad6a
Currently, if a bpf program object has no map section, this error is
propagated, and the program will fail to load. However, it is desirable
to have programs without any map.
Bug: 140330870
Test: load program w/ bpf w/o maps section
Change-Id: Ia53c699212a8cb962e3c2db562921880fef0cce0
This is part of 3 commits in 3 diff git repos, the main one is:
https://android-review.googlesource.com/c/platform/system/netd/+/1200479
"share eBPF struct definitions between ebpf and C++ netd"
The struct definitions are being moved to system/netd in:
libnetdbpf/include/netdbpf/bpf_shared.h
(they also become typedefs and more consistent naming is used)
Test: builds
Bug: 146787904
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I0200bce35f910414b96d802cd316717b4307b950
These are unused by virtue of the code continuing to build.
C++20 has https://en.cppreference.com/w/cpp/language/default_comparisons
but still requires explicit declaration of them with '=default' annotation.
Test: builds
Bug: 146787904
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I751ad5592acc1ed4cf763d1ca82c301f2e233e56
errno is left unchanged on successful calls to this function, so it is
confusing to log it in the success path.
Fixes: 146171927
Test: looking at logs
Change-Id: Ia424dd865bd518d8c533e99fb1a64b02bc92e759
Using unique_fd to ensure we release bpf prog fds when they are no
longer needed.
Change-Id: I9d5c2673c7e1bdf05052771e06ac78cec21957ec
Merged-In: I9d5c2673c7e1bdf05052771e06ac78cec21957ec
Signed-off-by: Connor O'Brien <connoro@google.com>
(cherry picked from commit 206dd3381e)
Key and value formats for time in state related BPF maps currently
have to be kept in sync between the BPF prog and
libtimeinstate. Add a new bpf_timeinstate.h header file in a directory
that already gets added to the include path for BPF progs, and add
this file to a cc_library_headers module so it can be used from
libtimeinstate as well.
Test: build libtimeinstate and time_in_state.o
Bug: 138317993
Change-Id: Ic56b2b64746f2211f3c802e074339750f26303c0
Merged-In: Ic56b2b64746f2211f3c802e074339750f26303c0
Signed-off-by: Connor O'Brien <connoro@google.com>
(cherry picked from commit badb20f528)
The return of bpf_prog_load() library call is insufficient, we also need
errno to know what the bpf(2) syscall did.
Bug: 143236645
Change-Id: Id2c543fdb63b1e077278a8b1ede03a21afad74dc
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Now that we're developing Android R and we know upgrades
will only be supported from Android P & Q, we no longer
need to check for Android pre-P (ie. O) - so we can remove
that check.
We also take the opportunity to slightly refactor the code
to make it more readable.
Note: it's not appropriate to backport this into any 'normal'
Q branch, since it *will* break 4.9-O devices upgrading to Q
userspace without upgrading the kernel to at least 4.9-P.
Test: builds, atest
Bug: 139501958
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Iacb3c2db489061b3f278d8e971e44dd1a5c4c1e6
This reverts commit f0336cb586.
Reason for revert: breaks all camera use cases
Bug: 135568875
Exempt-From-Owner-Approval: revert, no build cop
Change-Id: Ie228b8dd167d4788c3cf570d0ff531e88a06a170
libprocessgroup symbols are being moved into libcutils in order to
optimize linking/memory usage. libprocessgroup will no longer be
required in the future (however removing references to it will come
separately).
Bug: 135145426
Test: boot
Change-Id: Ie268ddbdb5a8b2eb254c956c8262aed8405752fa