Commit graph

1597 commits

Author SHA1 Message Date
Treehugger Robot
730471caac Merge "detect inability to write to index != 0 of bpf map array" am: 515bf77a8a am: 199dce675c
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2168142

Change-Id: I96a82ee21643626386f3ca5ef6609947864ddf4e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-29 02:31:07 +00:00
Treehugger Robot
199dce675c Merge "detect inability to write to index != 0 of bpf map array" am: 515bf77a8a
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2168142

Change-Id: I8a42f7b60e5939637d1e3aee4054e2124fc196e2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-29 01:44:54 +00:00
Treehugger Robot
515bf77a8a Merge "detect inability to write to index != 0 of bpf map array" 2022-07-29 01:20:25 +00:00
Maciej Żenczykowski
aba9024849 detect inability to write to index != 0 of bpf map array
(this is a test for a kernel bug)

Bug: 240347583
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I0cad47113a83dbd837cccc5229ef52b605cda203
2022-07-28 02:29:54 -07:00
Paul Lawrence
94a6b5239d Merge "Add fuse prog types to allowed prog types from system" am: 73d8f14525 am: 883867d94d
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2164582

Change-Id: I5abf0eb67cd3b1bf6eb83375cb18f0bbe4cd8c79
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-27 20:25:06 +00:00
Paul Lawrence
883867d94d Merge "Add fuse prog types to allowed prog types from system" am: 73d8f14525
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2164582

Change-Id: Ife1e285822ea70b62717755743e2d4abc55a5bd1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-27 20:00:14 +00:00
Paul Lawrence
73d8f14525 Merge "Add fuse prog types to allowed prog types from system" 2022-07-27 19:44:21 +00:00
Maciej Żenczykowski
78d28d0aef Make sure that BPFLOADER_VERSION >= COMPILE_FOR_BPFLOADER_VERSION am: b3dcc14182 am: 3d97f1532b
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2164742

Change-Id: I1a3fc9253e6541c794c0387d7f0ebef16c0b3493
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-25 20:23:27 +00:00
Maciej Żenczykowski
3d97f1532b Make sure that BPFLOADER_VERSION >= COMPILE_FOR_BPFLOADER_VERSION am: b3dcc14182
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2164742

Change-Id: I277427045c5c7470e4f0d63fd3b809a654ea051e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-25 19:57:17 +00:00
Maciej Żenczykowski
b3dcc14182 Make sure that BPFLOADER_VERSION >= COMPILE_FOR_BPFLOADER_VERSION
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I3612460f81a210df0293c0a0f589c2d5a29f615b
2022-07-24 22:43:06 +00:00
Paul Lawrence
7fb8b546e3 Add fuse prog types to allowed prog types from system
Until fuse-bpf is upstreamed, the value BPF_PROG_TYPE_FUSE is
dynamically defined, so use BPF_PROG_TYPE_UNSPEC as a placeholder and read
the actual value from sys/fs/fuse

Bug: 202785178
Test: fuse bpf can be enabled successfully
Change-Id: I67d3ff45768b581a6b239e235edaa6e46a2f6fe0
2022-07-22 12:35:36 -07:00
Treehugger Robot
91048037ac Merge "BpfLoader v0.28 - if (map.zero != 0) abort()" am: 15f1bf8928 am: 17080ca9da
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2163056

Change-Id: I652a8253d4f5663afd4cd88f5fa93bb06128eff0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-22 00:40:14 +00:00
Treehugger Robot
17080ca9da Merge "BpfLoader v0.28 - if (map.zero != 0) abort()" am: 15f1bf8928
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2163056

Change-Id: I8d17be218d724251195779e720ac29a47931583f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-22 00:14:37 +00:00
Treehugger Robot
15f1bf8928 Merge "BpfLoader v0.28 - if (map.zero != 0) abort()" 2022-07-21 23:52:07 +00:00
Ken Chen
c56a0e8043 Merge "Rename time_in_state.o to timeInState.o" am: e516c5a9bc am: 6dc356bd4c
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2146829

Change-Id: Ia168e7d1a5b7b8c3a8354ce05f3755e56279d7b8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-21 22:56:22 +00:00
Ken Chen
6dc356bd4c Merge "Rename time_in_state.o to timeInState.o" am: e516c5a9bc
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2146829

