We no longer support mainline on R,
hence checks for R are not required.
We don't want any S vs Sv2 and 25Q2 vs 25Q3 differentiation.
Test: TreeHugger
Flag: EXEMPT PURE_REFACTOR
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I746b404520ccb12fddf02c6956d7cf1824f21bbd
Maciej Żenczykowskicommited 2025-09-13 03:28:18 -07:00
This seems to be the most common usecase.
Test: TreeHugger
Flag: EXEMPT PURE_REFACTOR
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I2de4d067b2f20680539cbddb31555864bcf957b1
Maciej Żenczykowskicommited 2025-09-12 10:14:12 -07:00
(also tested with a hack to make isAtLeast26Q2 true)
Test: TreeHugger
Flag: EXEMPT TEST_ONLY
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Id1ef5b03cdc27b6d74d6b5bd76692186809e9658
Maciej Żenczykowskicommited 2025-09-12 07:29:24 -07:00
As of M-2025-11 mainline is only being pushed to S+
Test: TreeHugger
Flag: EXEMPT test only
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Id0cf9d2cce27fb90ce076fcdd0f6ee0a95ea9741
Maciej Żenczykowskicommited 2025-08-26 09:56:45 -07:00
This is an array of two ints:
- index 0 should have value 0
(a value of 1 implies a kernel uapi bug)
- index 1 should have value 123
(a value of 0 implies bpf array writes at non-zero index fail)
Note that these bugs can only be present on Android S & Sv2,
as these kernel bugs are considered fatal on Android T+.
(btw. we need to do this write manually as we cannot write into
maps we pin and then reopen - due to sepolicy)
Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I9b2ada7f3e299014d39461a8d0718396daf0c91a
Maciej Żenczykowskicommited 2025-06-17 01:49:23 -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
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
Adding map local_net_blocked_uid_map, which will store uid for
the applications that have opted in but do not have the required
permission. The entry would be absent or the value would be false if the
application is allowed to access local network.
Test: Manually populating the values and checking EPERM error.
Bug: 390168818
Change-Id: Idf6caff204295a3f0aa7f552ea4af50bfd2df78c
Sarup Dalwaniauthored and Maciej Żenczykowskicommited 2025-01-22 17:14:10 -08:00
local_net_access is of type BPF_MAP_TYPE_LPM_TRIE (longest prefix
matching map) which stores interface index, remote address, protocol
and remote port. Lookup method is_local_net_access_allowed() returns
false if the arguments are found in the map and disallowed, otherwise
it returns true.
Test: Locally tested by adding values from userspace and querying the
bpf map.
Bug: 373608779
Change-Id: Ia34b3cb5613b56f6db5b224ec03f8c9909a49fe1
Sarup Dalwaniauthored and Maciej Żenczykowskicommited 2025-01-22 14:20:29 -08:00
will land in M-2025-01
should fix some long standing cookie_tag_map full issues
(due to the userspace socket destroy listener code failing to run - likely due to buffer overflow)
Bug: 364365891
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: If78c335488eadf605a54f20005d9b14fdadb6473
Maciej Żenczykowskicommited 2024-09-23 20:21:40 +00:00
Since this is just a special case of a bpf cgroup hook,
it really should be in netd.o with all other such hooks.
Besides moving/renaming the map & programs this should be a no-op.
Test: TreeHugger, atest bpf_existence_test
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I4a2aedaf77f89a9c0a96fa1c369d80659535eabe
Maciej Żenczykowskicommited 2024-09-19 00:40:53 +00:00
We're not currently using this XDP program, and it really only tests
bpfloader functionality, but with that being mainline it just doesn't
matter anymore.
It's not like we'll spontaneously decide to ever use XDP on devices
without some sort of per-device opt-in: too much could go wrong.
Unfortunately the Android S bpfloader has to be able to load test.o,
and it may fail if there is no prog section.
So we add a trivial 'placeholder' skfilter_match program, so that there
is at least 1 program in the file (and thus a 'prog' section exists).
Alternatively we could also probably just force an empty 'prog' section,
but this approach seems way easier...
Test: TreeHugger, atest bpf_existence_test
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I1d2fb8ceb33871c915d3f3d4fe6f2d811781a0c4
Maciej Żenczykowskicommited 2024-09-06 04:18:02 +00:00
Another step towards moving all bpf related stuff into a common directory,
which will ease development.
I want to refactor this test so that it can also be run as a self-test
in UML (for testing bpfloading functionality across a large variety of
Linux kernel (both major and minor LTS) and Android (API/SDK level)
platform versions.
Bug: 205608149
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Idc9104783b2fa60626e9c1fd463c4d94fd4a908c
Maciej Żenczykowskicommited 2024-08-26 16:19:48 -07:00