Commit graph

108,829 commits

Message SHA1
Add NetSecConfigCertificateTransparencySctNoLogListTestCases to
networksecurity TEST_MAPPING

Now that ag/31339357 has been merged, the "no log list present" test
cases can now be added to the NetworkSecurity presubmit.

Bug: 378424118
Bug: 378423774
Test: atest --test-mapping packages/modules/Connectivity/networksecurity
Change-Id: Id72bf93657ea7257e37a52a42294bcd90b56591c

Bessie Jiang   commited 2025-01-22 19:41:18 +00:00
f449f91537
bpf_helpers.h: update KVER constants
4.9 and 6.12 are LTS kernels - add them
5.8 is not, and the constant is no longer used - remove it

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I1f0d8dd08e331412eaddeaf86b1435f9cf7d15db

Maciej Żenczykowski   commited 2025-01-22 09:26:47 -08:00
6e0a11adcc
Merge "Add support for Base64 encoded signature" into main
Sandro Montanari   authored and   Gerrit Code Review   commited 2025-01-22 05:43:12 -08:00
3816ebad4c
BpfMap: add some messages on abort()
automatically enable these messages in test code and in GTS
(which already sets the BPFMAP_VERBOSE_ABORT define)

Bug: 379821131
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I84dc142e7875a80fa18b4783c1d0d39b31b8aaad

Maciej Żenczykowski   commited 2025-01-21 22:12:58 -08:00
79934dd18f
cts: skip some ApfIntegrationTest's on Cuttlefish
Due to lack of implementation of an actual APFv6 runner in the emulator,
these tests simply don't work yet, so for now, turn them off.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ibc1ed733c935749bd0ca2034b6868f5a897c0e7f

Maciej Żenczykowski   commited 2025-01-21 21:09:32 -08:00
4726c90d0e
Merge changes Ia2bbd089,I875d3451,Iaf03395a,I83df3ce9 into main
* changes:
  bpf netd: 25q2 specific bpf_owner_match()
  bpf netd: introduce 25Q2 specific cgroupskb/egress/stats programs
  bpf netd: introduce 25Q2 specific cgroupskb/ingress/stats programs
  bpf netd: better document cgroupskb/{e,in}gress/stats programs

Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2025-01-21 21:07:33 -08:00
a9bb0371c3
Merge "Ensure consistent payload comparison by sorting" into main
Yuyang Huang   authored and   Gerrit Code Review   commited 2025-01-21 20:19:38 -08:00
3ff1a6ed5b
Merge "Fix Flaky testTrafficStatsForLocalhost" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-01-21 20:18:44 -08:00
059554cd04
bpf netd: 25q2 specific bpf_owner_match()
(makes room for 25q2+ sdksandbox localhost restrictions,
 without increasing program complexity and thus bpf verifier
 run time on older devices)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ia2bbd089467459754c4f6eabd90a3ea51cec6b98

Maciej Żenczykowski   commited 2025-01-21 19:37:06 -08:00
34cd3cde16
bpf netd: introduce 25Q2 specific cgroupskb/egress/stats programs
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I875d3451063cc322fe998db29ffeeabf7c9f3ec8

Maciej Żenczykowski   commited 2025-01-21 19:12:05 -08:00
f1efc29160
bpf netd: introduce 25Q2 specific cgroupskb/ingress/stats programs
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Iaf03395a22b7c8f8ffafb1c183b5e562e91a49f6

Maciej Żenczykowski   commited 2025-01-21 19:12:05 -08:00
85d7858007
bpf netd: better document cgroupskb/{e,in}gress/stats programs
The existing '4_14' is *wrong* as these programs are present
and successfully loaded on 4.9 T devices.
However, it is just a name and thus doesn't actually matter.