Change-Id: Ie34ce0bfda1af2aed80fcbeb61635cb69706e7ff
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-21 22:21:39 +00:00
Ken Chen
e516c5a9bc Merge "Rename time_in_state.o to timeInState.o" 2022-07-21 13:43:50 +00:00
Maciej Żenczykowski
2a5d016061 BpfLoader v0.28 - if (map.zero != 0) abort()
This also effectively forces the 'struct bpf_map_def'
definition to include the zero field, and thus to have
the uid field at the new offset.

Bug: 239807354
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I44dd740bda4cce4d8fcb04895ee7eb3d4c3300e4
2022-07-21 13:36:02 +00:00
Maciej Żenczykowski
6bbcf7c827 abort() if neither tethering flag is present am: 2ab4dbe471 am: 549dfb3e06
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2160696

Change-Id: I95c1be156c723ccbdbd7f9df278601191b7166aa
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-21 06:50:47 +00:00
Maciej Żenczykowski
549dfb3e06 abort() if neither tethering flag is present am: 2ab4dbe471
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2160696

Change-Id: I8bbe036cd3fc378f66f242712e813c5febc125f6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-21 06:33:52 +00:00
Maciej Żenczykowski
2ab4dbe471 abort() if neither tethering flag is present
Bug: 190523685
Bug: 236925089
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I846aa9c823760909c24db805e044866c29108b79
2022-07-20 12:31:00 +00:00
Treehugger Robot
0997472fe3 Merge "Make system/bpf changes trigger connectivity CTS tests in presubmit" am: 0c2cfe7e5f am: 9ef90d6e3e
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2160416

Change-Id: I2064885c1d7dceae37d46b1a5e19a89895bdac6a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-20 09:26:38 +00:00
Treehugger Robot
9ef90d6e3e Merge "Make system/bpf changes trigger connectivity CTS tests in presubmit" am: 0c2cfe7e5f
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2160416

Change-Id: I7e883a674bdbcf70a0371d67a96e8d98acfb0dad
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-20 09:07:49 +00:00
Treehugger Robot
0c2cfe7e5f Merge "Make system/bpf changes trigger connectivity CTS tests in presubmit" 2022-07-20 08:36:45 +00:00
Junyu Lai
9c8909de2a Make system/bpf changes trigger connectivity CTS tests in presubmit
1. The TEST_MAPPING file should be inside bpf folder to be
   triggered on any system/bpf change.
2. It should include Connectivity module to run connectivity CTS
   tests on any change.

Test: TH
Fix: 235927729
Change-Id: I00149bf8a278853efdd2fcda4bcfb56398a73687
2022-07-20 11:23:08 +08:00
Maciej Żenczykowski
dabeb213f6 BpfLoader v0.27 - support InProcessTethering am: 057ef34bb9 am: 9ea940c494
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2154572

Change-Id: I49d940797ac742b1f189a1d83a0e35049d2dd878
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-19 07:54:54 +00:00
Maciej Żenczykowski
9ea940c494 BpfLoader v0.27 - support InProcessTethering am: 057ef34bb9
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2154572

Change-Id: I9947c8d88d025b0bd4db98ad2dbac9cde862cb00
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-19 07:36:44 +00:00
Maciej Żenczykowski
057ef34bb9 BpfLoader v0.27 - support InProcessTethering
detect InProcessTethering and adjust /sys/fs/bpf/tethering selinux context

on aosp_cf_x86_go_phone-userdebug

$ adbz shell dumpsys tethering | egrep 'Bpf shim:'
    Bpf shim: mBpfDownstream6Map{OK}, mBpfUpstream6Map{OK}, mBpfDownstream4Map{OK}, mBpfUpstream4Map{OK}, mBpfStatsMap{OK}, mBpfLimitMap{OK}, mBpfDevMap{OK}

unfortunately all 24 TetheringPrivilegedTests still fail,
presumably due to busted certificates or something like that.

Bug: 190523685
Bug: 236925089
Test: TreeHugger, manually on aosp_cf_x86_go_phone-userdebug
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I2a36b7bdfc2b532eac92dfe5edb6ad353960c9a8
2022-07-18 23:58:37 +00:00
Maciej Żenczykowski
19d0138e82 fix a potential invalid dereference am: 6f4e6ae532 am: bfd375e354
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2152895

Change-Id: I194b292528b0925aec7e330f0f65a02e4c283f2e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-14 08:31:39 +00:00
Maciej Żenczykowski
bfd375e354 fix a potential invalid dereference am: 6f4e6ae532
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2152895

