Commit graph

81 commits

Author SHA1 Message Date
Maciej Żenczykowski
a9209da871 NetBpfLoader: create /sys/fs/bpf/loader dir
(instead of in platform bpfloader)

Better to do it earlier so we can use it for
auto/permanently pinned/attached networking programs.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I202e150e6d48e63ba643c1bd2247cefcdebc07a5
2024-02-29 02:02:19 +00:00
Maciej Żenczykowski
a0b201c433 netbpfload: fail if platform exec of apex fails
should never fail, since we now have M-2024-1 module prebuilts:
  $ adb shell ls -d /apex/com.android.tethering*
  /apex/com.android.tethering
  /apex/com.android.tethering@341310230

Test: TreeHugger, manually on a Pixel device
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ib145fba8e3c47bc300f4589723d9c80749770a19
2024-02-28 01:23:32 -08:00
Maciej Żenczykowski
7f6a42672d netbpfload: V+ x86 require 64-bit kernel
For reasoning see:
  https://android-review.googlesource.com/c/platform/system/netd/+/2966803

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: If479b0443a64e0bf98ca89016d42ca37e231c576
2024-02-17 03:47:52 +00:00
Maciej Żenczykowski
03ef12cc79 netbpfload: enable on U QPR2 (aka 24Q1)
(this will land in M-2024-05 ie. May mainline tethering module)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I250b691eb03751da05ce10d41d6721f4964dd1d5
2024-02-13 00:31:30 +00:00
Maciej Żenczykowski
b60599b705 NetBpfLoad - log Tethering Apex version
(super useful for debugging)

Sample output:
  I NetBpfLoad: NetBpfLoad '/apex/com.android.tethering/bin/netbpfload' starting...
  I NetBpfLoad: NetBpfLoad api:10000/34 kver:6010019 platform:0 mainline:1
  D NetBpfLoad: Found Tethering Apex mounted from blockdev /dev/block/dm-55
  I NetBpfLoad: Tethering APEX version 340090000

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Iaf1bc22b02913ea21ff9368abd9933e6ef4017f1
2024-02-09 23:31:17 +00:00
Maciej Żenczykowski
2fe2db52f6 netbpfload: use apex version whenever available
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I8833451acc031b8b2137d23e9a6763851f149081
2024-02-07 01:24:26 +00:00
Maciej Żenczykowski
9128ac317d Merge "netbpfload: enable mainline on API V/35+" into main 2024-02-01 01:00:10 +00:00
Maciej Żenczykowski
041be52b08 netbpfload: enable mainline on API V/35+
netbpfload.mainline.rc is derived from:
  initrc-doc/bpfloader-sdk34-14-U.rc,
