Commit graph

72012 commits

Author SHA1 Message Date
Suren Baghdasaryan
ea98b60b86 libprocessgroup: Prevent error spam when tests disable all cpus in a cpuset
UserLifecycleTests test disables all Little cores in the course of the
test, which causes attempts to add a process into /dev/cpuset/restricted
cpuset cgroup to fail with ENOSPC error code, indicating that a process
is joining a cpuset cgroup with no online cpus. Current libprocessgroup
implementation will log an error on each such occurrence, which spams
the logs and makes it hard to analyze test results. Because this
situation does not happen in production environment (we do not offline
cpus), we can prevent flooding the logs by identifying this case,
logging an appropriate error one time and ignore all later similar errors.

Bug: 158766131
Test: adb shell "echo 0 > /sys/devices/system/cpu/cpu[0-3]/online"
Test: start some apps, observe libprocessgroup errors in the logcat
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
(cherry picked from commit ae42d601d0)
(cherry picked from commit 48e692cecd)
Merged-In: Ia91d8839d86787569c255481bde077be51c43d93
Change-Id: Ia91d8839d86787569c255481bde077be51c43d93
2022-03-02 18:17:55 -08:00
Kalesh Singh
71429a9738 Add group ID for reading tracefs
Add AID_READTRACEFS and mount tracefs with gid=AID_READTRACEFS

Bug: 209513178
Bug: 214061655
Test: adb shell ls -l /sys/kernel/tracing/events
Change-Id: Ibbfdf8a4b771bd7520ecbaaf15a1153d6bf0e599
Merged-In: Ibbfdf8a4b771bd7520ecbaaf15a1153d6bf0e599
2022-01-14 18:50:40 +00:00
David Anderson
739f4f5f60 libsnapshot: Fix CHECK failure during second phase merge
This CHECK prevents a release build from resuming a two-phase merge if
the merge initially failed in the first pass.

Bug: 213031779
Bug: 213253413
Bug: 193549218
Ignore-AOSP-First: cherry-pick from AOSP
Test: vts_libsnapshot_test
Test: update_engine_unittests
Change-Id: I8bf00e3016546ef7039bb0b18eb977cc3dc1066a
Merged-In: I8bf00e3016546ef7039bb0b18eb977cc3dc1066a
2022-01-07 02:36:11 +00:00
David Anderson
6834fe66d7 libsnapshot: Propagate merge phase across merge failures.
If a merge fails we write a new snapshot status indicating that the merge
failed. If this happens to occur during the second merge phase, we fail
to propagate the phase counter to the new status. This means the merge
is unlikely to make progress and succeed later.

Bug: 213031779
Bug: 213253413
Bug: 193549218
Ignore-AOSP-First: cherry-pick from AOSP
Test: inject transient failure into CheckMergeConsistency, apply OTA,
      reboot and complete merge.
Change-Id: I31fdae6bde48e3a71b6f3fcc663541257f7ebd8f
Merged-In: I31fdae6bde48e3a71b6f3fcc663541257f7ebd8f
2022-01-05 23:47:11 +00:00
Nikita Ioffe
654bb5225b Deflake libdm#CreateEmptyDevice test
Judging from local experiments, it looks like device-mapper doesn't
always generate a uevent after DM_DEV_CREATE ioctl.

Test: presubmit
Bug: 193462349
Change-Id: I8a74375631b20c14a32a41dbaf38380ebc0078e6
Merged-In: I8a74375631b20c14a32a41dbaf38380ebc0078e6
2022-01-04 05:48:59 +00:00
Alexander Potapenko
ea376a5c0f init.rc: disable creation of bootreceiver tracing instance for kernels >=4.9 and <= 5.4 am: 17b1c428d4 am: 9c75c6983a
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15981481

