Commit graph

2341 commits

Author SHA1 Message Date
Maciej Żenczykowski
3fee9f5367 bpfloader: more 4.9-T support
(older kernels don't support naming maps/programs)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: If59b8947021394e1ce0a91326fee4272a5bddd38
2024-09-08 12:40:00 +02:00
Maciej Żenczykowski
d18d86dfe9 bpfloader: add back support for 4.9-T kernels
This effectively reverts aosp/2268766

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I42da5c56fe4b69635b9678ff57ade7788c17f7c8
2024-09-08 12:39:44 +02:00
Android Build Coastguard Worker
9bbad68230 Snap for 11931036 from d14a9dd66a to 24Q3-release
Change-Id: I112ea28d90987070e06eb60c6d80f56c7ff2c706
2024-06-05 23:29:37 +00:00
Maciej Żenczykowski
d14a9dd66a BpfLoader: use BpfLoader as the LOG_TAG am: e2f2b8228d am: 3b390bf744
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/3114564

Change-Id: I87caa170f1107674fb4d003e1bd477aa0a2a2fe7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-06-05 10:53:45 +00:00
Maciej Żenczykowski
3b390bf744 BpfLoader: use BpfLoader as the LOG_TAG am: e2f2b8228d
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/3114564

Change-Id: Icfbcdffc96b72d76a4cb646629ebd4bc82013eb4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-06-05 10:35:17 +00:00
Android Build Coastguard Worker
b0d1e1708b Snap for 11789350 from d6b3fe1ae4 to 24Q3-release
Change-Id: Ief48a70e5e81ea2f618d716993cd72cbdfae2d7a
2024-05-01 23:25:10 +00:00
Maciej Żenczykowski
d6b3fe1ae4 BpfLoader: exec mainline netbpfload for finalization am: 95c6fff6a2 am: 91d60440f5
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/3067735

Change-Id: Icc28a7f62050fff32c946c25074fa006b07d41de
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-05-01 12:50:16 +00:00
Maciej Żenczykowski
91d60440f5 BpfLoader: exec mainline netbpfload for finalization am: 95c6fff6a2
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/3067735

Change-Id: I6ae9b1697f9f67d9bfa4c6f155a4a61fe6a48c72
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-05-01 12:29:32 +00:00
Maciej Żenczykowski
e2f2b8228d 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
2024-05-01 05:17:05 -07:00
Maciej Żenczykowski
8acf68c805 BpfLoader: drastically reduce logging am: 0eb98a22c3 am: 2b2df86de7
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/3068096

Change-Id: Ib1c47c7fd873f85bab1294527c5a5cd0c3400257
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-05-01 08:05:22 +00:00
Maciej Żenczykowski
2b2df86de7 BpfLoader: drastically reduce logging am: 0eb98a22c3
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/3068096

Change-Id: If00644648090d39aab90baf114b6d6398274dc2a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-05-01 07:52:51 +00:00
Maciej Żenczykowski
95c6fff6a2 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
2024-04-30 23:53:07 -07:00
Maciej Żenczykowski
0eb98a22c3 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
2024-04-30 22:37:04 -07:00
Android Build Coastguard Worker
0dc366bf71 Snap for 11784291 from 93c3ae24c5 to 24Q3-release
Change-Id: Ic1d2ca596b61f1800f893c4d6224921ad33e20bf
2024-04-30 23:27:05 +00:00
Xin Li
93c3ae24c5 [automerger skipped] Empty merge of Android 24Q2 Release (ab/11526283) to aosp-main-future am: 428fdde571 -s ours
am skip reason: Merged-In Ia835831979e537d2cdda260d101958196b9e6db3 with SHA-1 ffc9f1ed1e is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/system/bpf/+/27145066

Change-Id: I1636bdee82d4e210c9e25701400a6e35ea5ac165
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-04-29 23:46:01 +00:00
Xin Li
428fdde571 Empty merge of Android 24Q2 Release (ab/11526283) to aosp-main-future
Bug: 337098550
Merged-In: Ia835831979e537d2cdda260d101958196b9e6db3
Change-Id: I76f5da2043c4a834a8f850fbc965daf0335817e8
2024-04-29 11:53:30 -07:00
Android Build Coastguard Worker
7e66f9e194 Snap for 11697857 from 7f1bd2aae9 to 24Q3-release
Change-Id: Id068099a7c15320bf2626dc0cc58996c7d9f0730
2024-04-10 23:23:54 +00:00
Neill Kapron
7f1bd2aae9 BpfLoadTest: Set rlimit memlock for old kernels am: bc4ae410ff am: ffc9f1ed1e
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/3034061

Change-Id: Ifc782b4c046afabed23e3b5fe8a7585c2dc23308
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-04-09 19:36:59 +00:00
Neill Kapron
ffc9f1ed1e BpfLoadTest: Set rlimit memlock for old kernels am: bc4ae410ff
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/3034061

Change-Id: Ia835831979e537d2cdda260d101958196b9e6db3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-04-09 19:25:40 +00:00
Neill Kapron
bc4ae410ff BpfLoadTest: Set rlimit memlock for old kernels
BpfLoadTest was failing on android13-5.10 kernels due to the rlimit
memlock not being configured large enough for the test process. Add the
necessary call to set rlimit memlock for pre-5.11 kernels.

5.11 kernels introduced cgroup-based memory accounting for bpf as
discussed at https://lore.kernel.org/bpf/20201201215900.3569844-1-guro@fb.com/

Flag: n/a
Test: atest libbpf_load_test
Bug: 326156952

Change-Id: I8eda9fe6cee099b1fd979720a4e94d685a571943
Signed-off-by: Neill Kapron <nkapron@google.com>
2024-04-09 17:22:02 +00:00
Android Build Coastguard Worker
73492f03e1 Snap for 11558480 from 6ce7641caf to 24Q3-release
Change-Id: I314960bf4e5e7dbd4917a1e75b5f86eb5fa83d09
2024-03-11 23:23:31 +00:00
Treehugger Robot
6ce7641caf Merge "Platform BpfLoader: remove dumpIns() and dumpAllCs()" into main am: febb949db4 am: 9c4101267c
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2997237

Change-Id: Ib2402ef056807b32014ab1d1b1343a6364d2dcfb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-11 09:44:13 +00:00
Maciej Żenczykowski
0dc3b9b4b1 Platform BpfLoader: remove dead code exists() function am: 50c60e52f7 am: 6af4381368
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2997236

Change-Id: I9f39b85803f1d12fe8c58098388a4b7b385f1e65
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-11 09:44:00 +00:00
Maciej Żenczykowski
7e5285c13b Platform BpfLoader: remove support for per-map/prog dir & selinux context am: c1647d764f am: 4e15997c57
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2995655

Change-Id: I0fd57a770f4cacdf90d15c07b171746f7ae2b78b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-11 09:43:57 +00:00
Treehugger Robot
9c4101267c Merge "Platform BpfLoader: remove dumpIns() and dumpAllCs()" into main am: febb949db4
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2997237

Change-Id: Icb01ca8075da767620d521e17537223673bfb0b2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-11 09:03:36 +00:00
Maciej Żenczykowski
6af4381368 Platform BpfLoader: remove dead code exists() function am: 50c60e52f7
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2997236

Change-Id: Id9616adac555b715e1b267a7068f882ac4a10aa9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-11 09:03:23 +00:00
Maciej Żenczykowski
4e15997c57 Platform BpfLoader: remove support for per-map/prog dir & selinux context am: c1647d764f
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2995655

Change-Id: I42d9d8eb19436f92a5f0e8cd0b28a78e49e2c97c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-11 09:03:19 +00:00
Treehugger Robot
febb949db4 Merge "Platform BpfLoader: remove dumpIns() and dumpAllCs()" into main 2024-03-11 08:25:02 +00:00
Maciej Żenczykowski
6c1019861b bpfmt loader/Android.bp am: b9712d1c85 am: 6ac8e3d52e
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2995654

Change-Id: I24758fc24e6cc557c19e4cc9108a2db891eaa8a5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-11 05:21:43 +00:00
Maciej Żenczykowski
1372db28bf Platform BpfLoader: statically link libbpf_android support lib am: cc922aa442 am: 44dca94b7e
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2995653

Change-Id: I5c0c9a472f4f5649aeed7cb638897eaeb81d6375
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-11 05:21:38 +00:00
Maciej Żenczykowski
336f699a6d move libbpf_android into loader subdirectory am: 5c412c6c0e am: 468c1ee422
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2995652

Change-Id: Ia83381268d22eb1a997b4c8ec21fb8885c7d276b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-11 05:21:34 +00:00
Maciej Żenczykowski
de0129463f rename 'bpfloader' directory to just 'loader' am: 8c0a922d0e am: b6491b8ad5
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2995651

Change-Id: Ifbd5a90ac31861c65ed9e837bd79bbb2a4742824
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-11 05:21:18 +00:00
Maciej Żenczykowski
e21ba0a561 Platform BpfLoader: do not support mismatching bpf map/prog struct sizes am: c82f56679a am: 2d8969d941
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2995650

Change-Id: I9229602b76d456e229cafe06ff44de41c572dd7b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-11 05:21:02 +00:00
Maciej Żenczykowski
367dad501b sort OWNERS_bpf and add trailing newline am: 97e633a6ea am: 7e28f88486
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2995649

Change-Id: I413ba5c3c57133d859db594339743d29cc811723
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-11 05:20:55 +00:00
Maciej Żenczykowski
6ac8e3d52e bpfmt loader/Android.bp am: b9712d1c85
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2995654

Change-Id: I4e58e726af030279a6e8578316ffe615f7eff124
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-11 04:39:10 +00:00
Maciej Żenczykowski
44dca94b7e Platform BpfLoader: statically link libbpf_android support lib am: cc922aa442
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2995653

Change-Id: Ica995245508261e0685def112799d5bc1fb24454
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-11 04:39:06 +00:00
Maciej Żenczykowski
468c1ee422 move libbpf_android into loader subdirectory am: 5c412c6c0e
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2995652

Change-Id: Ia95dfa7f3e99cbd3151f0cb5cdfefef2c91d651c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-11 04:39:03 +00:00
Maciej Żenczykowski
b6491b8ad5 rename 'bpfloader' directory to just 'loader' am: 8c0a922d0e
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2995651

Change-Id: I994a0e818b7cf977bca5b729642f5f2cef6c6e75
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-11 04:38:50 +00:00
Maciej Żenczykowski
2d8969d941 Platform BpfLoader: do not support mismatching bpf map/prog struct sizes am: c82f56679a
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2995650

Change-Id: I44518778f14348a262339f1bc6ae44452ef9fefb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-11 04:38:37 +00:00
Maciej Żenczykowski
7e28f88486 sort OWNERS_bpf and add trailing newline am: 97e633a6ea
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2995649

Change-Id: I498296a3d2bf7ea1d6842b296230af0aee6d5839
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-11 04:38:32 +00:00
Maciej Żenczykowski
091206500d 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
2024-03-11 04:01:21 +00:00
Maciej Żenczykowski
50c60e52f7 Platform BpfLoader: remove dead code exists() function
Test: builds
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I13d33559b024c22b033a5b04b1be3f78a5a5913a
2024-03-11 04:01:13 +00:00
Maciej Żenczykowski
c1647d764f 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
2024-03-11 04:01:07 +00:00
Maciej Żenczykowski
b9712d1c85 bpfmt loader/Android.bp
Generated via:
  ../../prebuilts/build-tools/linux-x86/bin/bpfmt -w loader/Android.bp

Test: N/A
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I08e3a2e1d95c6d2875de6195750638b9d143abf4
2024-03-11 04:00:30 +00:00
Maciej Żenczykowski
cc922aa442 Platform BpfLoader: statically link libbpf_android support lib
Besides tests, we're the only user (unsurprising considering
selinux limitations on who can actually load bpf programs...)

