Chih-Hung Hsieh
ef3f44b639
Disable tidy DeprecatedOrUnsafeBufferHandling check
...
This check is disabled in global default,
see build/soong/cc/config/tidy.go.
This bpf_defaults is used to compile an external/bcc module.
Unless all such warnings can be fixed in the external/bcc source,
we should not enable this check locally.
Test: presubmit; make tidy-external-bcc_subset
Change-Id: I97f6dd944dfb21fed664175c5c7eec02c10ebe4c
2023-01-09 10:58:19 -08:00
Maciej Żenczykowski
4fba4f7a22
Merge "Add option to skip map/prog based on build type"
2022-12-20 08:38:45 +00:00
Ryan Zuklie
ce89f50035
Add option to skip map/prog based on build type
...
This feature allows skipping a program or map based on the type of the
build. This allows things like userdebug-only programs.
Bug: 246985031
Test: added test program and watched it skipped on userdebug
Change-Id: I981e3447b40751926cbfd1692e13772ec582d3d4
2022-12-19 14:39:31 -08:00
Maciej Żenczykowski
300c51fd4f
bpfloader - fix includes
...
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I3c46875a34b744c9ff0af2b52b63ecbc9db5c15e
2022-12-19 19:14:33 +00:00
Treehugger Robot
4a7ca6f2b1
Merge "bpfloader - allow writeProcSysFile failure on misconfigured kernels"
2022-12-14 09:36:57 +00:00
Maciej Żenczykowski
98ac2b9ffd
Merge "include BpfSyscallWrappers.h"
2022-12-14 08:55:43 +00:00
Maciej Żenczykowski
8aa34a756c
bpfloader - allow writeProcSysFile failure on misconfigured kernels
...
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I20c486ab89669c60cf1e1ebc3a5d66ef0efc1389
2022-12-14 07:43:27 +00:00
Maciej Żenczykowski
052cda1973
bpfloader - add writeProcSysFile failure mode comment
...
as discovered on some sunfish 4.14 kernels
Note that CONFIG_BPF_JIT=y is required for 4.14-r,
but sunfish was 4.14-q and thus missed VINTF enforcement of this
(it was enabled for b1c1[blueline/crosshatch]/bonito & floral[flame/coral]).
Bug: 262115216
Test: N/A, comment only
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: If6ee9f7f9e449526602fd0e5cffd49f132e681a2
2022-12-12 00:22:27 +00:00
Maciej Żenczykowski
4e4dea008e
include BpfSyscallWrappers.h
...
Change-Id: Ia0d6941cd461089584e539e007b1e8b2873d095f
2022-12-10 17:59:05 +00:00
Maciej Żenczykowski
b909fed62a
Merge "bpfloader: pass whole struct Location to loadProg()"
2022-12-10 10:24:43 +00:00
Treehugger Robot
a9b54078f4
Merge "Add a test BPF program with a ring buffer."
2022-12-10 02:27:06 +00:00
Connor O'Brien
6c0ce9f17a
bpfloader: pass whole struct Location to loadProg()
...
Simplify the loadProg() interface by passing struct Location instead
of passing its fields as separate arguments. Move struct Location into
libbpf_android.h to accommodate the change.
Change-Id: I39834b2645d38ba4c2eb5ea901a3da0f56a1912c
Signed-off-by: Connor O'Brien <connoro@google.com>
2022-12-09 15:07:37 -08:00
Treehugger Robot
bfd31a3c79
Merge "libbpf_android: remove native_bridge_supported from Android.bp"
2022-12-09 20:29:42 +00:00
Treehugger Robot
2393f1df4d
Merge "bpfloader - move sysctl setting from rc to binary"
2022-12-09 20:25:48 +00:00
Ryan Zuklie
657482041f
Add a test BPF program with a ring buffer.
...
This adds an example BPF program with a ring buffer. The program using
the ring buffer is limited to kernel versions 5.8 and above (the same as
the ringbuffer internally). The program is marked critical to ensure
that the platform can support ringbuffers in the bpfloader.
This is only done for userdebug builds currently since tests that use it
can only be run in userdebug builds and statically allocates a 4KB ring
buffer.
Bug: 246985031
Test: build and flash on 4.19 and 5.10
Change-Id: I3cdb4a03051f832915bb784d43c01392c087f54c
2022-12-09 11:02:46 -08:00
Maciej Żenczykowski
9836896064
BpfLoader - create /sys/fs/bpf/loader am: ebfacde967
...
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2327675
Change-Id: I1d9bfee78db171f0a380e7917608b9d2989e63ce
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-12-09 09:51:49 +00:00
Maciej Żenczykowski
03b6caadb6
bpfloader - move sysctl setting from rc to binary
...
this allows tightening the sepolicy for 'proc_bpf' in:
https://android-review.git.corp.google.com/c/platform/system/sepolicy/+/2323635
'sepolicy - move proc bpf writes from bpfloader.rc to bpfloader binary'
While we're at it, this also allows us to actually verify
that these sysctls are being successfully set.
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ibde9d817b690395e3eb12f6b5acdf3060aca67b9
2022-12-08 15:46:25 +00:00
Maciej Żenczykowski
ebfacde967
BpfLoader - create /sys/fs/bpf/loader
...
we also take this opportunity to enforce that all the
directory creations actually succeed (there really
is no reason why that could fail though)
Test: TreeHugger, manually inspected /sys/fs/bpf contents on cuttlefish
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Icd7c1e6eba5736a58cf81476ddafc70df2807dd4
2022-12-05 15:57:00 +00:00
Connor O'Brien
3141d5e2c0
libbpf_android: remove native_bridge_supported from Android.bp
...
This is a holdover from when libmeminfo depended on libbpf_android, a
dependency which has since been removed. Deleting it allows
libbpf_android to use libvintf, which will be used to identify a
device's kernel branch for BPF attach point enforcement.
Test: build
Change-Id: I73747e04c2a843652859e4fb753bd5afdedba1cd
Signed-off-by: Connor O'Brien <connoro@google.com>
2022-12-03 12:16:31 +00:00
Maciej Żenczykowski
c182b6a724
Bpfloader - minimal fs_bpf_loader support am: 9a2093d38c
...
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2323445
Change-Id: Ic29b62cabce205cceb8ee260ef0fa8e9ef7b5114
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-12-03 09:46:59 +00:00
Maciej Żenczykowski
9a2093d38c
Bpfloader - minimal fs_bpf_loader support
...
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I8090de18b50a717f77d3fddab62a611888aa1521
2022-12-02 13:51:25 +00:00
Maciej Żenczykowski
fade2c6e0e
bpfloader - remove dead code am: 90a866ed34
...
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2268766
Change-Id: I3a4938b083953bfbf43f6cdaa02cc6aa90db94f3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-25 22:35:21 +00:00
Maciej Żenczykowski
90a866ed34
bpfloader - remove dead code
...
As with Android U we know the kernel is at least 4.14
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I789d5e8c9b0fe9e2200f716034d1ec1151f258dc
2022-10-25 09:21:12 +00:00
Maciej Żenczykowski
08e5ed863c
require a bpf program definition am: 5c79165bb2
am: 28a735510a
am: 86f7c0b362
am: 11ba91e10c
...
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2172788
Change-Id: I7469293105b361121f13989f5e307b9d3deb46fc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-08 19:09:29 +00:00
Maciej Żenczykowski
11ba91e10c
require a bpf program definition am: 5c79165bb2
am: 28a735510a
am: 86f7c0b362
...
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2172788
Change-Id: Idf61010c935933395e519782ee03f8ae7e06d7cc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-08 18:46:04 +00:00
Maciej Żenczykowski
86f7c0b362
require a bpf program definition am: 5c79165bb2
am: 28a735510a
...
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2172788
Change-Id: I15b3c0b7e01a73b460969c495bcc9590fe08fa9d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-08 18:29:13 +00:00
Maciej Żenczykowski
28a735510a
require a bpf program definition am: 5c79165bb2
...
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2172788
Change-Id: Ie753012c419171767dc075b442a3431a0fbf47a2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-08 18:02:32 +00:00
Maciej Żenczykowski
5c79165bb2
require a bpf program definition
...
(it should always be present with current tooling)
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ib7ec357cc63d8db251abdf7f7d4b41bb2aabe104
2022-08-04 06:38:42 +00:00
Maciej Żenczykowski
9550d98dce
[automerger skipped] detect inability to write to index != 0 of bpf map array am: ead9d83423
-s ours am: c70682351b
-s ours
...
am skip reason: Merged-In I0cad47113a83dbd837cccc5229ef52b605cda203 with SHA-1 aba9024849
is already in history
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/bpf/+/19467163
Change-Id: Ica84b84a3831065e8a347b1db3486172721bc224
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-02 03:35:27 +00:00
Maciej Żenczykowski
906bbeabfe
[automerger skipped] detect inability to write to index != 0 of bpf map array am: ead9d83423
-s ours am: 52121cd0ee
-s ours
...
am skip reason: Merged-In I0cad47113a83dbd837cccc5229ef52b605cda203 with SHA-1 810b49a74e
is already in history
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/bpf/+/19467163
Change-Id: Ibb98b2b4b0b23d8a504559f5eb830f988a651c58
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-02 03:35:01 +00:00
Maciej Żenczykowski
52121cd0ee
[automerger skipped] detect inability to write to index != 0 of bpf map array am: ead9d83423
-s ours
...
am skip reason: Merged-In I0cad47113a83dbd837cccc5229ef52b605cda203 with SHA-1 810b49a74e
is already in history
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/bpf/+/19467163
Change-Id: I644cf6ed26d7714b56a710b27f63c5bded17bdfc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-02 03:19:26 +00:00
Maciej Żenczykowski
c70682351b
[automerger skipped] detect inability to write to index != 0 of bpf map array am: ead9d83423
-s ours
...
am skip reason: Merged-In I0cad47113a83dbd837cccc5229ef52b605cda203 with SHA-1 aba9024849
is already in history
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/bpf/+/19467163
Change-Id: Idd7d88d303b6c9d683a4598ab31f08cf5a7e314b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-02 03:19:25 +00:00
Maciej Żenczykowski
2446443dc1
[automerger skipped] detect inability to write to index != 0 of bpf map array am: 810b49a74e
-s ours
...
am skip reason: Merged-In I0cad47113a83dbd837cccc5229ef52b605cda203 with SHA-1 aba9024849
is already in history
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/bpf/+/19467158
Change-Id: Id00a150ab946c1a24cdc83fe7a0b145925076df1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-01 01:11:05 +00:00
Maciej Żenczykowski
ead9d83423
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
(cherry picked from commit aba9024849
)
Merged-In: I0cad47113a83dbd837cccc5229ef52b605cda203
2022-07-29 10:39:50 +00:00
Maciej Żenczykowski
810b49a74e
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
(cherry picked from commit aba9024849
)
Merged-In: I0cad47113a83dbd837cccc5229ef52b605cda203
2022-07-29 10:17:26 +00:00
Treehugger Robot
d89a930475
Merge "detect inability to write to index != 0 of bpf map array" am: 515bf77a8a
am: 199dce675c
am: 730471caac
am: 91bb1c9f5e
...
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2168142
Change-Id: Ib3c8b5454cc761c34b9c79c4c7547445c1c1e375
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-29 03:10:36 +00:00
Treehugger Robot
91bb1c9f5e
Merge "detect inability to write to index != 0 of bpf map array" am: 515bf77a8a
am: 199dce675c
am: 730471caac
...
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2168142
Change-Id: I95e4653912bd8267bd2071f8e38657b4ac3176d9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-29 02:47:39 +00:00
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
ec9897ffcd
Merge "Add fuse prog types to allowed prog types from system" am: 73d8f14525
am: 883867d94d
am: 94a6b5239d
am: f1fe48cf38
...
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2164582
Change-Id: Ia158d4a2a8e902ffc9d60f6be611e57ed75e1064
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-27 21:19:22 +00:00
Paul Lawrence
f1fe48cf38
Merge "Add fuse prog types to allowed prog types from system" am: 73d8f14525
am: 883867d94d
am: 94a6b5239d
...
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2164582
Change-Id: Ic6c42698a3c78e9e876cf3196624e638710c8e3e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-27 20:42:35 +00: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
307460a1f4
Make sure that BPFLOADER_VERSION >= COMPILE_FOR_BPFLOADER_VERSION am: b3dcc14182
am: 3d97f1532b
am: 78d28d0aef
am: d4008576b9
...
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2164742
Change-Id: I35a27491fd32253c64d071e991b29a3c1b65a060
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-25 21:05:26 +00:00
Maciej Żenczykowski
d4008576b9
Make sure that BPFLOADER_VERSION >= COMPILE_FOR_BPFLOADER_VERSION am: b3dcc14182
am: 3d97f1532b
am: 78d28d0aef
...
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/2164742
Change-Id: I560596c55660fef553144509741fad5a6fc22bc4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-25 20:40:12 +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