Change-Id: I07e546548847d5741000cf1fc58bd22a01c9774d
2021-12-23 11:21:18 +00:00
Alexander Potapenko
c920992f94 [automerger skipped] Restrict creation of bootreceiver tracing instance to 64-bit systems. am: c81fec7d8e -s ours am: 4edf845185 -s ours
am skip reason: skipped by user glider

Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15981480

Change-Id: I27cc0ad3f6074fd2376bceafa002dcdb1147e588
2021-12-23 11:21:17 +00:00
Alexander Potapenko
528b0f6700 init: introduce ro.kernel.version property am: 1c496e94e0 am: 2d64b0cafc
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15981479

Change-Id: I4a9c0c38b7015a770fea5a9ad518e2e17a799042
2021-12-23 11:21:15 +00:00
Alexander Potapenko
9c75c6983a init.rc: disable creation of bootreceiver tracing instance for kernels >=4.9 and <= 5.4 am: 17b1c428d4
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15981481

Change-Id: Ied7cd88b05e75b7aa5e3333a55cd5524c78ec427
2021-12-23 11:03:53 +00:00
Alexander Potapenko
4edf845185 [automerger skipped] Restrict creation of bootreceiver tracing instance to 64-bit systems. am: c81fec7d8e -s ours
am skip reason: skipped by user glider

Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15981480

Change-Id: I090ea8262ddfc1da119b3dbf2e61c32bf67a6c9b
2021-12-23 11:03:53 +00:00
Alexander Potapenko
2d64b0cafc init: introduce ro.kernel.version property am: 1c496e94e0
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15981479

Change-Id: I5f18d4e1e19d01c865ae40ae8e3368d67a3627e0
2021-12-23 11:03:51 +00:00
Wei Wang
cf4b15e61f libprocessgroup: fall back to cpuset in get_sched_policy
Since vendor has a way to override the group cpu/schedtune setup, we
cannot assume the group will always return valid data. This CL let
get_sched_policy to fallback to cpuset if no valid data found in
cpu/schedtune cgroup. In longer term, we should find a way to cache the
group or app's process state in framework other than relying on reading
cgroup back.

Test: /data/nativetest64/libcutils_test/libcutils_test
Bug: 210066228
Signed-off-by: Wei Wang <wvw@google.com>
Change-Id: I8b4396365a7fc2d93e3a22746195585c140eef3c
2021-12-14 10:57:05 -08:00
Wei Wang
a2c0b86ad0 Merge "libutils: do not follow process's group" into sc-v2-dev 2021-12-13 18:02:28 +00:00
Yi-yo Chiang
d1dbabbd4e Merge "Add /system_ext/etc/selinux/ to the debug policy search path for GSI" into sc-v2-dev 2021-12-10 04:05:11 +00:00
Wei Wang
d2b270c063 libutils: do not follow process's group
1) App doesn't have cgroup access and there is no purpose of reading cgroup
for app. For system_server it should be known in foreground group. So
there is no benefit of reading group.

2) Reading cgroup in apps can also cause contention for other cgroup
operations.

3) vendor can change cgroup setting and get_sched_policy may return
incorrect information for get_sched_policy_profile_name.

Test: Boot
Bug: 210011562
Signed-off-by: Wei Wang <wvw@google.com>
Change-Id: I8e8c8b346984781c56ec93c0616121f7d5c99fe5
2021-12-10 02:53:08 +00:00
Akilesh Kailash
4375229588 snapuserd: Address alignment fault on 32-bit systems
When the scratch space is mmap'ed, the metadata buffer
will be un-aligned. This may lead to alignment fault
on 32-bit systems. Address this by temporarily copying
it to buffer.

No perf impact as this code path is not in I/O path
and the copy is a for the size of metadata buffer which
is 8k.

