Commit graph android_system_bpf/loader/Loader.cpp
Message SHA1
BpfLoader: split legacy bpfloader into 3 phases, simplify arguments
Should make integration with BpfLoader written in rust easier.

While at it add simple wrappers around ALOG{V,D,I,W,E}(),
which may come in handy as bpfloader runs early enough that
logging must be to the kernel dmesg ringbuffer instead...

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ia49c605bae63241b74d04e2e0f58fd089c23993d

Maciej Żenczykowski   authored and   Neill Kapron   commited 2024-08-07 21:20:02 +00:00
dd4bd2d655
bpfLoader as a lib - make it actually build/work
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Iff1c39de5ac8a07cdd16841c04db87ae874adc8f

Maciej Żenczykowski   commited 2024-08-06 15:43:56 -07:00
6d4d9d89c2
bpfloader: move BpfLoader.cpp into Loader.cpp
Prep work to make legacy BpfLoader usable as a library from rust.

Note: fixups to make this actually build will be in the next commit.

Generated via:
  cd //system/bpf/loader
  echo >> Loader.cpp
  cat BpfLoader.cpp >> Loader.cpp
  rm BpfLoader.cpp

Test: will not build, requires followup
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Id3a942bd0d217f3b689f165666b73e1f2834d33f

Maciej Żenczykowski   commited 2024-08-06 15:25:56 -07:00
e0f11527e4
BpfLoader: use BpfLoader as the LOG_TAG
The only non-test use of the library is the BpfLoader,
so it makes sense for everything to use the same tag.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Iddc0472a39db292fef31b2e195b3ab919d884f7d

Maciej Żenczykowski   commited 2024-05-01 05:17:05 -07:00
e2f2b8228d
BpfLoader: exec mainline netbpfload for finalization
Move setting 'bpf.progs_loaded' property to 1 into mainline.

This doesn't terribly matter, but it gives mainline bpf loading
code a chance to run after platform and perform any required
finalization.

While at it also use distinctive error return values,
as these are often the only thing that init reports about
a bpfloader failure.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: If502cf07c8ceed306c18821075a92f99437da4dd

Maciej Żenczykowski   commited 2024-04-30 23:53:07 -07:00
95c6fff6a2
BpfLoader: drastically reduce logging
Should speed up boot time - especially if serial console is enabled.

There's probably still enough information available to debug issues,
as any errors (which basically shouldn't happen) are still all
extensively logged.

Either way, as this now only loads platform bpf .o files, anyone seeing
boot time problems can simply flash a custom build with changes to the
platform BpfLoader to enable any extra logging as needed.

(Note that AFAICT normally ALOGV() is basically ignored)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I5e404ae14c33ee319c07be42defdc270b15a54fe

Maciej Żenczykowski   commited 2024-04-30 22:37:04 -07:00
0eb98a22c3
Platform BpfLoader: remove dumpIns() and dumpAllCs()
I've *never* ended up using this information...

Test: builds
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I621d32fb235e9cd88989e99536485674c74fa884

Maciej Żenczykowski   commited 2024-03-11 04:01:21 +00:00
091206500d
Platform BpfLoader: remove support for per-map/prog dir & selinux context
For platform bpf .o files per-map/prog selinux context can simply
be added by genfscon selinux policy modifications.

(while per-map/prog pin dir really only exists to support the selinux context)

Test: TreeHugger
  Both before and after this patch 'adb shell find /sys/fs/bpf | wc -l' returns 103
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ic700db2870c16a04c9498e529519051a672a28c8

Maciej Żenczykowski   commited 2024-03-11 04:01:07 +00:00
c1647d764f
move libbpf_android into loader subdirectory
The only (real) user is the platform bpfloader binary.
This is a library purely to facilitate testing.

It's easier to develop / code-search if everything is in the same directory.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Iebe8a5c4f8bb9ada220acec6ed8c1be0fc9d438c

Maciej Żenczykowski   commited 2024-03-11 04:00:13 +00:00
5c412c6c0e
Renamed from libbpf_android/Loader.cpp (Browse further)