Commit graph

1514 commits

Author SHA1 Message Date
Neill Kapron
f1d00f0f2a libcutils: create rust bindings for android ids
For work on the new rust based bpfloader, we need access to the IDs in
android_filesystem_config.h for owner/group permissions of pinned bpf
programs and maps. Create android_ids crate to expose this
information to rust.

Bug: 359646531
Test: Manual
Change-Id: Iee827d8a80a82fbee02a76280668071713625abf
Signed-off-by: Neill Kapron <nkapron@google.com>
2024-11-19 02:47:16 +00:00
Hung Nguyen
fc7ec65a00 Add AID for memory management daemon
Bug: 370509309
Bug: 375432464
Test: adb shell id -(u|g) mmd

Change-Id: I02440604b1947abc70235bfac132473e8bafa90d
2024-11-09 23:05:36 -08:00
T.J. Mercier
0b678adb6a libcutils: Update libprocessgroup dependencies
Bug: 349105928
Change-Id: I9d9230e415724657f9d49a09861f1046fbe4dc55
2024-11-01 21:17:33 +00:00
Yihan Dong
972eae34d8 Merge "Add proposed trendy teams for VTS modules" into main 2024-11-01 00:24:59 +00:00
Yihan Dong
9081b85a1d Add proposed trendy teams for VTS modules
Change-Id: Ic9eeddd1d7286f38806d4a422914964cf2a80073
Test: build locally
Bug: 368362374
2024-10-12 08:53:26 +00:00
T.J. Mercier
a09ee8ece6 Reapply "libprocessgroup: Remove cgroup.rc file"
This reverts commit 972a2d30f8.

Change-Id: Icdf2824675e515ea3656b1c58ac55160ecc337df
2024-10-08 23:42:49 +00:00
Priyanka Advani (xWF)
972a2d30f8 Revert "libprocessgroup: Remove cgroup.rc file"
Revert submission 3212512

Reason for revert: Droidmonitor created revert due to b/372273614. Will be verifying through ABTD before submission.

Reverted changes: /q/submissionid:3212512