Bug: 206426215
Test: Full and Incremental OTA on pixel
1: Compile snapuserd as 32 bit and reproduced the bug on pixel.
2: With fix - OTA applied successfully.
3: Reboot the device when merge was in-flight as the fix is primarily
in that path.
4: Verify merge completion and data integrity post merge.

Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: Icd4a21d6a61f1ab36e65994c06a4d049a2ee741c
Merged-In: I63c0d862057ebf138c9d1696a942030e30598739
2021-12-01 20:37:56 +00:00
Yi-Yo Chiang
1c1e267afc Add /system_ext/etc/selinux/ to the debug policy search path for GSI
This change only *adds* /system_ext/etc/selinux to the debug policy
search path, and does not change any preconditions to load the debug
policy. The device still needs to be bootloader-unlocked and has the
debug ramdisk flashed to be able to use the debug policy. The only thing
changed is that now the debug policy can be loaded from /system_ext or
/debug_ramdisk when system partition is compliance testing GSI.

The debug policy in the boot ramdisk may be outdated if the system
partition is flashed with a image built from a different revision.
This happens frequently when running the compliance testing VTS, where
the device is flashed with (A) GSI and (B) device vendor image & debug
boot image, and (A) and (B) are built from different git revisions.

To address this, we install a copy of the debug policy under
/system_ext, so that the version desync between (A) & (B) wouldn't be a
problem anymore because (A) no longer relies on the debug policy file
from (B).

Bug: 188067818
Test: Flash RQ2A.201207.001 bramble-user with debug ramdisk & flash
  gsi_arm64-user from master, device can boot and `adb root` works
Change-Id: I4d6235c73472e4d97619b2230292e6a0bc4b3e05
Merged-In: I4d6235c73472e4d97619b2230292e6a0bc4b3e05
(cherry picked from commit 650b29d234)
2021-11-24 14:38:07 +08:00
Suren Baghdasaryan
4f95599b96 llkd: Disable in userdebug builds by default
While llkd helps in discovering issues in apps which leave zombies, it
creates issues for dogfooders when apps are killed. Disable it by
default.

Bug: 202411543
Test: boot and check llkd not running
Test: `setprop ro.llk.enable true` enables llkd
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: If93bf9e981eaa3921a9da5f3160db26c4fe17e66
Merged-In: If93bf9e981eaa3921a9da5f3160db26c4fe17e66
2021-11-11 01:45:06 +00:00
TreeHugger Robot
921307851b Merge "init.rc: Create a new group for dex2oat" into sc-v2-dev 2021-10-26 07:09:28 +00:00
Rick Yiu
567dd77c81 init.rc: Create a new group for dex2oat
Create a new group for dex2oat in cpu cgroup, which is dedicated for
dex2oat processes. Also modify task profiles for this change.

Bug: 201223712
Test: dex2oat group created
Change-Id: Ic61f4b8a64d01c03549b680970805e12b9ce4fcc
Merged-In: Ic61f4b8a64d01c03549b680970805e12b9ce4fcc
2021-10-22 22:22:28 +08:00
Thurston Dang
77b37c9f87 storageproxyd: discard writes when checkpointing, if necessary am: 98e7f427e8
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/16049468

Change-Id: I8b0d1da6d516313b5e672bc3a6c0ea8075e01c17
2021-10-14 00:47:08 +00:00
Thurston Dang
98e7f427e8 storageproxyd: discard writes when checkpointing, if necessary
If a checkpointing operation is in progress, discard any write operations
that are flagged as STORAGE_MSG_FLAG_PRE_COMMIT_CHECKPOINT. In tandem
with trusty-side changes that set the flag appropriately, this avoids
the awkward case where the checkpoint is rolled back, which potentially
leads to inconsistency between the data and the superblock.

Based on Stephen's CL/1845477 "Add helper to check checkpoint state of
mounts".

Original change: https://android-review.googlesource.com/c/platform/system/core/+/1850058

Test: m storageproxyd
Bug: 194313068
Change-Id: I0924084f7f0b20018cbb71f5153469c8a686e262
Merged-In: I0924084f7f0b20018cbb71f5153469c8a686e262
(cherry picked from commit 34404f4ab1)
2021-10-13 19:35:18 +00:00
Alexander Potapenko
cb1fabeff6 Revert "Revert "init.rc: disable creation of bootreceiver tracing instance for kernels >=4.9 and <= 5.4"" am: 0e28aeb786
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/16045538

