Commit graph

67347 commits

Author SHA1 Message Date
David Anderson
189e8e3a25 libsnapshot: Add a helper for waiting for device paths.
Normally, DeviceMapper::CreateDevice() handles this for us. However, it
does not work in first-stage init, because ueventd is not running.
Therefore this patch adds a way for first-stage init to set a callback
to manually regenerate and process uevents.

Additionally, even with ueventd, dm-user misc device creation needs a
WaitForFile() call, since ueventd is asynchronous.

The WaitForDevice() helper in this patch accounts for both of these
scenarios.

Bug: 173476209
Test: device boots into first-stage init after full VABC ota
Change-Id: Ib7a9bfc2a5a5095aa00b358072f9cb1743c19ab2
2020-11-21 17:12:23 -08:00
David Anderson
84cfcc23c2 Merge "snapuserd: Include the misc device when logging in each snapuserd thread." 2020-11-22 00:49:59 +00:00
David Anderson
8d2bd038f4 snapuserd: Include the misc device when logging in each snapuserd thread.
Bug: N/A
Test: manual test
Change-Id: Ifd6ac5a802549ccc9271b62eedd1509552f27ead
2020-11-21 13:29:42 -08:00
Treehugger Robot
3d88f4bade Merge changes I83babad2,Iaeb081bc am: 9c4caa22ff
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1504277

Change-Id: Ia5019f240a27d1a001485d946c7b6f8fd083922d
2020-11-21 02:58:21 +00:00
Treehugger Robot
9c4caa22ff Merge changes I83babad2,Iaeb081bc
* changes:
  init.rc: migrate tasks from root cpu cgroup to a subgroup
  task_profiles.json: use system subgroup for NormalPerformance
2020-11-21 02:15:10 +00:00
Wei Wang
77cb6a0015 init.rc: migrate tasks from root cpu cgroup to a subgroup
Migrate tasks from root group to a subgroup would help us to put soft
cpu bandwidth control correctly. There are few tasks now failed to
migrate due to PF_NO_SETAFFINITY which is the default kernel behavior
which we are not overriding at this moment.

This CL also fixed an issue that most of RT thread lost RT attribute
when kernel with CONFIG_RT_GROUP_SCHED enabled, as the subgroup would be
initialized with 0 RT runtime by default. CONFIG_RT_GROUP_SCHED is not
enabled in GKI kernels but there could be devices with
CONFIG_RT_GROUP_SCHED enabled, so setting some budget for those devices
to make they can still function. OEM can either set proper budget by
themselves or remove CONFIG_RT_GROUP_SCHED completely.

Bug: 171740453
Test: boot and check cgroup
Change-Id: I83babad2751c61d844d03383cb0af09e7513b8e9
2020-11-20 12:59:20 -08:00
Wei Wang
0b140bfcf0 Merge "init: add a copy_per_line built-in command" am: 4544d991f7
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1504276

Change-Id: I84efd2500edaac9441795fe9c9354972eb04d8ab
2020-11-20 20:34:08 +00:00
Yifan Hong
0b76e8688f Merge changes from topic "e2fsprogs_vendor_ramdisk" am: 15cd1cd8fd
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1506379

Change-Id: Ie0a06de38161c061ab839cc49af55c16d959be61
2020-11-20 20:32:59 +00:00
Yifan Hong
0f412f0635 libsparse: make vendor_ramdisk_available. am: e85233c560
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1504109

Change-Id: I00986c31cb5cc1bcc98db69c633a768673c16d70
2020-11-20 20:32:55 +00:00
Yifan Hong
a926efce28 init: don't abort if directory already exists am: 7e7f881508
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1506376