except that it is 'override' instead of 'updatable' and uses
the apex netbpfload instead of the platform bpfloader.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I1ecf14e3d927ece136a0669a9b209be7112e55b5
2024-01-31 22:36:39 +00:00
Aditya Choudhary
01b5ede2b2 [DON'T BLOCK] Test ownership migration rules
This CL is created as a best effort to migrate test targets
to the new android ownership model. If you find incorrect or unnecessary
attribution in this CL, please create a separate CL to fix that.

For more details please refer to the link below,
<add g3 doc link>

Bug: 304529413
Test: N/A
Change-Id: I243f17b3f0ad7af9ffa15ca242456e36688733f5
Merged-In: I243f17b3f0ad7af9ffa15ca242456e36688733f5
2024-01-31 12:34:50 +00:00
Maciej Żenczykowski
f33f12876f netbpfload: prep work to support <U
proc file writes were only moved from .rc into bpfloader binary in U.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I20eda71d4f4e16130401d1cfff239c7cd8ea9bf6
2023-10-25 18:40:53 +00:00
Maciej Żenczykowski
4530eaaa9e Merge "move bpfloader.rc into p/m/C" into main 2023-10-25 00:07:02 +00:00
Maciej Żenczykowski
b0940279c4 doc: add bpfloader rc files from previous Android releases
Stripping comments since those are not interesting
for the purposes of what these things actually do.

Doing R+ since tethering apex only supports R+ now.

Generated via:
  (cd ../../../../../system/bpf && git cat-file -p remotes/aosp/android11-release:bpfloader/bpfloader.rc; ) | egrep -v '^ *#' > bpfloader-sdk30-11-R.rc
  (cd ../../../../../system/bpf && git cat-file -p remotes/aosp/android12-release:bpfloader/bpfloader.rc; ) | egrep -v '^ *#' > bpfloader-sdk31-12-S.rc
  (cd ../../../../../system/bpf && git cat-file -p remotes/aosp/android13-release:bpfloader/bpfloader.rc; ) | egrep -v '^ *#' > bpfloader-sdk33-13-T.rc
  (cd ../../../../../system/bpf && git cat-file -p remotes/aosp/android14-release:bpfloader/bpfloader.rc; ) | egrep -v '^ *#' > bpfloader-sdk34-14-U.rc
  (cd ../../../../../system/bpf && git cat-file -p remotes/aosp/main:bpfloader/bpfloader.rc;              ) | egrep -v '^ *#' > bpfloader-sdk34-14-U-QPR2.rc

Test: N/A
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Idd8032ce66ef07a1d9e42343e75b26d764e6d8c1
2023-10-24 19:26:55 +00:00
Maciej Żenczykowski
7da54d9940 move bpfloader.rc into p/m/C
Generated via:
  cat ../../../system/bpf/bpfloader/bpfloader.rc > netbpfload/netbpfload.rc

(plus changing Android.bp to use it)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I4bcdd57b0b5abcc296a4c56273d6aac632560345
2023-10-24 02:18:02 -07:00
Maciej Żenczykowski
1b36d2e2a3 Merge "execute platform bpfloader after netbpfload is done" into main 2023-10-21 16:06:44 +00:00
Maciej Żenczykowski
58c182291d execute platform bpfloader after netbpfload is done
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I447880763bbc506f08b578f862f09be91ab3d14d
2023-10-21 09:20:03 +00:00
Maciej Żenczykowski
ef63fd1fa0 Merge "move the bpf.progs_loaded = 1 setting back to bpfloader" into main 2023-10-21 02:18:05 +00:00
Maciej Żenczykowski
7db65c6d38 Revert "netbpfload: remove netbpfload.rc"
This mostly reverts commit 1d2c93d568.

Test: N/A
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I0d7fdaeae508c0250114f7af8700d0fc40b0f27a
2023-10-21 00:15:00 +00:00
Maciej Żenczykowski
3f25b4ba8a move the bpf.progs_loaded = 1 setting back to bpfloader
change of design: we'll call netbpfload before bpfloader

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I2d7a04a1bf1aa1d163f2b3936e2cde61308c4aa4
2023-10-20 15:18:50 -07:00
Maciej Żenczykowski
a2a3d754a6 build netbpfload into the tethering apex
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Id68aece26115808c2b1b795b9395208f5066f87c
2023-10-10 16:51:01 -07:00
Maciej Żenczykowski
1d2c93d568 netbpfload: remove netbpfload.rc
I think it's better to just put this in bpfloader.rc,
where we can guarantee the correct ordering.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie2c5ab1cb1de015397ac54867ae6bb0c4321d207
2023-10-10 03:46:06 -07:00
Maciej Żenczykowski
af07d6db1f netbpfload: remove support for limiting selinux contexts
No need for this, as we simply only support those selinux
contexts (and directories) which are available to networking.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I35b134c57411f82514b9f7148411f83d3aee1927
2023-10-10 03:46:06 -07:00
Maciej Żenczykowski
857399114e netbpfload: do not create /sys/fs/bpf/loader subdir
(it's already created by the platform bpfloader)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie22f585cab17fd2bded3d97a9cfe1019b792b69d
2023-10-10 03:37:14 -07:00
Elliott Hughes
497e3e05a5 Use libbase properties for a slight simplification.
Test: treehugger
Change-Id: If699230d0bf71ce521d7175da707e42b78ae4886
2023-10-09 23:57:48 +00:00
Maciej Żenczykowski
fcea70f840 netbpfload: remove support for limiting program types
No need for this, as we simply only support network
program types in the first place.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I163e21fd4d4089882cf37fc68bc4299003b514d7
2023-10-09 00:32:36 -07:00
Maciej Żenczykowski
02519f86ad netbpfload: remove non-network program types
We are unlikely to ever be willing to load these
program types from mainline, as it is simply too dangerous.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I1b0943d39b8131699f4606e8d165f3c944d453ed
2023-10-09 00:32:31 -07:00
Maciej Żenczykowski
40dfe53313 netbpfload: add Android.bp file
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I3af8e7f14de8dd5dd65c40705195332bef114b88
2023-10-09 00:32:26 -07:00
Maciej Żenczykowski
283c25a07a netbpfload: update date in copyright messages, LOG_TAGs, etc.
Test: N/A
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I8f83d04266caf930701b9725b457333ddae149f2
2023-10-02 22:40:38 -07:00
Maciej Żenczykowski
354ded3926 netbpfload: remove support for 'loader'
Test: N/A
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I3d6a6a072cc958c3cb8f49d747a6c6812b37cef5
2023-10-02 22:35:38 -07:00
Maciej Żenczykowski
d6395205bb netbpfload: remove support for 'vendor'
Test: N/A
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: If088188b4832d37b084846b5ad3db06b8858d856
2023-10-02 22:35:24 -07:00
Maciej Żenczykowski
0e4802df20 netbpfload: remove support for 'platform'
Test: N/A
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ia0c1f55aa78435737699e0dec0bfddbd977e7392
2023-10-02 22:35:03 -07:00
Maciej Żenczykowski
60c159f233 import bpfloader into p/m/C
These are unmodified files, without history.
Getting these to do something useful will come later.

Generated via:
  cp //system/bpf/bpfloader/bpfloader.rc netbpfload.rc
  cp //system/bpf/bpfloader/BpfLoader.cpp NetBpfLoad.cpp
  cp //system/bpf/libbpf_android/include/libbpf_android.h loader.h
  cp //system/bpf/libbpf_android/Loader.cpp loader.cpp

Change-Id: I1677b899a51e1289a7a9806d6f5c34450b9e7c47
2023-10-02 14:59:10 -07:00