Change-Id: I144596dbd34448300b027b7890c1929344aa89b5
2021-10-13 17:46:52 +00:00
Alexander Potapenko
0e28aeb786 Revert "Revert "init.rc: disable creation of bootreceiver tracing instance for kernels >=4.9 and <= 5.4""
This reverts commit 220f604ca5.

Reason for revert: from bug 202436407 it looks like the initial revert wasn't needed.

Change-Id: I81dba47ee4bc55da2d4c5212dfc1b6200719b8be
2021-10-13 15:54:34 +00:00
Wei Wang
4dc0b4e1cb Merge "libutils: use system_background for low prio tasks in framework" into sc-qpr1-dev am: ecaf9ef70a
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15946148

Change-Id: I2094d7af01deb3ca3c8acd52da54e0849a8c0c73
2021-10-08 21:26:33 +00:00
Wei Wang
52dc14cece task_profiles: add ServicePerformance to legacy device policy am: 276ba2c75b
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15998087

Change-Id: Iac66ba0d501e34679fefd259d3d1ee0306050d28
2021-10-08 21:26:32 +00:00
Wei Wang
ecaf9ef70a Merge "libutils: use system_background for low prio tasks in framework" into sc-qpr1-dev 2021-10-08 21:14:04 +00:00
Wei Wang
276ba2c75b task_profiles: add ServicePerformance to legacy device policy
Since we are adding SCHED_SP_SYSTEM into framework, the policy is needed
on older releases as well.

Bug: 201428466
Test: Build
Signed-off-by: Wei Wang <wvw@google.com>
Change-Id: I0784820bfec84fd8ef98f2feb2caee084d0a14a2
Merged-In: I0784820bfec84fd8ef98f2feb2caee084d0a14a2
2021-10-08 21:13:54 +00:00
Chiayu Pei
f8c43a23be Revert "init.rc: disable creation of bootreceiver tracing instance for kernels >=4.9 and <= 5.4" am: 220f604ca5
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/16013258

Change-Id: Ifc9e3b5176bfc16b39800fe95abbb629372dfa42
2021-10-08 11:33:32 +00:00
Chiayu Pei
220f604ca5 Revert "init.rc: disable creation of bootreceiver tracing instance for kernels >=4.9 and <= 5.4"
This reverts commit 4edda28b92.

Reason for revert: b/202436407

Change-Id: I4cdbdb756b9fc61bb6f5ff61335fec7d541ec6a2
2021-10-08 04:26:55 +00:00
Wei Wang
7ee4980dc2 libutils: use system_background for low prio tasks in framework
Bug: 201428466
Test: Build and boot check system_server's sched group
Signed-off-by: Wei Wang <wvw@google.com>
Change-Id: Iffc47fdaf3ef8fba6eb01a12cf534a0393e3e91c
Merged-In: Iffc47fdaf3ef8fba6eb01a12cf534a0393e3e91c
2021-10-07 17:58:44 +00:00
Alexander Potapenko
4224e6af27 init.rc: disable creation of bootreceiver tracing instance for kernels >=4.9 and <= 5.4 am: 4edda28b92
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15994846

Change-Id: Id9689529bf82732e052bd45edcf2f542d58b6bf9
2021-10-06 22:09:07 +00:00
TreeHugger Robot
bbd75121ac Merge "Restrict creation of bootreceiver tracing instance to 64-bit systems." into sc-qpr1-dev am: b0cd5f87e8
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15994475

Change-Id: I81826fce89727ef04033bd19adb2ed68fa6f4470
2021-10-06 18:19:22 +00:00
Alexander Potapenko
ed6511f5d4 init: introduce ro.kernel.version property am: e69aea9256
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15994474