Change-Id: I5a70265e408300a3343e95633f2e447d880f70b1
2020-11-20 20:32:44 +00:00
Wei Wang
4544d991f7 Merge "init: add a copy_per_line built-in command" 2020-11-20 20:05:40 +00:00
Yifan Hong
15cd1cd8fd Merge changes from topic "e2fsprogs_vendor_ramdisk"
* changes:
  fs_config Add first_stage_ramdisk/system/bin/linker[64]
  libsparse: make vendor_ramdisk_available.
  init: don't abort if directory already exists
2020-11-20 19:50:44 +00:00
Daniel Norman
c3792a5706 Merge "Returns a service parse error on overrides across the treble boundary." am: cf539f162f
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1493249

Change-Id: I056580bcd02fa0cd72a2d907f83c52fb1eaf582f
2020-11-20 19:29:04 +00:00
Daniel Norman
cf539f162f Merge "Returns a service parse error on overrides across the treble boundary." 2020-11-20 18:57:17 +00:00
Wei Wang
b90e23efc7 task_profiles.json: use system subgroup for NormalPerformance
Put tasks into a subgroup so that we can set things up e.g. soft cpu
bandwidth and/or uclamp.

Bug: 170507876
Bug: 171740453
Test: boot and check cgroup
Change-Id: Iaeb081bc4f214aa23eb281e0c28a81ea581bb4d1
2020-11-20 10:54:55 -08:00
Wei Wang
49d2598166 init: add a copy_per_line built-in command
There are sysfs nodes that don't take multiple inputs, adding a new
copy_per_line built-in command to copy from source file to destination
line by line.

Bug: 171740453
Test: boot and check file and log
Change-Id: I41b7a565829299d56b81d4509525dfa6a0a52444
2020-11-20 10:54:14 -08:00
Treehugger Robot
f809223ffb Merge "dmuserd: Fix error checking" am: 7cf47025ee
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1506837

Change-Id: Ib88c59b3e93fb2d5c832ec074bed8223ec1c297e
2020-11-20 02:19:45 +00:00
Treehugger Robot
7cf47025ee Merge "dmuserd: Fix error checking" 2020-11-20 01:58:13 +00:00
Yifan Hong
e85233c560 libsparse: make vendor_ramdisk_available.
Test: pass
Bug: 173425293
Change-Id: Id360f205b9135b83edb59d13f978eb28cad041de
2020-11-19 17:35:21 -08:00
Yifan Hong
7e7f881508 init: don't abort if directory already exists
create_directories return false with ec == 0 if directory
already exists. Do not abort in this case.

Bug: 173425293
Test: boots with pre-existing /first_stage_ramdisk/system/bin
Change-Id: I351837f0a5a56361ebc385b9a9da9658882a131d
2020-11-19 17:35:21 -08:00
Yifan Hong
c7ed02f445 fs_config Add first_stage_ramdisk/system/bin/linker[64]
Now that tune2fs and resize2fs may be dynamic, add linker[64] to
first_stage_ramdisk/system/bin.

Test: boot and examine serial output, ensure tune2fs and resize2fs
      can be executed.
Bug: 173425293

Change-Id: I35699b38ddf5004c04ec0adc1b0c54d5d9c92ae6
2020-11-19 17:35:21 -08:00
Treehugger Robot
3698ff1bd2 Merge "The last line should not end with backslash" am: fc42b3e937
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1506402

Change-Id: If406953b9e043044c61bb930863c56bf229b335d
2020-11-20 01:16:11 +00:00
Treehugger Robot
fc42b3e937 Merge "The last line should not end with backslash" 2020-11-20 00:46:58 +00:00
Greg Kaiser
10e3d620b4 dmuserd: Fix error checking
We change read_all() and write_all() to return signed values, so
our negative error return values will be correctly caught.

Test: TreeHugger
Change-Id: I4d03d4475bccb40ae4b84a846966139b34ede2bd
2020-11-19 16:15:48 -08:00
Sasha Smundak
92500f1d93 The last line should not end with backslash
Bug: 173737347
Test: treehugger
Change-Id: I4cae512e92c228684e9743939e29691e2beabebb
2020-11-19 14:54:24 -08:00
David Anderson
6b963a9e55 Merge "libsnapshot: Add a compression bit to SnapshotStatus." am: 3bb971dcc3
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1498953

