Commit graph

112 commits

Author SHA1 Message Date
Joel Fernandes
2d8176917f bpfloader: Increase rlimit to 64MB
The rlimit was recently set to 8MB for bpfloader in
Change Id Ib97d1d304f4ea9a6215afed76e1c1e28f1415221

This could be causing intermittent failures to create maps, let us
increase it to 64MB for bpfloader.

Bug: 134558982

Change-Id: Iabb2e6c7d9ea3843ae28f2c465756e5aacdf1904
Signed-off-by: Joel Fernandes <joelaf@google.com>
2019-06-13 20:38:18 +00:00
Maciej enczykowski
0523615034 bpf_helpers.h - change unsafe_bpf_map_* to bpf_map_*_unsafe
am: c1d2e029f4

Change-Id: I0bc605748a9f6940ef854d34e0d7c4cf3bc60c11
2019-05-15 11:00:19 -07:00
Maciej Żenczykowski
c1d2e029f4 bpf_helpers.h - change unsafe_bpf_map_* to bpf_map_*_unsafe
Test: treehugger will, plus no other references found by:
  repo grep 'unsafe_bpf_map_(lookup|update|delete)_elem'
Bug: 132703771
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I59b8fe8f5a00fd005f466f8f2177a2e01cff58aa
2019-05-14 14:48:58 -07:00
Maciej enczykowski
c2925ab93e remove BPF_CONTINUE and BPF_DELETED constants
am: 546d8da936

Change-Id: I28ef70110ab534aa460eed65c47f24f0a174aafa
2019-05-01 23:06:47 -07:00
Maciej Żenczykowski
546d8da936 remove BPF_CONTINUE and BPF_DELETED constants
These are apparently not used anywhere, and this can be trivially
confirmed via code search.

Test: builds
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I738c83c1b00bf9a7d7344a4b31bf80581788ec10
2019-05-01 14:49:19 -07:00
Maciej enczykowski
12e464af18 Reapply "Provide a macro to define a map along with type safe accessors"
am: 28296961f6

Change-Id: I9dd0d6cc6c68f66dff49846f017ff8317d055bbb
2019-04-22 14:11:20 -07:00
Maciej Żenczykowski
28296961f6 Reapply "Provide a macro to define a map along with type safe accessors"
This reverts commit 4f3298db93.

Change-Id: Ibf410a56ec69ccc2c14591edcc8b9ede2a410bb4
2019-04-20 11:02:33 +00:00
Maciej enczykowski
f0b194b015 Revert "Provide a macro to define a map along with type safe accessors"
am: 4f3298db93

Change-Id: I5c20695ea6bb064f61af77c31b15588d1fdfcd9d
2019-04-20 03:23:45 -07:00
Maciej Żenczykowski
4f3298db93 Revert "Provide a macro to define a map along with type safe accessors"
This reverts commit 6564b8eac4.
2019-04-19 21:46:04 -07:00
Maciej Żenczykowski
16c3a374df Merge "Provide a macro to define a map along with type safe accessors"
am: edac9a3cc3

Change-Id: Ib6e1710736395205d69ea64dc4720e53bc96996a
2019-04-19 18:03:15 -07:00
Maciej Żenczykowski
edac9a3cc3 Merge "Provide a macro to define a map along with type safe accessors" 2019-04-20 00:28:02 +00:00
Chenbo Feng
66c542e319 Clean up the legacy loader
am: 097205c8e1

Change-Id: Id65faf429c9cbb46823bc807184d589496029838
2019-04-19 13:39:17 -07:00
Chenbo Feng
097205c8e1 Clean up the legacy loader
delete the loader code that is no longer used by any bpf programs.

Bug: 130206035
Test: build all the bpf related target.
Change-Id: I3ea4e40cb986b380f3b79a7685c3c09633e4d199
2019-04-19 19:51:30 +00:00
Maciej Żenczykowski
6564b8eac4 Provide a macro to define a map along with type safe accessors
Test: atest libbpf_android_test libnetdbpf_test netd_integration_test netd_unit_test netdutils_test resolv_integration_test resolv_unit_test
Bug: 130746652
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ib7a351ff876891a2296e32deebd0308ff9c7fcc8
2019-04-19 11:14:24 -07:00
Chenbo Feng
ff1fae89b5 Merge "Skip bpf object loading on unsupported devices"
am: ff22655028

Change-Id: I656b2ee299fcbff899d060ed3e82373f0b1d215d
2019-04-17 16:24:22 -07:00
Treehugger Robot
ff22655028 Merge "Skip bpf object loading on unsupported devices" 2019-04-17 23:03:39 +00:00
Chenbo Feng
b20d28df6a Skip bpf object loading on unsupported devices
The bpfloader should not try to load bpf objects on unsupported devices
since devices with 4.4 kernel can have bpf maps but not bpf pogram
support. Creating bpf maps on those devices would mislead the framework
code to use an unsupported code path and crash system server.

Bug: 130687855
Test: cuttlefish boot test for 4.4 kernel.
Change-Id: I43ffc01e1099ee3effaa6ba30aa78080d5bec72f
2019-04-17 21:40:39 +00:00
Joel Fernandes
b0d0de4f80 Merge "Add support for the bpf_probe_read_str bpf function"
am: fe5e7aa314