Change-Id: Iebfefacf1e5ca9482d8ac93ea022b10f84124937
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-14 08:11:46 +00:00
Maciej Żenczykowski
6f4e6ae532 fix a potential invalid dereference
Change-Id: I3dc9a8b868953ad3c9eb1ddfd1f76c3be94af8a6
2022-07-13 20:51:21 +00:00
TreeHugger Robot
4469b6ba7b [automerger skipped] Merge "DO NOT MERGE - Merge TP1A.220624.013" into stage-aosp-master am: b06de670d8 -s ours
am skip reason: Merged-In I553e90e0414453f8f3aaca8cf05d5decc8b911a2 with SHA-1 37b3d06333 is already in history

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

Change-Id: I0fb735285905fd9c34797cc38ff8e03cd61fbf68
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-13 01:30:37 +00:00
Xin Li
b28795244d [automerger skipped] DO NOT MERGE - Merge TP1A.220624.013 am: 3e36c00b18 -s ours
am skip reason: Merged-In I553e90e0414453f8f3aaca8cf05d5decc8b911a2 with SHA-1 37b3d06333 is already in history

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

Change-Id: I4f23c67fb60a5ca15e6853b3b31cb9ee028ce29d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-13 01:30:07 +00:00
TreeHugger Robot
b06de670d8 Merge "DO NOT MERGE - Merge TP1A.220624.013" into stage-aosp-master 2022-07-13 01:07:47 +00:00
Ken Chen
b11c90ffce Rename bpf_load_tp_prog.o and bpf_load_tp_prog_btf.o am: 8693c789d3 am: 23fb1a6884
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2146828

Change-Id: I23e354c3bb373e6f3edda45363e2ecc826203148
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-12 13:37:37 +00:00
Ken Chen
23fb1a6884 Rename bpf_load_tp_prog.o and bpf_load_tp_prog_btf.o am: 8693c789d3
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2146828

Change-Id: I2dfd985fed650213d9ecc002bfa6385c8f2f7cd0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-12 13:19:57 +00:00
Xin Li
3e36c00b18 DO NOT MERGE - Merge TP1A.220624.013
Merged-In: I553e90e0414453f8f3aaca8cf05d5decc8b911a2
Change-Id: I86969f4b387004f64713035423692fd2c9df3aaf
2022-07-11 21:47:46 -07:00
Ken Chen
498d20b706 Rename time_in_state.o to timeInState.o
Underscore character may cause bpf prog/map naming collision. For
example, x.o with map y_z and x_y.o with map z both result in x_y_z
prog/map name, which should be prevented during compile-time.

aosp/2147825 will prohibit underscore character in bpf source name
(source name derives the obj name). Existing bpf modules with underscore
characters in source name need to be updated accordingly.

Bug: 236706995
Test: adb root; adb shell ls -l /sys/fs/bpf/ | grep timeInState
Change-Id: Ia4eefd8b7debed2c81e194052488e15df72cab69
2022-07-10 19:10:36 +08:00
Ken Chen
8693c789d3 Rename bpf_load_tp_prog.o and bpf_load_tp_prog_btf.o
Underscore character may cause bpf prog/map naming collision. For
example, x.o with map y_z and x_y.o with map z both result in x_y_z
prog/map name, which should be prevented during compile-time.

aosp/2147825 will prohibit underscore character in bpf source name
(source name derives the obj name). Existing bpf modules with underscore
characters in source name need to be updated accordingly.

Bug: 236706995
Test: atest libbpf_load_test
Change-Id: I037ccfedc4d2e48688ee47f575c73998ce1c2c4b
2022-07-10 18:31:18 +08:00
Treehugger Robot
c8f29c0862 Merge "BpfLoader v0.25 - add support for obj@ver.o" am: d6c6835f27 am: 032c305dd8
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2147468

Change-Id: Id9d38b9ed2b5709182262873c914b9268316488e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-07 20:08:25 +00:00
Treehugger Robot
032c305dd8 Merge "BpfLoader v0.25 - add support for obj@ver.o" am: d6c6835f27
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2147468

Change-Id: I7ad3b64790a61d163af7e36bec870ec752eb45e1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-07 19:43:17 +00:00
Treehugger Robot
d6c6835f27 Merge "BpfLoader v0.25 - add support for obj@ver.o" 2022-07-07 19:29:22 +00:00
Maciej Żenczykowski
21869ef935 BpfLoader v0.25 - add support for obj@ver.o
This allows for 2 different versions of obj.o to be
shipped simultaneously (via mainline module),
with different bpfloader version limitations.