This slightly reduces disk space consumption...

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Icadfb45d556ebf9d19b9b2ea2173c014a39b1278
2024-03-11 04:00:21 +00:00
Maciej Żenczykowski
5c412c6c0e 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
2024-03-11 04:00:13 +00:00
Maciej Żenczykowski
8c0a922d0e rename 'bpfloader' directory to just 'loader'
//system/bpf/bpfloader/BpfLoader.cpp is just pointlessly wordy.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I52a9dd11d2cc844a385e7971e38c7188118aaed0
2024-03-11 04:00:05 +00:00
Maciej Żenczykowski
c82f56679a Platform BpfLoader: do not support mismatching bpf map/prog struct sizes
This is not needed, as all platform bpf .o's are built at the same time
(and thus from the same bpf map/prog structure definitions) as
the loader itself.

This effectively undoes much of aosp/1754794
'bpf loader improvements for better long term compatibility with mainline'

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I8cd6865cfb49bb282b2dcff1957dd9826e501da1
2024-03-11 03:59:37 +00:00
Maciej Żenczykowski
97e633a6ea sort OWNERS_bpf and add trailing newline
Test: N/A
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I173ae31ac371dd33f3715a7720509cfab00b3b58
2024-03-10 14:35:44 -07:00
Android Build Coastguard Worker
109c0fdd21 Snap for 11554395 from f23154ec1a to 24Q3-release
Change-Id: I5a6607e869c0add430a91a2bad465f09708d4f50
2024-03-09 22:23:43 +00:00