Change-Id: Ide7f466e6116aef0de418d7b56c268e08679dc74
2020-11-19 21:04:56 +00:00
David Anderson
3bb971dcc3 Merge "libsnapshot: Add a compression bit to SnapshotStatus." 2020-11-19 20:50:52 +00:00
Tom Cherry
a7f1a9fec8 fs_mgr: move mkdir(mount_point) to prepare_fs_for_mount()
prepare_fs_for_mount() attempts to mount() the block device at the
mount_point, so it must be created beforehand, as opposed to later in
__mount() where it is done now.

Also fix slight bugs with using fstab.mount_point instead of an
alternative specified mount_point.

Test: boot
Change-Id: I758b6a6efe2dd99433fc1974b69cb6f7ce3bc0c2
2020-11-19 11:41:09 -08:00
Daniel Norman
f597fa5d1d Returns a service parse error on overrides across the treble boundary.
Also includes new --out_<partition> flags for
  system,system_ext,product,vendor,odm
to allow host_init_verifier to work with a collection of init rc files.

Test: host_init_verifier --out_system=... --out_vendor=...
      where vendor contains an init rc file that overrides a service
      present in system. Observe parse failure and non-zero exit.
Bug: 163089173
Change-Id: I520fef613e0036df8a7d47a98d47405eaa969110
2020-11-19 10:02:56 -08:00
David Anderson
d1aa4a2996 libsnapshot: Build snapuserd and its dependencies into vendor_ramdisk.
For GKI devices, snapuserd should be in vendor_boot.

Bug: 173463595
Test: manual test
Change-Id: I1df18a2f3f2b67605187f18b4f7b6b3cf4f89674
2020-11-18 22:06:05 -08:00
Peter Collingbourne
1d26ff2633 Merge "Change the android_mallopt(M_SET_HEAP_TAGGING_LEVEL) API." am: 48c35f0cf6
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1484977

Change-Id: Ia999d3234d822c780ab09c4ee3991bcb6c3f9844
2020-11-18 21:39:11 +00:00
Tri Vo
91671edde9 Merge changes I46a58ae9,I5eb8413e am: 3434e29e1c
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1502268

Change-Id: I1e91a7d0343fe9f25792d74e2baadc91533ed4ba
2020-11-18 21:37:07 +00:00
Peter Collingbourne
48c35f0cf6 Merge "Change the android_mallopt(M_SET_HEAP_TAGGING_LEVEL) API." 2020-11-18 20:57:36 +00:00
Tri Vo
421de90544 trusty: Add libtrusty_test
Used by tests on the system side of the Treble boundary, e.g. fuzzing

Test: m libtrusty libtrusty_test
Change-Id: I56a15c80eb7c4b9e51f8e59a7cd1abdfc35d8d5a
2020-11-18 12:17:16 -08:00
Tri Vo
3434e29e1c Merge changes I46a58ae9,I5eb8413e
* changes:
  trusty: wrap syscalls in TEMP_FAILURE_RETRY
  trusty: Reformat libtrusty
2020-11-18 20:02:36 +00:00
Peter Collingbourne
71ad49554f Change the android_mallopt(M_SET_HEAP_TAGGING_LEVEL) API.
- Make it apply to every thread, and thus remove the restriction
  that it must be called while the program is single threaded.
- Make it change TCF0 itself (on all threads), instead of requiring
  callers to do it themselves, which can be error prone.

And update all of the call sites.

Change the implementation of
android_mallopt(M_DISABLE_MEMORY_MITIGATIONS) to call
android_mallopt(M_SET_HEAP_TAGGING_LEVEL) internally. This avoids
crashes during startup that were observed when the two mallopts
updated TCF0 unaware of each other.