For example a obj.o for bpfloader < 0.25 and a
obj@25.o for bpfloader 0.25+.  These can provide
for different implementations of maps/programs,
while still being pinned into the same ultimate
destination in /sys/fs/bpf/.../{map,prog}_obj_...
so as to not require special selection of appropriate
program/map path names in higher level code
(at least for common functionality).

When using this functionality one does have to be
careful to not end up with unintentional duplication
(ie. an obj@1.o and obj@2.o that both load on bpfloader
version X), and to make sure that the defined
bpf maps and programs with identical names
are also sufficiently identical in behaviour.

In practice it is likely that all versions of obj@ver.o
will be built from the same source code, with compilation
controlled by appropriate preprocessor conditional macros,
to hide certain parts of obj.c while building the version
for older bpfloader...

However, exactly how to use this is ultimately
left up to the future...
Multiple viable mechanisms exist:

(a) each obj@ver.o is standalone, only one should be loaded,
    bpfloader min/max version annotations would be used
    to guarantee this, making sure that programs/maps that
    exist in multiple versions of obj.o should have matching
    types and behaviours, but nothing guarantees this
    (although key/value size checks will certainly help)
(b) obj.o is baseline and always loaded,
    while obj@25.o is an extension with extra maps/programs
    and is loaded on only newer bpfloaders,
    it may have duplicate defines of shared maps
    (likely via #include of some shared header file)
    if some of the extra programs also need some of
    the data from maps from the 'older' obj.o
(c) variously complex combinations of (a) and (b) are also possible

Bug: 218408035
Test: TreeHugger, manually with offload@1.o in p/m/C
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ib60d07b18fd6617d456c2c469f8e8ed166aadffd
2022-07-07 18:00:18 +00:00
Ken Chen
62834a5567 Remove redundant line feed in log am: e1b518ce76 am: 1e406370fd
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2146822

Change-Id: I9f36491977d185df7f07405ed71fe4a24ce8ffca
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-06 20:27:06 +00:00
Ken Chen
1e406370fd Remove redundant line feed in log am: e1b518ce76
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2146822

Change-Id: Id3058b03562080649eaef0c0e9ec2be11b52fd12
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-06 20:07:41 +00:00
Ken Chen
e1b518ce76 Remove redundant line feed in log
This can save 568 lines of trace at startup.

Before:
05-19 13:50:09.053 ... 950 LibBpfLoader: applying relo to instruction...
05-19 13:50:09.053 ... 950 LibBpfLoader:
05-19 13:50:09.053 ... 950 LibBpfLoader: applying relo to instruction...
05-19 13:50:09.053 ... 950 LibBpfLoader:
05-19 13:50:09.053 ... 950 LibBpfLoader: applying relo to instruction...
05-19 13:50:09.053 ... 950 LibBpfLoader:

After:
05-19 13:53:02.263 ... 975 LibBpfLoader: applying relo to instruction...
05-19 13:53:02.263 ... 975 LibBpfLoader: applying relo to instruction...
05-19 13:53:02.263 ... 975 LibBpfLoader: applying relo to instruction...

Test: adb reboot; adb logcat | grep LibBpfLoader
Change-Id: I2bff44ebfa5ba3af6ef41def1967ab1ae44852f7
2022-07-06 17:09:47 +00:00
Maciej Żenczykowski
e202a55aba bpfloader: left justify logging of pin_subdir and selinux_context am: 996684608c am: 49f224d178
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2143202

Change-Id: Id1ccdae5796da0185bd038c955fefbd4c84dd0da
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-03 23:14:03 +00:00
Maciej Żenczykowski
c6262ef7f6 bpfloader: provide a way to fail loading a bpf .o due to old version am: b57290a597 am: 19fd0aaedc
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2143200

Change-Id: I6d3b8592d64629373f425993adcf085fca768a9e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-03 23:13:53 +00:00
Maciej Żenczykowski
519d825150 grant bpfloader explicit membership in some groups am: bbf5ee3971 am: 9ecb84a4c7
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2143199

Change-Id: I6093374c55a0a09b1f022ecd47b0399edf829492
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-03 23:13:50 +00:00
Maciej Żenczykowski
49f224d178 bpfloader: left justify logging of pin_subdir and selinux_context am: 996684608c
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2143202

Change-Id: I73b84609945b935c65afde42c8529a52f852622a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-03 22:53:41 +00:00