Change-Id: I2e2a67eaf3c44151b7a8fad0c33160bb5e6e6c67
2021-10-06 18:19:21 +00:00
Alexander Potapenko
4edda28b92 init.rc: disable creation of bootreceiver tracing instance for kernels >=4.9 and <= 5.4
The tracing instance takes extra RAM and is not needed on devices running older kernels.

Bug: 194156700
Test: manual on a Pixel device

Signed-off-by: Alexander Potapenko <glider@google.com>
Merged-In: I794062741688ebea0e4bc500723a966f8f646ee1
Change-Id: Ie8614e67a89cea67bed88427820fefdf110713c9
2021-10-06 18:12:46 +00:00
TreeHugger Robot
b0cd5f87e8 Merge "Restrict creation of bootreceiver tracing instance to 64-bit systems." into sc-qpr1-dev 2021-10-06 18:06:20 +00:00
Alexander Potapenko
17b1c428d4 init.rc: disable creation of bootreceiver tracing instance for kernels >=4.9 and <= 5.4
The tracing instance takes extra RAM and is not needed on devices running older kernels.

Bug: 194156700
Test: manual on a Pixel device

Signed-off-by: Alexander Potapenko <glider@google.com>
Merged-In: I794062741688ebea0e4bc500723a966f8f646ee1
Change-Id: Ie8614e67a89cea67bed88427820fefdf110713c9
2021-10-06 16:22:43 +00:00
Alexander Potapenko
c81fec7d8e Restrict creation of bootreceiver tracing instance to 64-bit systems.
The main users of this instance are KFENCE and MTE-aided KASAN, which are only supported on arm64.
Skip creation of this tracing instance on 32-bit systems to save ~6Mb memory on low-end devices.

Bug: 195089948
Bug: 194719088
Bug: 194156700
Test: manual on Pixel device
Merged-In: Icaf762715fed7a282b1ad738c10bcb45dc848f4d
Change-Id: I61694ce174fa745ef9fd50ca7464b5a9e1d1e011
2021-10-06 16:22:35 +00:00
Alexander Potapenko
1c496e94e0 init: introduce ro.kernel.version property
This property will hold the major.minor part of the kernel version (e.g. "5.4"), allowing init scripts to act depending on that version, enabling and disabling certain features.

Bug: 194156700
Test: manual on a Pixel device
Signed-off-by: Alexander Potapenko <glider@google.com>
Merged-In: Icec640b8a7150b344d9aa3bc0bdbcdae050c7c45
Change-Id: I5af411e39da600e5e0f6703f3a2a4930d509e29d
2021-10-06 16:22:23 +00:00
Alexander Potapenko
b5f93dfa5d Restrict creation of bootreceiver tracing instance to 64-bit systems.
The main users of this instance are KFENCE and MTE-aided KASAN, which are only supported on arm64.
Skip creation of this tracing instance on 32-bit systems to save ~6Mb memory on low-end devices.

Bug: 195089948
Bug: 194719088
Bug: 194156700
Test: manual on Pixel device
Merged-In: Icaf762715fed7a282b1ad738c10bcb45dc848f4d
Change-Id: I61694ce174fa745ef9fd50ca7464b5a9e1d1e011
2021-10-06 16:13:06 +00:00
Alexander Potapenko
e69aea9256 init: introduce ro.kernel.version property
This property will hold the major.minor part of the kernel version (e.g. "5.4"), allowing init scripts to act depending on that version, enabling and disabling certain features.

Bug: 194156700
Test: manual on a Pixel device
Signed-off-by: Alexander Potapenko <glider@google.com>
Merged-In: Icec640b8a7150b344d9aa3bc0bdbcdae050c7c45
Change-Id: I5af411e39da600e5e0f6703f3a2a4930d509e29d
2021-10-06 16:12:41 +00:00
Stephen Crane
535c977f69 [automerger skipped] storageproxyd: Retry RPMB request on UNIT ATTENTION am: ab2257ee48 -s ours am: 857115b1ef -s ours
am skip reason: Merged-In Ib970e779365bb396756c114684c7f6e56a737ab1 with SHA-1 d1a212e0d8 is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15983377