Changing SDK_LEVEL_NONE to SDK_LEVEL_T is a no-op, since netd.c
was only mainlined starting with Android T.
(the entire mainline provided netd.o isn't loaded by pre-T bpfloader)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I83df3ce9eee72d4f67643084ebf56fb316e2a21e

Maciej Żenczykowski   commited 2025-01-21 19:12:05 -08:00
cf40668b43
Ensure consistent payload comparison by sorting
The device may transmit multiple packets in the order different from what is programmed in the APF.
This can lead to flaky test results due to variations in the payload order.

Bug: 391468682
Test: atest CtsNetTestCases:android.net.cts.ApfIntegrationTest#testReplyPing
Change-Id: I1ee298e69137282a7f1c570711d29d0a930ce718

Jimi Chen   commited 2025-01-22 03:11:56 +00:00
8983b3af92
Merge "bpf netd: eliminate TRACE_ON/OFF" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2025-01-21 19:09:46 -08:00
d68f29fbed
Merge "Add methods to distinguish TetheringRequest types" into main
Quang Luong   authored and   Gerrit Code Review   commited 2025-01-21 17:57:31 -08:00
134d017940
bpf netd: eliminate TRACE_ON/OFF
(TRACE_ON is now simply KVER >= 5.10)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I62e69c0841754a44e4ec33800709eda1e7d421d4

Maciej Żenczykowski   commited 2025-01-21 17:53:00 -08:00
ed91c282f7
Merge changes Ie660ab98,If1066f10 into main
* changes:
  bpf netd: introduce DEFINE_NETD_BPF_PROG_RANGES() macro
  bpf netd: hardcode AID_ROOT/AID_ROOT in DEFINE_NETD_BPF_PROG{,_KVER,_KVER_RANGE}

Treehugger Robot   authored and   Gerrit Code Review   commited 2025-01-21 17:50:38 -08:00
91748dec07
Merge changes I4a3d0a27,I032c8d93,I9efd5ea3 into main
* changes:
  bpf netd: hardcode AID_ROOT/AID_ROOT in DEFINE_NETD_V_BPF_PROG_KVER
  bpf netd: hardcode AID_ROOT/AID_NET_ADMIN in DEFINE_SYS_BPF_PROG
  bpf netd: hardcode AID_ROOT/AID_NET_ADMIN in DEFINE_XTBPF_PROG

Treehugger Robot   authored and   Gerrit Code Review   commited 2025-01-21 17:49:57 -08:00
a4344aea90
Merge "bpf netd: change stats programs gid from AID_SYSTEM to AID_ROOT" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-01-21 17:46:40 -08:00
60cd2e5c15
bpf netd: introduce DEFINE_NETD_BPF_PROG_RANGES() macro
(for simplification, more uses in coming commits)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie660ab98d2326d9eec6b5032c449ea5bf715a9b0

Maciej Żenczykowski   commited 2025-01-21 16:40:20 -08:00
40c967577d
bpf netd: hardcode AID_ROOT/AID_ROOT in DEFINE_NETD_BPF_PROG{,_KVER,_KVER_RANGE}
(no other value makes sense anyway)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: If1066f10a62d650b0f1fef4b0103288a53b48a2a

Maciej Żenczykowski   commited 2025-01-21 16:38:44 -08:00
871e4bab17
bpf netd: hardcode AID_ROOT/AID_ROOT in DEFINE_NETD_V_BPF_PROG_KVER
(no other value makes sense anyway)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I4a3d0a279d2abe50bb8353267b951c02fd49d5af

Maciej Żenczykowski   commited 2025-01-21 16:38:23 -08:00
cb46999cec
bpf netd: hardcode AID_ROOT/AID_NET_ADMIN in DEFINE_SYS_BPF_PROG
(no other value makes sense anyway)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I032c8d9355fd18f1d656eb6b0c2942b965bbab2c

Maciej Żenczykowski   commited 2025-01-21 16:38:10 -08:00
dd8ee1e63d
bpf netd: hardcode AID_ROOT/AID_NET_ADMIN in DEFINE_XTBPF_PROG
(no other value makes sense anyway)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I9efd5ea3919310b10d28c1d14f1e050a2ab0d689

Maciej Żenczykowski   commited 2025-01-21 16:37:19 -08:00
2d99530217
bpf netd: change stats programs gid from AID_SYSTEM to AID_ROOT
These used to be attached from system server, but this is no
longer the case.  They are now attached from netd updatable
(ie. from within netd)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Idc2d0351dc76e0b751e2910ca58c0ef313e72a88

Maciej Żenczykowski   commited 2025-01-21 16:37:01 -08:00
56c6ccf444
Merge "Increase IO timeout" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-01-21 16:34:34 -08:00
011776fe6e
Merge changes I5595abaa,I2b9563e1 into main
* changes:
  bpf: KVER_5_9 -> KVER_5_10
  bpf: KVER_5_8 -> KVER_5_10

Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2025-01-21 16:32:06 -08:00
c476bb9095
Merge "bpf netd: pass sdk level into bpf_traffic_account()" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-01-21 16:25:15 -08:00
67cc59db2a
Merge "bpf_helpers: infra for per sdk level bpf programs" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-01-21 15:47:53 -08:00
0d6fccda52
Merge "bpf_helpers: comment adjustment" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-01-21 15:47:53 -08:00
5e96b9f03c
bpf: KVER_5_9 -> KVER_5_10
5.9 is not LTS, and thus isn't supported.
Let's simplify to 5.10 which is the actual LTS supported version.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I5595abaacb9b479d82787dc021b0e3109a49951d

Maciej Żenczykowski   commited 2025-01-21 15:01:04 -08:00
26121e8fbf
bpf: KVER_5_8 -> KVER_5_10
Neither 5.8 nor 5.9 are LTS, and thus aren't supported.
Let's simplify to 5.10 which is the actual LTS supported version.

Generated via:
  sed -i -r 's/KVER_5_8/KVER_5_10/' bpf/progs/offload.c
  sed -i -r 's/KVER_5_8/KVER_5_10/' bpf/progs/netd.c
plus manual edit to:
  bpf/headers/include/bpf_helpers.h

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I2b9563e1a392011718d3f7d788f84201993e58c2

Maciej Żenczykowski   commited 2025-01-21 15:00:53 -08:00
276dd9dbf7
bpf netd: pass sdk level into bpf_traffic_account()
(trivial no-op prep work)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Iec1f469d9da52e85413ce320d3d331393d939314

Maciej Żenczykowski   commited 2025-01-21 14:59:54 -08:00
1ef91d67c0
Merge "Remove casbor@google.com from remoteauth/OWNERS" into main
Ronald Braunstein   authored and   Gerrit Code Review   commited 2025-01-21 14:32:47 -08:00
87c84be898
bpf_helpers: infra for per sdk level bpf programs
This will allow build time compiling versions of an ebpf program
with sdk level specific behaviour.

The mainline bpfloader already supports loading programs
based on the sdk level, so this builds on that.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I97078c6bdf4cef143cdfeed6ea8e2594bd1f5cd6

Maciej Żenczykowski   commited 2025-01-21 14:21:01 -08:00
4b471719ce
bpf_helpers: comment adjustment
Test: N/A
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I91c6267fd61a22e8789912e4bd09f77a8668bd49

Maciej Żenczykowski   commited 2025-01-21 14:20:58 -08:00
88f0c9562c
BpfUtils.h: update kernel comment for 6.13
This behaviour we depend on continues to be present...

Test: N/A
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I785e908700182734ef7cc21c7c2741c327f7a18b

Maciej Żenczykowski   commited 2025-01-21 12:33:10 -08:00
81430d6640
Increase IO timeout
We have been seeing frequent EAGAIN errors during i/o operations in
tests. This change increases the timeout by 10x to hopefully minimize
these failures.

Per maze@: these methods are dependent on rcu synchronization, which
can take a long time on a busy system. Blocking the thread is
most likely always preferable over failing the operation.

Bug: 390722214
Test: TH
Change-Id: I96aa5a583c0c7558a8ea945eca5e5cb8f1c35c69

Patrick Rohr   commited 2025-01-21 10:57:04 -08:00
df2e6ebed1
Add support for Base64 encoded signature
To simplify debugging, we are planning to publish the log list signature
as a Base64 encoded string.

It might take a while for the changes to the signature publishing pipeline
to reach prod, and we do not know exactly when that will happen. To avoid
accidental crashes, I added a fallback path to the verifier code that
reverts to use the signature as raw (not Base64 encoded) bytes. I will
remove the fallback path once the signature publishing changes are
finalized.

Bug: 374719543
Test: atest NetworkSecurityUnitTests
Change-Id: Ia785b554b840940dc81b47ac9bc2121c0b410ab0

Sandro Montanari   commited 2025-01-21 17:37:35 +00:00
ed61bfc39d
Add methods to distinguish TetheringRequest types
Add TetheringRequest#RequestType to distinguish the type of
TetheringRequest (i.e. from startTethering, from implicit broadcasts, or
from the legacy tether API) as well as helper methods to create these
requests. These will be used in a future CL.

Bug: 216524590
Test: build

Change-Id: Ibfda48f59e80d423c9b6ee0d244cbdab14be1bd2

Quang Anh Luong   commited 2025-01-21 17:48:38 +09:00
01b9e966d8
bpf: support BPF_F_NO_PREALLOC in bpf_map_def.h
Kernel requires maps of type BPF_MAP_TYPE_LPM_TRIE to not be
preallocated, so default enable the flag for these.

But even for non LPM_TRIE maps allow a negative num_entries
value to ask for 'non preallocated' maps.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I48d5d5813628c87094c5efa7266b0354b135dd7e

Maciej Żenczykowski   commited 2025-01-20 14:49:44 -08:00
d2459f373c
Merge "Revert "NetBpfLoad: hacky way to make LPM_TRIE bpf maps work."" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2025-01-20 13:43:27 -08:00
4c0ba60c36
Revert "NetBpfLoad: hacky way to make LPM_TRIE bpf maps work."
This reverts commit dcb2e7496c.

Reason for revert: will use negative size to imply no prealloc instead.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: If1ce59acc592435537bce1d61857ba964bf8b6e6

Maciej Żenczykowski   commited 2025-01-20 12:10:04 -08:00
c1a9f4ab4c
Adding mapFlags parameter while created BPF maps.
This will allow BPF maps to be created with flag options that are
supported e.g BPF_F_NO_PREALLOC, BPF_F_MMAPABLE and others.

Bug: 387984935
Test: Modified NetBpfLoader to dump the map flags.
Change-Id: Ia13ca5a861e8275e831c2b96f4759d1e8f111963

Sarup Dalwani   commited 2025-01-20 20:01:57 +00:00
5c01da8e19
Merge "Log legacy tether() calls that succeeded" into main
Quang Luong   authored and   Gerrit Code Review   commited 2025-01-20 00:04:23 -08:00
81056e4429
Merge changes Ia25b28d5,Ic6bbd8c0 into main
* changes:
  Fix flakes due to tests resetting CarrierConfig
  Fix lint errors in NetworkAgentTest

Treehugger Robot   authored and   Gerrit Code Review   commited 2025-01-19 20:01:08 -08:00
4ab11df911
Fix flakes due to tests resetting CarrierConfig
Some tests use CarrierConfigManager#overrideConfig(subId, bundle) to set
some configs, and then overrideConfig(subId, null) to reset the
override.  However this also resets overrides that may have been set by
the instrumentation, such as ConnectivityTestTargetPreparer /
CarrierConfigSetupTest.

Avoid this by providing a common utility to set and tear down carrier
config, which reset the overrides to the original setting value instead
of clearing all overrides.

Test: atest
Bug: 253698734
Change-Id: Ia25b28d551b62205c52f91e0ffad1b94710c0828

Remi NGUYEN VAN   commited 2025-01-20 11:55:39 +09:00
c7ed1a195a
Fix lint errors in NetworkAgentTest
This change was generated by running the lint tool.

Test: atest
Change-Id: Ic6bbd8c061a02fd8929378777efe603e47bb72b9

Remi NGUYEN VAN   commited 2025-01-20 11:39:40 +09:00
973959fb6f
Merge "Handle POLLERR for RealtimeScheduler" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-01-19 17:45:46 -08:00
67734a0810
Merge "Enhance ApfIntegrationTest to test multiple packet transmission" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2025-01-17 10:06:05 -08:00
6d76b1a346