Commit graph android_packages_modules_Co.../staticlibs/native
Message SHA1
KernelUtils.h: isAtLeastKernelVersion(x,y,z) - default 'z' to 0
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 Żenczykowski   commited 2025-09-12 10:14:12 -07:00
ee24054e2b
BpfMap: remove @CriticalNative from nativeSynchronizeKernelRCU()
There's been some reports that this can cause process termination due
to gc/sleep logic thinking the thread is stuck for >4s.

While this implies that RCU is stuck for >4s, maybe this is something
that can happen on lower power devices.

It seems prudent to (at least temporarily) revert back to the old
non-CriticalNative behaviour.

Test: TreeHugger
Flag: EXEMPT mainline, bugfix
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I56b2802132f252a02411a9a8f762d98ab2f336ad

Maciej Żenczykowski   commited 2025-09-11 13:01:08 -07:00
1e1d336141
netjniutils: delete support for android R
Mainline M-2025-11 drops support for android R,
thus making the new minimum Android 12 / S (api 31)

Once we get this to pass tests, we can merge it,
then we need to bump min sdk to 31, then we can
probably get rid of the dlsym stuff and just link it directly.

Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com
Change-Id: I9d68ea9f4aa180b3ec24d252bcd49593e19cf475

Maciej Żenczykowski   commited 2025-08-26 09:56:44 -07:00
94d800d96f
BpfBitmap: some minor optimizations
Test: TreeHugger, atest BpfBitmapTest
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I5acf5bcb31777e503e58cef733d617a53006d2b9

Maciej Żenczykowski   commited 2025-08-12 16:02:23 -07:00
d2d26c661a
Optimize BpfMap JNI calls with FastNative/CriticalNative annotations
Convert BpfMap native methods to use @FastNative to reduce JNI overhead.