Change-Id: I37568516e973cb940f1229d52f94b8dc801da2ab
2024-10-08 18:54:37 +00:00
T.J. Mercier
ae4ce8ccc5 libprocessgroup: Remove cgroup.rc file
The cgroup.rc file was introduced in 192aee782 ("libprocessgroup: Add
support for task profiles") back with the initial support for task
profiles. It was intended to optimize performance associated with cgroup
operations. However over time, supporting this file led to making
libprocessgroup code more complicated (such as the cgrouprc LLNDK
interface), and the file ended up getting mmaped into nearly every
process on Android even though only a handful of them actually use it.
Replacing this file with reading and parsing of cgroup information on
demand allows us to simplify and shrink libprocessgroup, and eliminates
thousands of unused mappings without negatively affecting boot time or
other performance metrics.

Bug: 349105928
Test: Verified with memcg v2 and MaxActivationDepth 1 on Cuttlefish, Raven, and Mokey
Change-Id: Ic3f01fdf7fda89a56ab80657e1cf4573156273e6
2024-10-03 17:01:34 +00:00
T.J. Mercier
981664df08 libprocessgroup: Remove schedtune support
Schedtune was an out of tree cgroup controller present in Android
kernels up to 4.19. It was replaced with uclamp and the cpu controller.
Now that 4.19 is EOL and unsupported, and schedtune is not present in
any supported Android kernels, remove the userspace support for
schedtune.

Bug: 362504801
Change-Id: If8baaf1a616984c5dbaac1bbd03e23ad001bc29c
2024-10-02 14:47:45 +00:00
Elliott Hughes
0bec59c496 Remind the reader that they'll need to modify CTS too.
Also duplicate the warning to the other set of updatable ids.

Bug: http://b/364993041
Change-Id: I128ddeb468c1f2f872772c9f2505a29f7537eb8a
2024-09-10 15:47:46 +00:00
Tim Van Patten
e2a5fb23fe Merge "Add AID for CrOS EC" into main 2024-09-05 22:55:25 +00:00
Tim Van Patten
344c4c071c Add AID for CrOS EC
Add AID for CrOS EC. The AID will be used to update the file access
permissions for /dev/cros_ec. This file is accessed by various
tools/daemons/services that interact with the Embedded Controller via
the linux kernel ChromeOS Embedded Controller (cros_ec) driver.

Bug: 349695348
Test: $ adb shell id -u cros_ec
Test: $ adb shell id -g cros_ec
Change-Id: I6baca9d2b63c45823ed5529bf27b904bf67edf8b
2024-08-15 16:19:05 -06:00
Elliott Hughes
30203af8fd There's only one <sys/system_properties.h> now.
Change-Id: I4d535484b9e25fda304fb748b7796e513c832265
2024-08-09 15:55:38 +00:00
Bart Van Assche
8e62c8a9b4 libcutils: Split uevent_open_socket()
The best time to attach a BPF filter to a socket is before a socket
starts receiving data. Netlink sockets start receiving data after bind()
has been called. uevent_open_socket() calls socket() and bind(). Hence
split uevent_open_socket() into two functions: one function that calls
socket() and another function that calls bind().

Bug: 203462310
Change-Id: Ia41dee4683358cf9fbb6288fad863cd4f4ac9924
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2024-08-05 09:31:24 -07:00
Christopher Ferris
a3a6c8e052 Remove usage of ATOMIC_VAR_INIT.
The use of the macro ATOMIC_VAR_INIT is not necessary and is causing
warnings about it being deprecated. So remove it.

Test: Compiles without any warnings.
Change-Id: I137ffd0a7cf9a24c2c7ddea5c30f310722f57b98
2024-07-11 23:54:48 +00:00
Michael Hoisie
a79e3d4c0f Merge "Add support for ashmem-host for host Windows" into main 2024-07-02 14:50:45 +00:00
T.J. Mercier
1fd7993f85 libcutils: Add missing dependency on libprocessgroup_headers
cutils/sched_policy.h redirects to processgroup/sched_policy.h, but
libcutils does not export the libprocessgroup headers. So users have to
know about the hidden redirect to libprocessgroup and include a
libprocessgroup dependency in their Android.bp files in addition to
libcutils. Fix that.

Bug: 349105928
Test: m
Change-Id: I516bdf2cdeff980c1fcd18883ef8a2f0a9beb629
2024-06-24 19:09:02 +00:00
Peter Collingbourne
68cf5b2239 Merge "Add fs_config entry for *.rc files." into main 2024-05-30 00:54:48 +00:00
Peter Collingbourne
49ecca71b5 Add fs_config entry for *.rc files.
Android init will refuse to read files that are world writable. Since
adb push makes files world writable by default, this means that adb
pushed rc files cannot be read by init. Fix it by adding an fs_config
entry for *.rc that sets their permissions to 644 root:root.

Bug: 343370899
Change-Id: If9c4dd4796caae6d177d9fdeef880949e5639648
2024-05-29 14:24:52 -07:00
Peter Collingbourne
694712b5d8 Merge "Remove fs_config lines for /data/*test*." into main 2024-05-24 17:45:56 +00:00
Peter Collingbourne
01edc0939f Remove fs_config lines for /data/*test*.
These lines were originally added to avoid needing to manually chmod
+x files pushed to these directories on the device, but adb push now
automatically copies the x bit from the host for paths without an
fs_config, so they should no longer be necessary.

Bug: 341415989
Change-Id: I83007dfe05de7b86c26373460af1f199a6d21147
2024-05-23 14:26:14 -07:00
Kiyoung Kim
110308e5ab Merge "Remove VNDK definition(s)" into main 2024-05-23 00:38:19 +00:00
Peter Collingbourne
4a57c8f4f2 adb: Do not use fs_config unless we are root (try 3).
This enables fs_config for /data when pushing files as root. Also,
without this, adb push to /tmp fails as the shell user.

When pushing to a directory that does not have an explicit
fs_config, such as /data/local/tmp or /tmp, use the original
file mode. Because adb copies u permissions into g and o
(and in general because the umask on the host may have
made these files world writable), this requires adding more
fs_config entries to cover directories that may contain dex files
i.e. /{odm,product,system,system_ext,vendor}/{framework,app,priv-app}
to avoid hitting a SecurityException caused by writable dex files, e.g.

04-01 21:22:16.980 10110  4815  4815 E AndroidRuntime: FATAL EXCEPTION: main
04-01 21:22:16.980 10110  4815  4815 E AndroidRuntime: Process: android.test.app.system_priv, PID: 4815
04-01 21:22:16.980 10110  4815  4815 E AndroidRuntime: java.lang.SecurityException: Writable dex file '/system/priv-app/loadlibrarytest_system_priv_app/loadlibrarytest_system_priv_app.apk' is not allowed.
04-01 21:22:16.980 10110  4815  4815 E AndroidRuntime:  at dalvik.system.DexFile.openDexFileNative(Native Method)
04-01 21:22:16.980 10110  4815  4815 E AndroidRuntime:  at dalvik.system.DexFile.openDexFile(DexFile.java:406)

Bug: 171233429
Bug: 311263616
Change-Id: I18f70095c793d08a25ff59e1851f6dc7648ce4dc
2024-04-01 15:18:49 -07:00
Michael Hoisie
7c4beee9f9 Add support for ashmem-host for host Windows
Migrate to tmpfile and fileno for temp file operations. These calls are
supported on MinGW, and the temp files are automatically cleaned up.

A Windows variant of ashmem-host is needed to support CursorWindows on
host Windows.

In Windows, it is not possible to unlink an open file, so the nlink
check in ashmem_validate_stat must be made Unix-only.

Test: SQLiteDatabaseTest in Google3
Test: libcutils_test_static on Windows

Bug: 317884162
Change-Id: I7fc0f1f49406b01549b7f4d7e138cb3e4d79be72
2024-03-15 20:03:30 +00:00
Kiyoung Kim
ad8cf52c4c Remove VNDK definition(s)
As of VNDK deprecation, any libraries that defines vndk is no longer
valid anymore. This change removes all VNDK definition(s) from modules
which was VNDK. Any former VNDK-SP libraries will be marked as double-loadable,
so it can keep be able to be referenced by LLNDK libraries.

Bug: 328994089
Test: AOSP CF build succeeded
Change-Id: I1662f16e5e446bb28167b0bb278cd63997267d2a
2024-03-15 08:19:44 +00:00
Xin Li
ba485e7f71 Merge "Merge Android 14 QPR2 to AOSP main" into main 2024-03-07 06:10:51 +00:00
Michael Hoisie
1140355bde Merge "Remove the redundant libcutils_sockets_test" into main 2024-03-07 06:01:19 +00:00
Michael Hoisie
d1e4c263c4 Remove the redundant libcutils_sockets_test
'sockets_test.cpp' also runs as part of libcutils_test and
libcutils_static_test, so it is redundant to have it be a separate
target.

Test: libcutils_test
Test: libcutils_static_test
Bug: 317884162
Change-Id: Ib2c2f74feb79d1436ca67ae9aca18d3eb7acf5a0
2024-03-06 22:18:58 +00:00
Vilas Bhat
89482bd443 Merge "ashmem: Remove hardcoded PAGE_SIZE usage in ashmem_test" into main am: 89fa277dcb
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2954211

Change-Id: I5bbb4901353724821d7a1c06bf1df37986f804b4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-14 01:11:32 +00:00
Vilas Bhat
89fa277dcb Merge "ashmem: Remove hardcoded PAGE_SIZE usage in ashmem_test" into main 2024-02-14 00:51:11 +00:00
Vilas Bhat
f791b99628 ashmem: Remove hardcoded PAGE_SIZE usage in ashmem_test
Bug: 323061793
Test: atest libcutils_test
Change-Id: I8defd5225859b52a1b96a638d418188b328a23bc
2024-02-13 20:50:00 +00:00
David Dai
f3337f69df Merge "Add AID for Virtual Machines" into main am: 161b80bd02
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2945529

Change-Id: I92a8f7a1c8d8fc5e0fe2c0ae39ac0b018e4cb462
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-06 01:59:21 +00:00
David Dai
851c9c825f Add AID for Virtual Machines
Add a new AID for Virtual Machines so we can grant
capabilities such as CAP_SYS_NICE.

Bug: 322197421
Test: Build and boots, and verified capabilities

Change-Id: Ie893ba8ed6956a554bccfbd00e4e6fe9212ea77d
Signed-off-by: David Dai <davidai@google.com>
2024-02-05 23:38:44 +00:00
Xin Li
7f41fd4852 Merge Android 24Q1 Release (ab/11220357)
Bug: 319669529
Merged-In: I856c812d22363cc1d1e8aa88706d4d3b89044f52
Change-Id: I9ef2aa7496bbf81f7f0da6b0ea46dc2157ad91f1
2024-01-29 21:19:57 -08:00
Yu-Ting Tseng
38cb94d32a Add AID_UPROBESTATS and set up its config dir.
Test: m, flash and reboot
Bug: 296108553
Change-Id: Ied5e688db8e93874ad66610c4d98c39d892d268b
2023-11-29 10:56:37 -08:00
Sophia Coldren
6221f6ed75 Merge "Add an include" into main am: d32b562ee9 am: b9a6391c7a am: b8b6762c0f am: c975c6ef4d am: 4111484a92
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2776100

Change-Id: I366cccdc8e54130db1d9bbde2957956b631bbf02
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-07 00:48:01 +00:00
Sophia Coldren
5880692ae2 Add an include
Change-Id: I0a6c64d9f1ddd9211de994fd4c6c44d53499775f
2023-10-06 18:46:17 +00:00
Elliott Hughes
aef90ea853 Merge "s/master/main/" into main am: b533f531df am: 5cc875126a am: 061a92c8ae am: fc090e5055 am: 01a560055c
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2772867

Change-Id: I4db6a0255b074444014e4116961e3b4df40c1dbf
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-05 18:46:11 +00:00
Elliott Hughes
716ff7b55a s/master/main/
Test: treehugger
Change-Id: Iabb23436d92686b934f2f2609217714b64ae75de
2023-10-04 23:31:09 +00:00
Elliott Hughes
6ec6769f03 Merge "Stop duplicating <linux/capabilities.h>." into main am: 8d983ee878 am: a441e2ef67 am: edb21216e2 am: 798327b6a4 am: 952aa920a0
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2760169

Change-Id: I1112912c33b2d94ab841fd1cad0f3a0ce61fc71d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-26 23:24:51 +00:00
Elliott Hughes
8d983ee878 Merge "Stop duplicating <linux/capabilities.h>." into main 2023-09-26 17:59:53 +00:00
Elliott Hughes
94ccdc06d0 Stop duplicating <linux/capabilities.h>.
This doesn't help the person who wants CAP_BPF, but we can fix that
better by adding it to our stale glibc (and our future switch to musl
will mean we'll never have similar problems again).

I think this just dates from when we still supported building the OS on
darwin, but those days are long gone, and I think this hack can be put
to rest now...

Test: treehugger
Change-Id: I3c2e56c68a5b00c1ad0aed422c6ce60886063f50
2023-09-25 20:33:02 +00:00
Treehugger Robot
19c054cc4f Merge "Do not check with vendor vndk version" into main am: 6d01651ab9 am: 9062abf0e5 am: fcdbce7f33 am: 3147ebc654 am: b94f5ee99f
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2758806

Change-Id: I6380bec21baec416a9e9bd53b8e88610447d5db7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-23 17:50:46 +00:00
Kiyoung Kim
45d88d496e Do not check with vendor vndk version
Current libcutils checks if memfd is supported with vendor VNDK version,
but this is no longer valid if VNDK is deprecated. As we can assume that
any vendor using this code is supported as long as it is treblelized,
simplify logic to check if memfd is valid to vendor only with
'ro.treble.enabled' property.

Bug: 290159430
Test: Cuttlefish with VNDK deprecated worked without error from
libcutils

Change-Id: I351f0798da99cb4827bc3e424b63a2eaee5c7461
2023-09-23 21:06:57 +09:00
Elliott Hughes
7318616f3a Merge "Remove Windows workaround in file not built for Windows." into main am: d091aa44b3 am: 503121ccea am: c1342bc826 am: 00f9682031 am: c358a91207
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2760267

Change-Id: I21d5323b5949195da985bddd8b868045dded6f9a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-23 02:20:43 +00:00
Elliott Hughes
d091aa44b3 Merge "Remove Windows workaround in file not built for Windows." into main 2023-09-22 22:56:38 +00:00
Treehugger Robot
525030f42e Merge "Remove unused files." into main am: 59a2cde894 am: 1a262a11d4 am: e2145d2fbb am: 510fd0f2b5 am: c9670bd7e0
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2759693

Change-Id: Iefd09423e207ca318d2bc95c1e7fc1e2691e2a00
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-22 22:44:48 +00:00
Treehugger Robot
c5851eded9 Merge "Don't duplicate uapi ioprio constants." into main am: 46c366b0ed am: de1aeee88d am: ab62e7d3b0 am: f2c81fdd01 am: 239978de62
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2759694

Change-Id: I7f6efb219fa48302f3d759cf686a5a696210b78a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-22 22:44:39 +00:00
Treehugger Robot
d4eca869d6 Merge "Remove redefinition of uapi constant added in R." into main am: d5b09b4b97 am: c3bbf8237a am: 7a1d3efb41 am: 5c30491a99 am: 73f83e22f9
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2760268

Change-Id: I784e9d263d970a94f3305776bb9505aba7c4cab0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-22 22:41:25 +00:00
Treehugger Robot
59a2cde894 Merge "Remove unused files." into main 2023-09-22 18:01:48 +00:00