`ignore_on_*` directives haven't been used in a while and require a special version of bpfloader. Remove them.
While doing so, pad the `map_def` and `prog_def` structs, to maintain existing size.
Note: The mainline shipped bpf .o files are now in a location
that no platform bpfloader ever looked/looks at.
As such maintaining .o format compatibility with older release
is not needed.
Test: TreeHugger
Flag: EXEMPT dead code removal / mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I485c9645bdece2ad27add08347688d0f1c93e5d2
Maciej Żenczykowskicommited 2025-05-20 15:02:15 -07:00
should be unused
Test: TreeHugger
Flag: EXEMPT dead code
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ice72d940dd3492d2b9e14dd32390a49f87bd54d1
Maciej Żenczykowskicommited 2025-05-20 08:45:15 -07:00
This is to identify if it actually happens.
It is expected not to happen, because we now pin every map and are run only once on boot.
Test: TreeHugger
Flag: EXEMPT dead code
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie46ace40f20fb4b061a91cd53f8256caebdfa71f
Maciej Żenczykowskicommited 2025-05-20 06:41:18 -07:00
This code should be dead. Abort to see whether it is.
Test: TreeHugger
Flag: EXEMPT dead code
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ib5309ff683339e70bc44e135578ede75548b022d
Maciej Żenczykowskicommited 2025-05-20 06:38:57 -07:00
This is basically a no-op as 32-bit netd already fails on android-mainline @ 6.13 (we're now at 6.14, 6.15 is coming in a few weeks).
I know this because we had to fix ACK 6.12, and didn't port it forward.
Note: AFAIK TV is planning to release on 25Q2 and then 27Q2,
so this 26Q2+ doesn't actually affect them till a year later in 27Q2.
Modern arm cores are dropping 32-bit cpu instruction decode support.
This already happened on Pixel 8+ (Tensor G3+) and is soon coming
to the GCE cloud machines underpinning our cuttlefish VMs
(this is very much an industry wide trend for modern aarch64 cores,
I believe all new application cores since 2023 have been 64-bit only).
Pixel 6a is AFAIK the last pixel with 32-bit application support,
and that is reaching EOL approximately in July 2027.
(while most test coverage is on Pixel 6/6pro which EOLs in Oct 2026)
Note though that this isn't a great example: AFAIK all Pixels
have had 64-bit system userspace (which is what we care about here)
The transition happened in the final Nexus, the year before Pixel 1.
This means we're going to start losing *any* remaining vestiges
of test coverage that we still (might) have.
Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie8a5a5dafd2f0e20ef4651c3a69957fde374ae4b
Maciej Żenczykowskicommited 2025-05-17 06:00:03 -07:00
The .rc file is just a placeholder, and isn't
truly used, so just move the documentation over
into the apex location which is actually used.
Test: TreeHugger
Flag: EXEMPT comments only
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I505b90f27208ac5b217aca949b8ef044d3a39226
Maciej Żenczykowskicommited 2025-05-15 03:51:57 -07:00
The full set of 5 .o's is known at build time, and basically almost
never changes (and indeed is likely to shrink, with clatd.o merged
into offload.o && dscpPolicy.c merged into netd.c).
We might as well just code this knowledge straight into the mainline
loader.
This also allows us to move all the files to an apex subdirectory
that old platform bpfloaders don't even look at, which eliminates
the need for any backward compatibility with them.
Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie3d27178c31a68ed7cf5173b5983ad3009a3cf94
Maciej Żenczykowskicommited 2025-05-15 01:38:16 -07:00
Netd bpf requires 5.10 at least in 25Q4.
This CL enforces that.
Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I76e52b2a2702a2a6ce761a947a0749ea798778b6
Maciej Żenczykowskicommited 2025-05-06 05:28:23 -07:00
Since all mainline bpf code is now loaded by NetBpfLoad, compatibility with platform bpfloader simply doesn't matter any more.
Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Id96e3e6a4dac485f3e707cc9e6c4b05a4f9389d7
Maciej Żenczykowskicommited 2025-05-06 02:59:51 -07:00
Add 25Q3, 25Q4, 26Q1 and 26Q2 SDKs to the bpfloader helpers. The Q3 and
beyond versions are not finalized, so they are not being populated in
BpfUtils.h yet, but at least the logic is in place.
Test: TreeHugger
Flag: EXEMPT test code
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I6ea12e347462be2c8258a4fe5bc994b35d4065a5
Maciej Żenczykowskicommited 2025-05-06 02:55:33 -07:00
The lambda was capturing btf by value instead of reference. This meant
that btf__free was never called, because at the time of capture btf was
null.
This changes the lambda to capture btf by reference instead of by value.
Test: TH
Flag: EXEMPT mainline
Bug: 411323352
Change-Id: I6c6637b10f16d48f9ae5b702e44883046b46e252
This code requires
!isArm()
isUserspace32bit()
isAtLeastKernelVersion(6, 7, 0)
which implies
isAtLeastKernelVersion(6, 2, 0)
meaning we match the condition in 1801,
and don't match the isArm() conditions in 1803/1806/1810,
thus we'd have already 'returned 1' in line 1815.
Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I234ba91b9bdbfeaf1077eac64248d3ebfe2f2cd2
Maciej Żenczykowskicommited 2025-04-15 13:48:19 -07:00
BTF_KIND_VAR and BTF_KIND_DATASEC were introduced in 5.2.
It should be possible to enable BTF on 4.18 or above since libbpf can
load BTF.
Also, current code should work on 5.4 but this is untested.
For now, this CL enables BTF on 5.10 or above.
Test: boot on 4.9, 4.19, 5.10
Test: adb logcat | grep NetBpfLoad
Change-Id: I3da4970464afcf9a76b1f2645ed79c44750bcd6a
Since btf is declared in inner scope, btf is null in outer scope and BTF
was always disabled.
This CL also makes NetBpfLoad buildable with -Wshadow flag
Test: adb log | grep NetBpfLoad
Change-Id: I511f21a3620ccfdadd797786e087d0d142c816ed
One ALOG to record whether the map is created by btf or not.
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I5da3af67ba28b01ee4e7b08e61f1fedc24e2840f
Maciej Żenczykowskicommited 2025-03-18 23:01:20 -07:00
BPF_ANNOTATE_KV_PAIR is used to tell the bpf loader about the btf
key_type and value_type of a bpf map.
This CL adds a method to get key value type ids from
BPF_ANNOTATE_KV_PAIR
Bug: 403381101
Test: boot
Change-Id: If308d49b64b38f65991a0a8177e5072d54e2cdf6
Motomu Utsumiauthored and Maciej Żenczykowskicommited 2025-03-18 12:15:39 -07:00
size in btf_type of BTF_KIND_DATASEC is 0 at compilation time.
So bpf loader needs to update to actual size based on ELF's section
size.
Bug: 403381101
Test: boot
Change-Id: I78fb26a5b8eeb120044b5737667f472fac51d79f
Motomu Utsumiauthored and Maciej Żenczykowskicommited 2025-03-18 11:46:16 -07:00
Test: TreeHugger, manually installing tethering apex
(with and without dnsresolver apex) on pixel 6 running S
incl. 'atest bpf_existence_test'
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I63d4b84287e9c98dc0d2a517ac58d3f3ce9d7760
Maciej Żenczykowskicommited 2025-03-05 14:27:59 -08:00
This reverts commit 0e9b0e05c6.
Reason for revert: needs a .31rc specific version instead.
Will merge the required changes into the followup commit.
Change-Id: I01e9dfee4aaabc3ddab39da7519b7d9963b84124
Maciej Żenczykowskicommited 2025-03-04 21:54:09 -08:00
By itself this change is a no-op, as we don't actually *yet* start mdnsd_netbpfload.
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ic7665b3dd5716bd3bbdc96450a42e9b0c26441c9
Maciej Żenczykowskicommited 2025-03-04 14:21:46 -08:00
Failure to jit means a buggy in kernel eBPF JIT implementation.
This cannot fail on a 64-bit kernel, because VINTF requires
kernel configuration option CONFIG_BPF_JIT_ALWAYS_ON.
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I10cf7ff86bba6d3571ba919300024947446f1bb6
Maciej Żenczykowskicommited 2025-02-14 11:22:13 -08:00
This should always work on 4.14+
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I50fc17ff5b77f279cb741d6ef72e0519733ec881
Maciej Żenczykowskicommited 2025-02-14 11:18:18 -08:00
The function is not available in older kernels.
But when we do call it, fail on error - should not happen.
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I2695bf01762abcbc087a3bd67f1718e0e326576a
Maciej Żenczykowskicommited 2025-02-13 16:10:48 -08:00
for consistency with 3 other spots
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I726c314cbf70e3a9c09d4f95cf79109db38b59f7
Maciej Żenczykowskicommited 2025-02-13 16:05:07 -08:00