Change-Id: I84a528f7337f3d2b1167c522ae80f460bbe79d45
2021-10-05 19:36:30 +00:00
Stephen Crane
3875ee806c [automerger skipped] storageproxyd: Fix inverted conditional in error checking am: 237679cfca -s ours am: 122048f24c -s ours
am skip reason: Merged-In I3b84188aabe58345a83d2fd57bb8103e730cf365 with SHA-1 dcdac24306 is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15983384

Change-Id: I51484d6a348e037b6a03bd2d43675030b34bd717
2021-10-05 19:36:29 +00:00
Stephen Crane
39e256cb31 [automerger skipped] [storageproxyd] Dump binary buffers to log instead of stderr am: 77e2af18be -s ours am: c898d12eda -s ours
am skip reason: Merged-In Iecc0d4680420bb92c94be628789093888a2f1941 with SHA-1 f647221827 is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15983383

Change-Id: I782b7b1e24622e2c4b5fc8174703d8a4108df10c
2021-10-05 19:36:29 +00:00
Stephen Crane
56428d1f7c [automerger skipped] storageproxyd: Add logging of failed RPMB transactions am: bf6e22a318 -s ours am: a2613eace1 -s ours
am skip reason: Merged-In I928ddebcb65aa6c305d3dcab7c64bd19d11a50fa with SHA-1 642d977bc8 is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15983382

Change-Id: I637187d82ca9028e23f9abee191fe418450fea06
2021-10-05 19:36:28 +00:00
Stephen Crane
934043d87e [automerger skipped] storageproxyd: Add file handle param to debug buffer print am: 4ee811ee46 -s ours am: d10e28fc29 -s ours
am skip reason: Merged-In Iade322a21312a676b3599bddafdfc43b599617ea with SHA-1 3bb483b196 is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15983379

Change-Id: Ia0454c9c8939b5626367db01bd2a8b5198a7f659
2021-10-05 19:36:27 +00:00
Stephen Crane
857115b1ef [automerger skipped] storageproxyd: Retry RPMB request on UNIT ATTENTION am: ab2257ee48 -s ours
am skip reason: Merged-In Ib970e779365bb396756c114684c7f6e56a737ab1 with SHA-1 d1a212e0d8 is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15983377

Change-Id: I665ffb3d37b5fa4c1eeb61b5ddf249f2c754f27a
2021-10-05 19:22:00 +00:00
Stephen Crane
122048f24c [automerger skipped] storageproxyd: Fix inverted conditional in error checking am: 237679cfca -s ours
am skip reason: Merged-In I3b84188aabe58345a83d2fd57bb8103e730cf365 with SHA-1 dcdac24306 is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15983384

Change-Id: I7b4344764e66de4a2848dec9319c6e3abc89751e
2021-10-05 19:21:59 +00:00
Stephen Crane
c898d12eda [automerger skipped] [storageproxyd] Dump binary buffers to log instead of stderr am: 77e2af18be -s ours
am skip reason: Merged-In Iecc0d4680420bb92c94be628789093888a2f1941 with SHA-1 f647221827 is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15983383

Change-Id: I55e606476410febd80dbad2662f6f75c3521d239
2021-10-05 19:21:59 +00:00
Stephen Crane
a2613eace1 [automerger skipped] storageproxyd: Add logging of failed RPMB transactions am: bf6e22a318 -s ours
am skip reason: Merged-In I928ddebcb65aa6c305d3dcab7c64bd19d11a50fa with SHA-1 642d977bc8 is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15983382

Change-Id: Ifa30cff385ebaf558bde531b0bbc2777f9fbdd4b
2021-10-05 19:21:58 +00:00