Change-Id: Icb6e46c103213c7367103f1dc85a5a46652b0556
2019-04-17 14:08:15 -07:00
Joel Fernandes
fe5e7aa314 Merge "Add support for the bpf_probe_read_str bpf function" 2019-04-17 19:09:32 +00:00
Joel Fernandes
1b8962af4c Add support for the bpf_probe_read_str bpf function
This is needed for the iorapd project (i/o readahead).

Change-Id: If6a3de682296bbce0fc808a0eced6bd778106292
Signed-off-by: Joel Fernandes <joelaf@google.com>
2019-04-17 15:37:18 +00:00
Chenbo Feng
a7aca77297 Add helper function to set rlimit for tests
am: 0a1a9a11d9

Change-Id: I6c71f8a79be2a8bd74405f1c850230e56e7afdfc
2019-04-09 23:08:12 -07:00
Chenbo Feng
0a1a9a11d9 Add helper function to set rlimit for tests
Add a helper function to set sufficient MEMLOCK rlimit
for bpf related unit tests.

Bug: 119279144
Bug: 129246448
Test: libbpf_android_test
Change-Id: I5390f4d3b21436abff69a661d1c6e6a6749542ed
2019-04-10 05:54:00 +00:00
Chenbo Feng
3dc9188861 Set bpfloader MEMLOCK rlimit to at least 8MB
am: ee121646cf

Change-Id: Ia8a8e30ac8a07722758e097877b2708896656dac
2019-04-09 13:10:38 -07:00
Chenbo Feng
ee121646cf Set bpfloader MEMLOCK rlimit to at least 8MB
Since bpfloader is only used to create the bpf maps and load bpf
programs on android devices. It is okay to set the MEMLOCK rlimit of
bpfloader to the proper size needed by bpf maps regardless of the global
device values. It helps partner to adopt the bpf feature without
changing the device configuration.

Bug: 119279144
Bug: 129246448
Test: remove device specific rlimit and build and verify bpf maps
created.

Change-Id: Ib97d1d304f4ea9a6215afed76e1c1e28f1415221
2019-04-09 12:04:33 -07:00
Maciej enczykowski
59747b9273 bpf_helpers.h - define more kernel provided functions
am: e1153fd1da

Change-Id: I96e1292bc57f26e92cf6c62967a37e39495aea74
2019-04-02 11:04:05 -07:00
Maciej Żenczykowski
e1153fd1da bpf_helpers.h - define more kernel provided functions
Test: builds
Bug: 65674744
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I88dcaf5edf61b780666f346e963a7417c04c97ec
2019-04-02 04:04:02 -07:00
Maciej enczykowski
bf68b18e07 BpfMap.getOrCreate(size, path, type) -> BpfMap.init(path)
am: 52108bf52c

Change-Id: I13be3fbdf9f0b9602a39d597e6434edea5bc62d3
2019-04-01 19:14:44 -07:00
Maciej enczykowski
9e330265db BpfMap - remove mPinnedPath, getPinnedPath, pinToPath
am: 04d88b7576

Change-Id: Iaf409b7898100d63e0511be264bf83381ff18e21
2019-04-01 19:14:37 -07:00
Maciej Żenczykowski
52108bf52c BpfMap.getOrCreate(size, path, type) -> BpfMap.init(path)
We don't have the appropriate selinux privs to create the maps anyway.

Test: builds (when combined with system/netd change)
      'git grep getOrCreate' in system/{bpf,netd} comes up empty
      atest netd_unit_test netd_integration_test libbpf_android_test
Bug: 65674744
Bug: 129654883
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Idffbce5b28b723943c6495cfafdecddc7a0f4e67
2019-04-01 16:54:08 -07:00
Maciej Żenczykowski
04d88b7576 BpfMap - remove mPinnedPath, getPinnedPath, pinToPath
Test: builds, git grep 'mPinnedPath|getPinnedPath|pinToPath' comes up empty
      atest netd_unit_test netd_integration_test libbpf_android_test
Bug: 65674744
Bug: 129654883
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Iad84ce7c74bef77e63cf63563d67b7501dd0165b
2019-04-01 16:54:08 -07:00
Maciej enczykowski
7885e42926 bpfloader depends on clatd.o
am: 7a3a5ba1ad

Change-Id: I42921c8fde3e75ee7d2ce24121004ae13638556d
2019-03-26 20:36:54 -07:00
Maciej Żenczykowski
7a3a5ba1ad bpfloader depends on clatd.o
Test: builds
Bug: 65674744
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I5c48acc6aed81c38650564d2fb42e6e816b4b726
2019-03-26 18:11:01 -07:00
Lorenzo Colitti
bd7cf3f302 Remove bpfloader dependency on netd.
am: ac600729b8

Change-Id: I9cfc80e863408f385214cff65ef52cc1d3a6d69b
2019-03-26 01:33:00 -07:00
Lorenzo Colitti
ac600729b8 Remove bpfloader dependency on netd.
This was necessary when the netd BPF program lived in system/bpf,
but it's no longer necessary.