Refactor synchronizeKernelRCU() to be @CriticalNative for maximum
performance by changing its error handling to return an error code
instead of throwing directly from native code.
(In practice we don't expect it to *ever* fail)

FYI:

@FastNative and @CriticalNative are Android-specific annotations
that signal to the ART runtime to use a lower-overhead JNI transition,
resulting in better performance.

A standard JNI call tells the Garbage Collector (GC) that the thread
is transitioning to a 'Native' state. This is a signal to the GC that
the thread might be busy for a while and shouldn't be suspended arbitrarily.

@FastNative is for short, quick functions:
  This provides a moderately faster JNI call (thread is still 'Runnable').
  The native function signature remains the same as a standard JNI method,
  and it can still access the JNIEnv* to interact with Java objects
  or throw exceptions.

@CriticalNative is for short, quick & trivial functions:
  This provides the fastest possible JNI transition and is intended
  for simple, performance-critical leaf functions.
  It comes with strict requirements:
    - The native method cannot throw exceptions, create Java objects,
      or make any other JNI calls.
    - All arguments and the return type must be primitive, ie:
        jboolean [bool]
        jbyte [s8]
        jchar [u16]
        jshort [s16]
        jint [s32]
        jlong [s64]
        jfloat [32-bit]
        jdouble [64-bit]
        void
      Java objects like String or byte[] are not allowed.
  Because of these restrictions, the native C++ function signature
  must not include JNIEnv* or jobject/jclass parameters.
  (This likely also means it must be 'static')

Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I9b6107b26086df2e87218ff9274593e9f2eb6b0b

Maciej Żenczykowski   commited 2025-08-12 15:28:05 -07:00
2afef5070a
TcUtils: remove dead BPF_FD_JUST_USE_INT hack
Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I311fc585d7c01c9aa5f89a42c2d1e673f7e55ae8

Maciej Żenczykowski   commited 2025-08-07 20:04:43 -07:00
762f83b5fb
Merge "Move #nativeWaitForService into CommonConnectivityJni" into main
Patrick Rohr   authored and   Android (Google) Code Review   commited 2025-08-06 11:12:41 -07:00
2e342c6d9b
Move #nativeWaitForService into CommonConnectivityJni
AServiceManager_waitForService sytem APIs currently only callable
via dlsym(): b/376759605. When built with sdk_version current,
the NDK stubs for "sdk" variants only include NDK APIs,
excluding #systemapi APIs.

Flag: EXEMPT Mechanical refactors
Test: atest ServiceManagerWrapperIntegrationTest
Change-Id: I48f690d771c7905e79e463617ded772f753cc854

Mark Chien   authored and   Patrick Rohr   commited 2025-08-06 10:44:39 -07:00
f250ade6fa
simplify netjniutils
Test: TreeHugger
Flag: EXEMPT mainline
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ic1c3207ef3a800f1e5d2da846b1f010f64a0e18f

Maciej Żenczykowski   commited 2025-08-01 16:08:12 -07:00
f14dc8c26f
Create CommonConnectivityJni to share between modules
Flag: EXEMPT mainline
Test: TH
Change-Id: Ia85dfd3d979803baca9e971d1083f54dff46de53

Jimi Chen   commited 2025-07-23 05:47:12 +00:00
e5a4e6b0ba
Add native call to retrieve driver name via ethtool API
This adds a JNI function to retrieve an interface's driver name via
ethtool API, which will be used to identify USB NCM interfaces.

Unfortunately, SIOCETHTOOL (ETHTOOL_GDRVINFO in particular) does not
allow passing in the interface index, meaning that this operation is
racy, i.e. the interface might have been replaced when
getDriverNameForInterface() is called.

SICOETHTOOL is slowly being replaced by a netlink alternative that
allows querying by interface index but, unfortunately, does not support
ETHTOOL_GDRVINFO yet.

Test: verified manually; automated test will be added shortly.
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: I8bec47e36a607e7d8fe2fac2eebcd8dff0360a02

Patrick Rohr   commited 2025-06-09 14:54:38 -07:00
0eaec731ec
Don't crash the system server when a misconfigured agent adds a DSCP policy
Additionally, when calling isEthernet(null), throw NPE instead of
SIGSEGV.

Test: New test in this patch
Change-Id: Ie80b860d4befe65a1777d0ebeb18d1807c6375d0

Chalard Jean   authored and   Patrick Rohr   commited 2025-03-19 08:24:45 -07:00
fd3ab6b212
TcUtils: allow ignoring netlink error code ENOENT
Ignore this error code during DEL operations.

It is returned when the specific thing to be deleted
is not found and is therefore a valid response.

Gets rid of 30+ logs worth of:
  E TcUtils : NLMSG_ERROR message return error: -2
during netd startup (cleanup phase).

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

Maciej Żenczykowski   commited 2025-02-06 12:56:09 -08:00
f31a45416c
Fix extra callbacks sent when the timer expires
Several extra callbacks are sent after the first timer expiration
notification. This occurs because data from the FileDescriptor
must be read after the timer expires. Otherwise, expiration
callbacks will continue to be sent, notifying of unread data.

This change also adds TFD_NONBLOCK to timerfd creation to ensure
reading safety.

Test: Manually verify that the callback is sent only once
Change-Id: I30559ed93d0a742b98a58d33d83723f7a155fbd9

Paul Hu   commited 2025-01-17 06:39:48 +00:00
3ad5d4c348
Run clang-format on ServiceConnectivityJni.cpp
Test: TH
Change-Id: I09af1ca8354e52c7ccf598ac2a6e0543fdd4b3cd

Patrick Rohr   commited 2025-01-16 14:28:13 -08:00
68f5e612a7
Rename timerfd functions for consistency
Test: TH
Change-Id: I47b6011dcd8a0a66d89ac80e728951004666daa8

Patrick Rohr   commited 2025-01-16 14:28:13 -08:00
2f1627d3c3
Remove native prefix for consistency
Test: builds and boots
Change-Id: I5da28a6dcb9c7b7b06f072a9d92b701228cdde5e

Patrick Rohr   commited 2025-01-16 14:28:13 -08:00
9463cd1387
Rename net_utils_device_common_timerfdjni to serviceconnectivityjni
Test: builds and boots
Change-Id: I432da644ab6d212df736913089ff3b52d286ea0e

Patrick Rohr   commited 2025-01-16 14:28:13 -08:00
08bf056370
Move TestNetworkService JNI into ServiceConnectivityJni
Test: builds and boots
Change-Id: Ia15833a163604ddbbb9527dff59174f2643daa61

Patrick Rohr   commited 2025-01-16 14:28:13 -08:00
3c14078435
Move TimerFdUtils JNI functionality into ServiceConnectivityJni
Test: build and boots
Change-Id: Idb9f8c9979aff43e6e5351d190329e823112e005

Patrick Rohr   commited 2025-01-16 13:04:42 -08:00
4971556451
Get rid of BPF_FD_JUST_USE_INT
borrowed_fd defines implicit conversion constructors for both int and
unique_fd.

Test: TH
Change-Id: Ie41c747f4afea050b18d721956bcbbca0446bdc7

Patrick Rohr   commited 2024-11-22 10:36:27 -08:00
99ace23829
Create a timerfd JNI class
The timerfd delivers timer expiration notifications via a file
descriptor, which can be used to implement delayed callbacks.
Create a JNI class to interface with the timerfd system calls.

Bug: 366373064
Test: m
Change-Id: I0ae7a4cf618838e614b2fa4523b55a4d0e8f74e2

Paul Hu   commited 2024-10-16 06:29:48 +00:00
eb73d4ddda
bpf: move bpf_headers into /bpf subdirectory
Generated via:
  git mv staticlibs/native/bpf_headers bpf/headers
  cd bpf/headers/include
  git mv bpf/bpf_helpers.h .
  git mv bpf/bpf_map_def.h .
manually fix up bpf/bpf_map_def.h include path

bpf_helpers.h is only used by bpf programs so the 'bpf/'
prefix is spurious.

bpf_map_def.h is only used by bpf programs and the two
bpfloaders, which effectively means the 'bpf/' prefix isn't
useful.

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

Maciej Żenczykowski   commited 2024-08-21 13:18:59 -07:00
d602835b4f
doc: echo >> staticlibs/native/README.md
cat'ing this text file from a terminal results in
shell prompt being in the middle of the screen - fix it.

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

Maciej Żenczykowski   commited 2024-08-20 19:52:18 -07:00
97d3ee7d72
bpf: git mv staticlibs/native/bpf_syscall_wrappers bpf/syscall_wrappers
Step 3 of moving bpf related stuff into a common directory,
will ease development.

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

Maciej Żenczykowski   commited 2024-08-20 19:51:50 -07:00
d33d63701c
bpf: get rid of DISABLE_BTF_ON_USER_BUILDS macro
Since all mainline shipped bpf .o files have BTF loading disabled,
we might as well make it the default.

Especially since currently neither the platform nor the mainline
bpf loaders even support BTF and thus don't even parse these settings.

We do need to keep it around to prevent a boot time regression on
(at least) Android U.

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

Maciej Żenczykowski   commited 2024-08-17 02:06:51 +00:00
da723a059e
bpf: eliminate DEFAULT_BPFLOADER_(MIN|MAX)_VER
Afterwards:
  git grep 'DEFAULT_BPFLOADER_(MIN|MAX)_VER'
comes up empty

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

Maciej Żenczykowski   commited 2024-08-15 16:15:13 -07:00
fac81f1f72
bpf: remove DEFAULT_BPF_PROG_(SELINUX_CONTEXT|PIN_SUBDIR)
This hasn't ever been useful.

Afterwards:
  git grep 'DEFAULT_BPF_PROG_(SELINUX_CONTEXT|PIN_SUBDIR)'
comes up empty

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

Maciej Żenczykowski   commited 2024-08-15 15:21:15 -07:00
f7abc4378a
NetBpfLoad: remove support for 'size_of_bpf_map_def'
Both the loader and all the bpf .o's are in the same apex, they're thus
built from the same source and have the same struct bpf_map_def
definition, and this is no longer required.

We do still need to populate the field in the .o's though,
since offload.o and test.o are still read by the Android S
platform bpfloader.

Afterwards:
  git grep 'DEFAULT_SIZEOF_BPF_MAP_DEF|sizeOfBpfMapDef'
is empty

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

Maciej Żenczykowski   commited 2024-08-15 15:17:22 -07:00
acd4aa838c
NetBpfLoad: remove support for 'size_of_bpf_prog_def'
Both the loader and all the bpf .o's are in the same apex, they're thus
built from the same source and have the same struct bpf_prog_def
definition, and this is no longer required.

We do still need to populate the field in the .o's though,
since offload.o and test.o are still read by the Android S
platform bpfloader.

Afterwards:
  git grep 'DEFAULT_SIZEOF_BPF_PROG_DEF|sizeOfBpfProgDef'
is empty

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

Maciej Żenczykowski   commited 2024-08-15 15:04:39 -07:00
e666d85ccf
bpf: change AOSP/MASTER to AOSP/MAIN
Change-Id: I31033b15d845ecc9a19958a1a324885977ac8147

Maciej Żenczykowski   commited 2024-08-15 14:55:05 -07:00
401c98f127
Make BpfRingbufBase destructor virtual
This allows subclasses to override the destructor and perform additional cleanup.

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

Maciej Żenczykowski   commited 2024-07-24 19:17:54 +00:00
dea17b60ed
BpfRingBuffer: allow subclassing, add epoll support
Currently there's no mechanism to subscribe to changes in a BpfRingbuf,
and the existing wait() method can only block on a single bpf
ringbuffer.

Hence, add methods to interface with epoll_ctl() system call.

Also in code review of previous patchsets it came to light
that the constructor is needlessly 'private', thus change it
to 'protected' so that it can be subclassed.

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

Isak Evaldsson   authored and   Maciej Żenczykowski   commited 2024-07-24 07:31:05 +00:00
ef0413788e
Revert "NetBpfLoad: gently enable mainline"
This reverts commit 231598bc92.

This is targetting mainline release M-2024-09.

Note: left the failure message in netbpfload/netbpfload.33rc
to mention 'netbpfload-failed' and not 'bpfloader-failed'.

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

Maciej Żenczykowski   commited 2024-06-21 15:46:42 +00:00
2afffc2d6a
bpf: attach a *bunch* more cgroup hooks
We attach trivial programs to:
  {connect,recvmsg,sendmsg}{4,6}
  inet_release
  {g,s}etsockopt

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

Maciej Żenczykowski   commited 2024-06-16 10:04:35 -07:00
22db590580
BpfRingbuf.h - use exclusively locked map
As currently implemented, it is not safe to open (and mmap) the
same kernel -> userspace ringbuffer multiple times.

Note: it's likely, that as implemented, even a single instance
is not thread safe without external locking.

Test: TreeHugger, atest bpf_existence_test bpf_module_test bpf-time-in-state-tests libbpf_android_test
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Iea6908746a58e7412c0ce89da29a764aefeaef47

Maciej Żenczykowski   commited 2024-06-15 03:58:24 -07:00
fbaa3c9890
introduce mapRetrieveLocklessRW()
the clat verifyPerms() checker only wants to check the
existence and accessibility of the maps.

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

Maciej Żenczykowski   commited 2024-06-15 03:54:09 -07:00
0fff839ae6
Add BPF_MAP_LOCKLESS_FOR_TEST hack for root resolver tests
Per commit description of https://android-review.git.corp.google.com/c/platform/packages/modules/Connectivity/+/3109108 "Use SingleWriterBpfMap in BpfNetMaps":

- firewall.cpp writes to sConfigurationMap, sUidOwnerMap, and
  sDataSaverEnabledMap, but that code only runs in tests because
  it requires root privileges.

So either those maps need to not use SingleWriterBpfMap
in the BpfNetMaps (which would affect performance),
or we need to prevent the tests from grabbing the locks,
or the tests will (presumably) fail.

This avoids grabbing the locks from the test, even though
this is absolutely terrible and likely breaks things...
But in general the entire firewall.cpp file (and libconnectivity_native_test_utils target) are just one
large modularization violation in need of major escalation...

Test via:
  atest resolv_{gold,stress,integration,unit}_test

Without this patch:
  resolv_gold_test: Passed: 16
  resolv_integration_test: Passed: 53, Failed: 2, Ignored: 118, Assumption Failed: 0 (Completed With ERRORS)
  resolv_stress_test: Passed: 2
  resolv_unit_test: Passed: 124, Failed: 2

  4 tests failed
  --------------
  ResolverMultinetworkTest#DnsWithVpn
  PrivateDns/TransportParameterizedTest#BlockDnsQuery/DoT
  CallbackTest#tagSocketCallback
  ResolvGetAddrInfoTest#InvalidParameters

With this patch:
  resolv_gold_test: Passed: 16
  resolv_integration_test: Passed: 178
  resolv_stress_test: Passed: 2
  resolv_unit_test: Passed: 126

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

Maciej Żenczykowski   commited 2024-06-14 17:35:29 -07:00
04fb3862a9
make java maps grab locks
The java bpfmap fd cache has some implications:
- this won't protect against two SingleWriterBpfMap instantiations
  for the same map (path) in the same process
- we don't release any locks on BpfMap destruction.

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

Maciej Żenczykowski   commited 2024-06-14 15:56:01 -07:00
9eca02a8fa
make mapRetrieveWO take exclusive lock
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I4929bbc3490350fc4c57e909109d2ec36eb0359c

Maciej Żenczykowski   commited 2024-06-14 15:56:01 -07:00
7eb7d67279
NetBpfLoad: gently enable mainline
Only the non-CRITICAL test@mainline.o is loaded from netbpfload
on T and U < QPR3, everything else is loaded by platform bpfloader

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

Maciej Żenczykowski   commited 2024-06-14 15:09:41 -07:00
231598bc92
bpfLock: avoid using ifAtLeastKernelVersion()
Per inspection of:
  https://source.corp.google.com/h/prodkernel/kernel/upstream/torvalds/linux-2.6/+/master:kernel/bpf/syscall.c;drc=2884dc7d08d98a89d8d65121524bb7533183a63a;l=5786
bpf system call returns -EINVAL on unknown operations:

static int __sys_bpf(int cmd, bpfptr_t uattr, unsigned int size)
{
...
    switch (cmd) {
...
    case BPF_OBJ_GET_INFO_BY_FD:
	err = bpf_obj_get_info_by_fd(&attr, uattr.user);
	break;
..
    default:
	err = -EINVAL;
	break;
    }

    return err;
}

Equivalent logic is present in ACK 4.9-Q:
  SYSCALL_DEFINE3(bpf, int, cmd, union bpf_attr __user *, uattr, unsigned int, size)

This is what should thus be returned on 4.9-T devices.

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

Maciej Żenczykowski   commited 2024-06-14 14:25:27 -07:00
4acfa1fc82
Merge "BpfSyscallWrappers: grab shared lock on writable map open" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2024-06-14 21:08:05 +00:00
e819e43eb2
BpfSyscallWrappers: grab shared lock on writable map open
and add an accessor to grab an exclusive lock on a R/W map open
(such a map could be accessed with a write-through cache)

Note: we can't grab a flock as that would occupy the full inode,
and all bpfmaps are actually (currently) the *same* anonymous inode.

As such we actually grab a lock on a range (a single byte),
the offset being determined by the unique bpf map id.

We include some very simple, but sufficient, correctness tests
in the critical boot path: this is to prevent any surprises
caused by kernel implementation changes.

$ adb root && sleep 1 && adb wait-for-device shell grep OFDLCK /proc/locks
id: OFDLCK ADVISORY [WRITE|READ] pid blkmaj:min:inode min_offset max_offset
11: OFDLCK ADVISORY  READ -1 00:0e:1048 36 36
14: OFDLCK ADVISORY  READ -1 00:0e:1048 35 35
15: OFDLCK ADVISORY  READ -1 00:0e:1048 41 41
16: OFDLCK ADVISORY  READ -1 00:0e:1048 40 40
22: OFDLCK ADVISORY  READ -1 00:0e:1048 24 24
23: OFDLCK ADVISORY  READ -1 00:0e:1048 17 17
24: OFDLCK ADVISORY  READ -1 00:0e:1048 16 16
25: OFDLCK ADVISORY  READ -1 00:0e:1048 13 13

OFDLCK probably means 'Open File Descriptor LoCK' since an OFDLCK
is associated with (held by) the file descriptor and not a process/pid,
on the given (anonymous in this case) block device + inode.

Where READ=shared and WRITE=exclusive.
There are (as yet) no exclusive locks held post boot.

The pid field is unfortunately always -1 (and cannot be manually set).

The 00:0e:1048 (or at least the inode portion) is random
(likely depends on boot ordering)

The final two fields (min and max offset) are the bpf map id.

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

Maciej Żenczykowski   commited 2024-06-14 10:51:25 +00:00
52018c821c
introduce BPFLOADER_MAINLINE_U_QPR3_VERSION
Note: this is technically a little bit early,
as U QPR3 still runs netbpfload as 'system' uid by virtue of
netbpfload.33rc overriding 'service bpfloader',
but this will change in a followup, at which point U QPR3
will become special by virtue of always using mainline netbpfload

See: https://android.googlesource.com/platform/packages/modules/Connectivity/+/refs/heads/android14-qpr3-release/netbpfload/NetBpfLoad.cpp#262

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

Maciej Żenczykowski   commited 2024-06-13 15:38:33 -07:00
1a3b54f005
Fix comment about U QPR2 vs V bpfloader version
See: https://android.googlesource.com/platform/system/bpf/+/refs/heads/android14-qpr2-release/libbpf_android/Loader.cpp#34

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

Maciej Żenczykowski   commited 2024-06-13 15:26:55 -07:00
bf6f928b2d
BpfSyscallWrappers: remove mapRetrieve()
(spurious)

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

Maciej Żenczykowski   commited 2024-06-04 13:49:06 +00:00
dfef229781
Use unique_fd in tcutils
Since libbase is available now, make use of it.

Test: m
Change-Id: I5676863f80f19913d68e95ebeef477c5ca399e35

Patrick Rohr   commited 2024-05-22 10:51:02 -07:00
6b84b40a29
Use scopeguard from libbase_headers and delete the copy
A recent change makes libbase_headers available to the tethering apex.

Test: m
Change-Id: Id4f30f48bd65175e17c419230a8e7ebf5339d713

Patrick Rohr   commited 2024-05-22 10:50:55 -07:00
15754248e8
prevent DscpPolicyTracker from printing big scary exception stack
when the program is missing due to too old kernel.
Program presence is already enforced by CRITICAL annotation and bpfloader.

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

Maciej Żenczykowski   commited 2024-04-26 22:48:30 +00:00
e950f6d39c