I wouldn't expect there to be any out-of-tree callers at this point,
but it's worth noting that the new interface is backwards compatible
with the old one because it strictly expands the set of situations in
which the API can be used (i.e. situations where there are multiple
threads running or where TCF0 hadn't been updated beforehand).

Bug: 135772972
Change-Id: I7746707898ff31ef2e0af01c4f55ba90b72bef51
2020-11-18 10:24:29 -08:00
Oliver Nguyen
c154aeda4c Merge "Revert "Create a pool of 20 measurement files per library for coverage."" am: 279a719fe6
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1500967

Change-Id: Ib51365f313e7404f91da4bac268c52254c30d87c
2020-11-18 08:09:26 +00:00
Martijn Coenen
7df339f2be Merge "Call early-boot-ended from init." am: 0de764d716
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1496222

Change-Id: I2c77bbeee79133adfa9b7bbec0031f75335484d4
2020-11-18 08:09:07 +00:00
Oliver Nguyen
279a719fe6 Merge "Revert "Create a pool of 20 measurement files per library for coverage."" 2020-11-18 07:52:31 +00:00
Martijn Coenen
0de764d716 Merge "Call early-boot-ended from init." 2020-11-18 07:51:31 +00:00
Tri Vo
27b0b3f770 trusty: wrap syscalls in TEMP_FAILURE_RETRY
Needed to handle EINTR robustly.

Test: m libtrusty
Change-Id: I46a58ae911fd8db3d3528e24edbb6013d807b48c
2020-11-17 19:56:07 -08:00
Tri Vo
b47dbe7eb0 trusty: Reformat libtrusty
Test: m libtrusty
Change-Id: I5eb8413e7581603879de5abcb6de7b1b6d3484c0
2020-11-17 19:55:59 -08:00
Oliver Nguyen
0c4fb3dd4b Revert "Create a pool of 20 measurement files per library for coverage."
This reverts commit ca54a7b7a6.

Reason for revert: Missing coverage measurements for some tests

Change-Id: I5d5e364eb7ecb5b870cd3d5f529b39d78082c0ea
2020-11-17 19:01:14 +00:00
Tom Cherry
d571a7a6da Merge "Ramdisk: add metadata dir in ramdisk" am: 7e62aa568c
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1498627

Change-Id: I7b32a22c54588625747d6d331ecb490f83b23016
2020-11-17 14:07:07 +00:00
Tom Cherry
7e62aa568c Merge "Ramdisk: add metadata dir in ramdisk" 2020-11-17 13:52:19 +00:00
Palmer Dabbelt
4b21cc70b6 Merge "dmuserd: Simple dm-user daemon" am: b065d2444a
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1478508

Change-Id: I2f759381bbef25fd8d91754067a9285fb3a64c92
2020-11-17 04:00:25 +00:00
Palmer Dabbelt
b065d2444a Merge "dmuserd: Simple dm-user daemon" 2020-11-17 03:45:50 +00:00
David Anderson
411339c727 libsnapshot: Add a compression bit to SnapshotStatus.
Using ro.virtual_ab.compression.enabled does not work in first-stage
init, since properties aren't available. Instead, attach a compression
bit to SnapshotStatus. Although there are no plans to have per-snapshot
compression toggles, this route avoids creating a new state or indicator
file elsewhere. And SnapshotStatus is available in every place that
cares about compression.

Bug: N/A
Test: apply OTA with VABC
Change-Id: I51deb5693a08417ea7a2c524e240191748907123
2020-11-16 18:24:30 -08:00
Akilesh Kailash
395a6528f6 Merge "libsnapshot: snapuserd: Handle flush request" am: 46d1844377
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1500250

Change-Id: I4afb4edd8e0a5941dc99b5bbf14ce81f44574e94
2020-11-17 01:52:21 +00:00
Akilesh Kailash
46d1844377 Merge "libsnapshot: snapuserd: Handle flush request" 2020-11-17 01:38:56 +00:00