Test: m
Bug: 65674744
Change-Id: I1fcf7e41276341b1258adf9d3795e81b6139f84f
2019-03-26 13:52:15 +09:00
Connor O'Brien
b827e50926 Merge "Remove time_in_state.o from build"
am: 1dc90cbfd3

Change-Id: Iedff4ef208c386e6cf85e5f0e1986e8771cf18a7
2019-03-22 18:31:54 -07:00
Treehugger Robot
1dc90cbfd3 Merge "Remove time_in_state.o from build" 2019-03-23 01:09:31 +00:00
Connor O'Brien
c551a76f45 Remove time_in_state.o from build
The data collected by this program currently has no consumers, so
there's no need to load it or include it in the bpfloader build yet.

Test: make bpfloader
Change-Id: I206d94e3da34dc3b81bdbfdd4a00b05cfb624f48
Signed-off-by: Connor O'Brien <connoro@google.com>
2019-03-22 16:19:25 -07:00
Chenbo Feng
f8b9dee2d8 Move netd specific program back to netd
am: 47e92158ca

Change-Id: Id77610beb224e678844379acf98557a0026179b7
2019-02-28 17:31:04 -08:00
Chenbo Feng
47e92158ca Move netd specific program back to netd
For the eBPF programs that only related to networking, move them back
to netd so for the future changes in networking eBPF area, there is not
need to make changes in both netd project and bpf project.

Bug: 112334572
Test: mmma -j32 system/bpf
Change-Id: Icd0efd165c60c055a00fe88705a0c8070c0d22f5
2019-02-26 15:41:00 -08:00
Xin Li
c6980d5ab4 DO NOT MERGE - Merge pi-dev@5234907 into stage-aosp-master
Bug: 120848293
Change-Id: I4f96f8351b170c9b438079080c7a3885237f1cf8
2019-02-20 16:20:06 -08:00
Chenbo Feng
d61ee6c7d8 Merge "Add detailed kernel version when checking bpf support"
am: 7dacd1b72a

Change-Id: I0bfbdd9ad561e9e4841d7ea96e1d84fd5f1019ff
2019-02-14 21:29:15 -08:00
Treehugger Robot
7dacd1b72a Merge "Add detailed kernel version when checking bpf support" 2019-02-15 05:26:35 +00:00
Joel Fernandes (Google)
1b9a6c52e1 netd: Use common BPF helper for C program
am: 14ba88881f

Change-Id: I8001088a9d0cc054d7fef2887fc8ef7bbf9e76cc
2019-02-14 13:52:14 -08:00
Chenbo Feng
79b7e61d49 Add detailed kernel version when checking bpf support
For devices with 4.14 kernel shipping with bpf feature, they support more
functionality compared to 4.9 kernels. So when checking if the device
supports a given bpf feature, return a bpf level dependent on the detailed
kernel version instead of a simple boolean. This information would be
useful when we support new features such as map_in_map and cgroup socket
filters.

Bug: 111441138
Test: libnetdbpf_test, netd_integration_test
Change-Id: Ib51a56a35643ad76b58987ba1938c69905d28141
2019-02-14 13:39:05 -08:00
Joel Fernandes (Google)
14ba88881f netd: Use common BPF helper for C program
The BPF helper is moved into system/bpf/include/ and is available
to all BPF programs in the include search path. Make use of it.

Only minor refactor, no functional change.

Bug: 122665156
Change-Id: Ib5b495aff83874d39abe3640fb369b2ff92b3239
Signed-off-by: Joel Fernandes <joelaf@google.com>
2019-02-12 17:20:20 -05:00
Joel Fernandes
3365e895ae Add tests for BPF loader
am: 4845288a6e

Change-Id: Ie7149e369c82ad251a6afe4c701c07d9269622d6
2019-02-04 15:05:47 -08:00
Joel Fernandes
4845288a6e Add tests for BPF loader
Bug: 112334572
Change-Id: I4457ee9ea3044c5c9ecb6ebfd5ad4f5a2c11dce5
Signed-off-by: Joel Fernandes <joelaf@google.com>
2019-02-04 15:28:52 -05:00
Suren Baghdasaryan
823ca6fd4e Remove hardcoded cgroup v2 path
am: 9217ccba51

Change-Id: If1a17a86cddee4cf9e35544006900a3584f82fab
2019-02-03 20:12:01 -08:00
Suren Baghdasaryan
9217ccba51 Remove hardcoded cgroup v2 path
Replace hardcoded cgroup v2 root path with new libprocessgroup API calls.

Bug: 111307099
Test: builds, boots

Change-Id: Ic9c47b52702767f9934f65d04bb91ab303b1d06e
Merged-In: Ic9c47b52702767f9934f65d04bb91ab303b1d06e
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-02-02 16:58:40 +00:00
Christopher Ferris
c0402548cd Fix compiler warnings.
am: c151c67412

Change-Id: I5ade2daddc0db4571d2c79ceb085bdf5e5632570
2019-02-01 17:54:15 -08:00