- Oct 07, 2023
-
-
Maciej Żenczykowski authored
Test: TreeHugger Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: If33414eccefb35e6aefbd4ec0c24b208e564ca7e
-
- Oct 06, 2023
-
-
Maciej Żenczykowski authored
Generated via: for f in bpf_progs/{block,dscpPolicy,netd,offload,test}.c; do sed -i -r 's@KVER[(]([45]), ([0-9]+), 0[)]@KVER_\1_\2@g' "${f}" done Test: TreeHugger Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: I8f211e47bf259fc75aa1caaaf82f41c1929ceab2
-
Maciej Żenczykowski authored
Test: TreeHugger Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: If05c0c5383dceeb65964143f5574d2ee1a484907
-
- Oct 03, 2023
-
-
Maciej Żenczykowski authored
use them & IGNORE_ON_* LOAD_ON_* as needed. Test: TreeHugger Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: Ibadd782d289e6a2ce1467778a1930c6f1b609f98
-
- Sep 29, 2023
-
-
Ryan Zuklie authored
Network tracing was only available on userdebug and eng builds. This change makes it available on all build types behind a flag. Bug: 298197881 Test: flash & trace, toggle flag on/off Change-Id: I75d854aee74adf7e23f7a970b20233790f9b0354
-
Maciej Żenczykowski authored
Bug: 235590615 Bug: 235907076 Bug: 286003437 Test: TreeHugger, m droid gpuservice_unittest libtimeinstate_test bpf_benchmark bpf_module_test libbpf_load_test && mma Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: I020a898fe8b257040a100f146654d4a04b19f843
-
- Sep 16, 2023
-
-
Ken Chen authored
As an inline function, the logic can be reused by others. Bug: Bug: 288340533 Test: build; presubmit Change-Id: I8e57829e304e829eed72cc165b051cd22088260d
-
- Sep 13, 2023
-
-
Maciej Żenczykowski authored
This is based on network driver populated skb->mark magic bit. This is the bit used by netd's WakeupController. We mandated the location of this bit in U, though we haven't (yet??) mandated it being supported by all network drivers. If the driver doesn't support it, it could always be false (skb->mark should default to 0), or potentially (this is very very unlikely) be garbage. IFIRC nettrace isn't enabled on pre-U devices anyway. Test: TreeHugger Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: I2b3b91315d77c08c022396253b26954593dd3f5a
-
Maciej Żenczykowski authored
Test: TreeHugger Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: Iad7800387e1b84587794be93d037f712ac95fa07
-
- Sep 12, 2023
-
-
Maciej Żenczykowski authored
Test: TreeHugger Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: I37c2aefe8759fdbab3078c60e0f97b57799697fc
-
- Aug 29, 2023
-
-
Maciej Żenczykowski authored
Test: TreeHugger Bug: 295800201 Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: I82771644045e0e37f73725730bd0bd2265ac5b77
-
Maciej Żenczykowski authored
On ingress: (a) the socket is not a normal socket (it's AF_PACKET) and thus (likely) doesn't hit this code path [if it did... we'd have double or more accounting of any traffic captured by AF_PACKET sockets, I haven't checked - but I assume that doesn't happen] (b) is created by the system server (so not AID_CLAT) (c) is not tagged by the system server (so not AID_CLAT) So this is a no-op, but it simplifies the bpf program, since 'egress' is a compile time evaluated constant. Test: TreeHugger Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: Iec693548789eb2752f9f30038e72e35c876f986c
-
- Jun 09, 2023
-
-
Maciej Żenczykowski authored
This is to cut down bpfloader boot time. Potential savings might be on the order of 30+% (300ms). Loading BTF requires fork-execing the btfloader, and currently BTF is only used to facilitate debugging. Bug: 286369326 Test: TreeHugger Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: Ifa5f0052135b9dc826b18ca4622784615ed9c3c8
-
- May 20, 2023
-
-
Maciej Żenczykowski authored
Test: TreeHugger Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: Ie2fab051f3d923b3dd2be09d82c3cf47e91f6224
-
Maciej Żenczykowski authored
Test: TreeHugger Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: I04f3f1b6ba1093f6543f6e80f62d978ebfee707d
-
- Apr 25, 2023
-
-
Maciej Żenczykowski authored
Android T beta3/4 haven't been tested in ages, and were really only tested for the transition to final T nearly a year ago. Test: TreeHugger Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: I520e60026179c078859572231b86184796182142
-
- Apr 20, 2023
-
-
Maciej Żenczykowski authored
Test: TreeHugger Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: I756e4451d252ab43b4fbe57f185c950cd519b359
-
Maciej Żenczykowski authored
Test: TreeHugger Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: I437fe4cca4bd59b12531ac722a6d464bdce512a6
-
Maciej Żenczykowski authored
Test: TreeHugger Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: I850678bd050026d5d4da3cff74a44a4df274b48a
-
Maciej Żenczykowski authored
Test: TreeHugger Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: Ife0c4bc8fe468456172b9a8e7567d3633c1b7404
-
Maciej Żenczykowski authored
This will make the code more legibble once we switch to using these. Also moving them out of the .c files so we can share the same constants across multiple files. Test: TreeHugger Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: I5cc9058cee8d1ea10d2f9e62a38313d0728f07d3
-
- Apr 19, 2023
-
-
Maciej Żenczykowski authored
Bug: 263884894 Test: TreeHugger Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: I4a1ca71d529602a1651b711439ccd0a60fe3c550
-
- Apr 18, 2023
-
-
Maciej Żenczykowski authored
I don't know if this will truly help: We'll still drop the expected egress TCP ACK (or FIN-ACK) reply to the newly allowed ingress TCP FIN... However: I don't think this will make things worse. The presence of an ingress packet is proof the hardware already woke up to receive it. This behaviour doesn't change when allowing ingress *anything*. ie. the main reason we don't allow ingress packets is that it would be illogical to be asymmetrical. So even if we do immediately send back a reply (I think a RST is the only real possibility at the moment, since ACK would still be dropped). Worst case we're waking the hardware up from RX processing to full blown TX processing. Furthermore if an inbound FIN causes an outbound RST, then that RST will most likely prevent receiving future FIN retransmits. So we're trading an RX->TX hardware wake up now, for less RX wakeups in the (near) future. This *might* just be an overall win. I think a true solution likely needs to be smarter still and allow skb->sk state != BPF_TCP_ESTABLISHED (or something) Bug: 259199087 Bug: 264903985 Test: TreeHugger Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: I143f12342f72d89f9450560c8d60dad4c79ffe64
-
- Apr 14, 2023
-
-
Maciej Żenczykowski authored
Instead of also accounting tag!=0 traffic against tag==0 slot, while the bpf code writes into the map, move this logic into the userspace jni code which reads from the map. Simplifies the bpf program making things easier on the kernel's bpf verifier, and is better for performance, since a per-packet fixup operation becomes a per-poll fixup. Test: TreeHugger, atest libnetworkstats_test FrameworksNetTests Bug: 276296921 Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: Ic220a201781a1170bcffe327fe5664fc12b65dd9
-
- Mar 02, 2023
-
-
Maciej Żenczykowski authored
effectively no-op, but since it's a trivial check (uid < APP_START), better do it first, rather than the complex packet parsing in skip_owner_match(). Test: TreeHugger Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: I35a9188e108987d48f03a18cdf70ec4cdd715376
-
Maciej Żenczykowski authored
We only ever return DROP_UNLESS_DNS on ingress, so the ordering doesn't actually matter. Test: TreeHugger Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: I742b85748433f5319d518bebc05d976d630b72e7
-
- Jan 23, 2023
-
-
Ryan Zuklie authored
This adds the core BPF implementation of Android network packet tracing. The new code looks into the skb to pull out various bits of information. Both the program and the ring buffer are restricted to 5.8+ kernels and userdebug or eng builds. With the packet_info_config map defaulting to zero, userdebug and eng builds won't run any of the tracing today. The only effect will be 32k memory increase for the ringbuf and the check on the config array. Bug: 246985031 Test: build & flash both userdebug and user Change-Id: I144da2971c0738b565ad58abc17e456209f13bde
-
Ryan Zuklie authored
Test: build & install connectivity module Change-Id: I869810d05ad8266b6a4107a5276864fdbcdbd9b0
-
- Jan 20, 2023
-
-
Ryan Zuklie authored
These all default to false, never ignoring the maps. Bug: 246985031 Test: build connectivity module Change-Id: I404d56dcb311b34587d56dd6edc292029c4ad83f
-
- Jan 05, 2023
-
-
Ryan Zuklie authored
This change updates callers to include the new ignore_on and bpfloader arguments as per the change in aosp/2374598. Bug: 246985031 Test: tethering build & install, full platform build & install Change-Id: Id940a6003ae4cb0bbfc65db8ff96590c4f3c847b
-
- Dec 30, 2022
-
-
Maciej Żenczykowski authored
will make it easier to extend this for 5.4+ behaviour as well without having to introduce another is_5_4 boolean Bug: 263884894 Test: TreeHugger Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: Id4f6512d813dd460cb2b9a7ccb6a5f7b7e937575 (cherry picked from commit 0966bbee) Merged-In: Id4f6512d813dd460cb2b9a7ccb6a5f7b7e937575
-
Maciej Żenczykowski authored
will make it easier to extend this for 5.4+ behaviour as well without having to introduce another is_5_4 boolean Bug: 263884894 Test: TreeHugger Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: Id4f6512d813dd460cb2b9a7ccb6a5f7b7e937575
-
Maciej Żenczykowski authored
easier on bpf verifier with no third case Bug: 263884894 Test: TreeHugger Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: I5076de6f83ba522ed4783bca0a9d7fca4024986a (cherry picked from commit 28b9a29e) Merged-In: I5076de6f83ba522ed4783bca0a9d7fca4024986a
-
- Dec 29, 2022
-
-
Maciej Żenczykowski authored
easier on bpf verifier with no third case Bug: 263884894 Test: TreeHugger Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: I5076de6f83ba522ed4783bca0a9d7fca4024986a
-
- Dec 18, 2022
-
-
Maciej Żenczykowski authored
Test: TreeHugger Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: I2e1569c8d70e98f9a3fdbab41fd2ba7f7b84dd37
-
- Nov 21, 2022
-
-
Maciej Żenczykowski authored
and get rid of some macros while we're at it. This is just slightly easier to read. (side note: this is all resolved at compile time!) Bug: 259199087 Test: TreeHugger Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: I7b38afd4b6f9d73b4f34a90040639f0780544ac8
-
Maciej Żenczykowski authored
Bug: 259889995 Test: N/A, comment only Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: I0511433663738550b556208c140b08f76ca7898b
-
- Nov 20, 2022
-
-
Maciej Żenczykowski authored
(no-op simplification) Bug: 259199087 Test: TreeHugger Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: Ib9e126f1ca84f60b4057ccbbd0071f9684b20b92
-
- Oct 28, 2022
-
-
Maciej Żenczykowski authored
Bug: 145166494 Test: TreeHugger Signed-off-by:
Maciej Żenczykowski <maze@google.com> Change-Id: I5fd18deee1c12386bdb8b554a33ac2845f881cc0
-
- Oct 27, 2022
-
-
Lorenzo Colitti authored
This effectively reverts commit 6ed2ab9b, while ensuring that the program has the right permissions as defined in r.android.com/2130014 : oriole:/ # ls -lZ /sys/fs/bpf/netd_shared/prog_netd_cgroupsock_inet_create -r--r----- 1 root root u:object_r:fs_bpf_netd_readonly:s0 0 2022-10-27 20:05 /sys/fs/bpf/netd_shared/prog_netd_cgroupsock_inet_create Reason for revert: need to support 4.9 devices upgrading to T. The only thing that cannot currently be supported on those devices is the inet_create program which implements the INTERNET permission. Also, update bpf_existence_test so it does not check for the existence of the program on pre-4.14 devices. Bug: 254001921 Test: atest bpf_existence_test Change-Id: I14f26cee5feeaae93b4d9710a7b9a2f835ff405f
-