Really just spurious logging code.
If you're working on a device (as opposed to looking at bugreports)
you can get this information with for example 'bpftool':
$ adb shell bpftool map show pinned '/sys/fs/bpf/map_bpfRingbufProg_test_ringbuf'
77: ringbuf name test_ringbuf flags 0x0
key 0B value 0B max_entries 4096 memlock 16696B
$ adb shell bpftool prog show pinned /sys/fs/bpf/vendor/prog_filterPowerSupplyEvents_skfilter_power_supply
82: socket_filter name skfilter_power_ tag b8b4693584760391
loaded_at 2025-07-16T08:44:56-0700 uid 0
xlated 848B jited 470B memlock 4096B
Test: TreeHugger
Flag: EXEMPT cleanup
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie7baf7cf5df9c25ad2d159767584670361e8c6eb
Maciej Żenczykowskicommited 2025-07-16 08:47:49 -07:00
This was primarily meant as a safety check for mainline,
it's not really needed in platform bpf loader.
Test: TreeHugger
Flag: EXEMPT cleanup
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I615f54f10baa75f641129507ecce9159ff31a740
Maciej Żenczykowskicommited 2025-07-16 08:39:23 -07:00
Afterwards we still have:
I BpfLoader: Platform BpfLoader loading critical for healthd ELF object /vendor/etc/bpf/filterPowerSupplyEvents.o with license Apache 2.0
W BpfLoader: No maps section could be found in elf object
D BpfLoader: prog /sys/fs/bpf/vendor/prog_filterPowerSupplyEvents_skfilter_power_supply id 82
$ adbz shell ls -lZ /sys/fs/bpf /sys/fs/bpf/vendor
/sys/fs/bpf:
total 0
...
drwxrwxrwt 2 root root u:object_r:fs_bpf_vendor:s0 0 2025-07-15 23:53 vendor
/sys/fs/bpf/vendor:
total 0
-r--r----- 1 root system u:object_r:fs_bpf_vendor:s0 0 2025-07-15 23:53 prog_filterPowerSupplyEvents_skfilter_power_supply
Test: TreeHugger
Flag: EXEMPT no-op
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I66a6fc3abf8f5c4c52f6a47476c251e97f1f6e14
Maciej Żenczykowskicommited 2025-07-15 23:57:34 -07:00
(while at it remove fuse bpf support, which isn't needed for vendor)
Test: TreeHugger
Flag: EXEMPT no-op
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ic7293b94644d933a908a252ab794ae64f88b5865
Maciej Żenczykowskicommited 2025-07-15 23:50:52 -07:00
We want to read this from traced_probes, which is AID_NOBODY. And
SELinux does a far more thorough job of controlling access than Unix
permissions do.
Bug: 422976190
Test: ls -l, and checked WIP traced_probes implementation.
Change-Id: I51a6486c5d7bf85f922f79a89a7a7fbdb9bc79f2
Simon MacMullencommited 2025-06-30 08:54:29 -07:00
This will allow us to use a genfscon SELinux rule to get finer grained access control.
Bug: 422976190
Test: Recorded a Perfetto trace with statsd atom CPU_CYCLES_PER_UID_CLUSTER, tested manually with go/atomtester.
Change-Id: Ic16da605b9d7150d42176c428f0e1ecaf4a9472f
Simon MacMullencommited 2025-06-26 16:31:52 +00:00
no need for the complexity, as it is only for vendor now
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ia807f7ee8aeca25d92e60e46f180ffe536eef87c
Maciej Żenczykowskicommited 2025-06-17 04:18:41 -07:00
These directories are not populated on real devices
and are not part of the test suite.
This change removes them from the BPF loader.
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I719d0feb9ef1a6f0a1e41265af47916410590ac7
Maciej Żenczykowskicommited 2025-06-16 01:28:45 -07:00
Platform BPF programs rely on platform bpf_helpers.h and bpf_map_def.h.
To ensure consistency and correctness, the loader must use these platform
headers instead of those from p/m/Connectivity.
Bug: 424341374
Test: TH
Change-Id: Id5f1bc8fdd29e54c28a3ec9e01f6a9292f6bb9e1
C/C++ platform bpf loader is being replaced by rust version.
This test never had much value, and additional relies on
a sepolicy violation being allowed by su.
The bpf ring buf test is far better.
Test: TreeHugger
Flag: EXEMPT test code removal
Signed-off-by: Maciej Żenczykowski maze@google.com>
Change-Id: I448cc543aa9a0c161515ae2189020bf98db7bca3
Maciej Żenczykowskicommited 2025-05-22 14:10:18 -07:00
Before this CL, the kernel version check occurred after all programs
were loaded by `open_file.load()`.
This CL moves the check before `open_file.load()`. It calls
`prog.set_autoload(false)` for programs incompatible with the current
kernel, preventing their auto-load by libbpf.
Test: Verify the program is not loaded if the kver is out of range
Bug: 410982483
Change-Id: Ifacd9dd8696a7bb4fd186ad1faf01fba9f021c6d
Before this CL, the kernel version check occurred after all maps
were loaded by `open_file.load()`.
This CL moves the check before `open_file.load()`. It calls
`map.set_autocreate(false)` for maps incompatible with the current
kernel, preventing their auto-creation by libbpf.
Test: Verify the map is not loaded if the kver is out of range
Bug: 410982483
Change-Id: I7a102dd2ef4b24f87c6efa5a105848fddc08d501
libbpf creates an array map for the .rodata section to allow BPF
programs to access its data. However, the loader does not need
to pin this map as userspace processes do not require access to it.
This does not break existing code as the legacy bpfloader did not
create a map for .rodata.
Bug: 410982483
Test: TH
Change-Id: I036c93849731c25e8d1b6a2c1778ffc60935bbe2
Currently, the owner and group apply to each BPF object file.
However, each map and program can specify a different owner and group,
even if they are in the same BPF object file.
This is a no-op for existing timeInState.bpf
Bug: 410982483
Test: TH
Change-Id: I0fa2731385645e598b4d3bb7d27200dbb6d3a8ec
This is a no-op because maps and progs of timeInState are always loaded.
They have min_kver: KVER_NONE and max_kver: KVER_INF.
Bug: 410982483
Test: atest bpfloader_tests with next CL
Change-Id: I5db1909126fb3ca43939f39653f8a2334f130e94
This is a no-op because maps and progs of timeInState are pinned under
/sys/fs/bpf/ and this directory already exists.
Bug: 410982483
Test: timeInState.bpf loaded successfully
Change-Id: Ied42ebcbde5c8727f19c31b8dc9930dac2ef5f79
The "dir" field specifies the directory where the BPF file is located.
The "prefix" field specifies the subdirectory under
/sys/fs/bpf/ where maps and programs are pinned.
These fields are required for memevents and vendor bpf.
This CL is a no-op for the existing timeInState.bpf loading
Bug: 410982483
Test: timeInState.bpf loaded successfully
Change-Id: Ic509b19490b9561173f84ace10d68c7725f8055b
This flag has already been released, so the code path
for its disabled state can now be removed.
Test: TH
Bug: 359646531
Bug: 410982483
Change-Id: Ia211fe240e6687e00470a9fb9350a2a7ae089580
this has moved to mainline via apex
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I77e6ae3248ce1aa1ee20c9ab834516053cac5d16
Maciej Żenczykowskicommited 2025-03-10 18:24:05 -07:00