Commit graph

64955 commits

Author SHA1 Message Date
Rick Yiu
e3d0307e34 Merge "rootdir/init.rc: Remove duplicated settings" 2020-11-23 13:48:31 +00:00
Rick Yiu
1848e5e69c rootdir/init.rc: Remove duplicated settings
Bug: 170507876
Test: build pass
Change-Id: I2cfa886eb84982f03df9bf0db95dc1aae2117418
2020-11-23 07:29:55 +00:00
Akilesh Kailash
e4ebcaac08 Merge "libsnapshot:snapuserd: Fix off by one error in merge path" 2020-11-23 06:23:54 +00:00
Akilesh Kailash
d83044d0c4 libsnapshot:snapuserd: Fix off by one error in merge path
We only need to iterate exceptions_per_area times during
merge. Additional iteration overhsoots the buffer and hence triggers
the assert.

BUG: 168311203
Test: Full OTA with VABC - Verified merge complete

Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: If6e8dee08802ea70a8fd40e93ad63a47f39ce96e
2020-11-23 04:28:26 +00:00
David Anderson
3fc6555565 Merge "libsnapshot: Add a compression bit to SnapshotUpdateStatus." 2020-11-22 23:54:02 +00:00
David Anderson
f71ad94e37 libsnapshot: Add a compression bit to SnapshotUpdateStatus.
This adds a compression bit to SnapshotUpdateStatus. This is so init can
tell whether it needs to launch snapuserd, without reading the
individual state of each snapshot, since this state is global.

Bug: 173476209
Test: manual test
Change-Id: I8c3bbfb0d184f70e661e7b043afc37e335d1e187
2020-11-22 21:48:29 +00:00
David Anderson
231cfc4fe6 Merge "libsnapshot: Add a helper for waiting for device paths." 2020-11-22 21:45:26 +00:00
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
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
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
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
7cf47025ee Merge "dmuserd: Fix error checking" 2020-11-20 01:58:13 +00: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
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
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
3bb971dcc3 Merge "libsnapshot: Add a compression bit to SnapshotStatus." 2020-11-19 20:50:52 +00: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
Peter Collingbourne
48c35f0cf6 Merge "Change the android_mallopt(M_SET_HEAP_TAGGING_LEVEL) API." 2020-11-18 20:57:36 +00: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
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
7e62aa568c Merge "Ramdisk: add metadata dir in ramdisk" 2020-11-17 13:52:19 +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
46d1844377 Merge "libsnapshot: snapuserd: Handle flush request" 2020-11-17 01:38:56 +00:00
Treehugger Robot
5205bb0758 Merge "iorap: Remove toggling iorapd on/off when using 'start' command." 2020-11-17 00:09:08 +00:00
Akilesh Kailash
023c62798c libsnapshot: snapuserd: Handle flush request
Handle flush operations by dm-snap post merge and
the ABI changes from dm-user. This
is now in sync with the latest dm-user patch (patch 25).

In case of any failures observed in daemon in the IO
path, return error code back to dm-user which
will eventually fail the IO.

Bug: 168311203
Test: vts_libsnapshot_test, cow_snapuserd_test

Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I4af63845f8c3e1c445f6c55374ea58b6f3454795
2020-11-16 23:59:35 +00:00
Peter Collingbourne
2a9da2ae9b Merge "Switch to the new kernel API for obtaining fault address tag bits." 2020-11-16 23:09:19 +00:00
Palmer Dabbelt
c16e503faa dmuserd: Simple dm-user daemon
This provides a block device via dm-user, with all accesses backed by
in-memory storage.  It's essentially the same as what I have in
selftests, with the kselftests stuff removed so it'll build in Android.

Test: mkfs.f2fs, dd, fsck.f2fs
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
Change-Id: I68515d6e9001c2f6d199d394e67ebe528b382406
2020-11-16 22:23:07 +00:00
David Anderson
7e3d157019 Merge changes I0cdef3d5,Ib4a281a3,I1569f927
* changes:
  init: Always create and restorecon /dev/dm-user.
  libsnapshot: Get DaemonTransition test passing again.
  libsnapshot: Move first-stage pid var constant into IDeviceInfo.
2020-11-16 19:53:35 +00:00
Treehugger Robot
5f5f6a11ef Merge "Fix comments." 2020-11-16 19:51:14 +00:00
yawanng
762653bdac iorap: Remove toggling iorapd on/off when using 'start' command.
Bug: 173166524
Test: adb shell stop
Test: adb shell start
Change-Id: I09722380f249405aeeb8a68287828d602313baa2
2020-11-16 18:45:47 +00:00
Yifan Hong
9210ee391d Fix comments.
Test: none
Change-Id: I1f2446ac31d9466ba01cef59079b49815571d6a1
2020-11-16 10:07:16 -08:00
Yifan Hong
a1ee8cea9d Merge "Fix AVB key path again." 2020-11-16 18:06:53 +00:00
lijiazi
9fa773746c Ramdisk: add metadata dir in ramdisk
Add the matadata directory for the non-VAB device to eliminate the
following init error logs:
[    1.891172] init: [libfs_mgr]check_fs():
mount(/dev/block/by-name/metadata,/metadata,ext4)=-1: No such
file or directory

Test: dmesg | grep metadata | grep "No such file or directory"

Change-Id: Ie4db10bd3cbc194d05e64ffb954f1956db2321c6
Signed-off-by: lijiazi <lijiazi@xiaomi.com>
2020-11-15 11:10:35 +08:00
Chun-Wei Wang
171621a90f Merge "Create the rollback directories in init (1/n)" 2020-11-14 12:03:28 +00:00
Yifan Hong
5d83d87ee6 Fix AVB key path again.
If device specifies moving AVB keys to vendor ramdisk, but
doesn't have a dedicated recovery partition, install to
vendor-ramdisk/first_stage_ramdisk.

Test: manual
Bug: 156098440
Change-Id: I05a8731236996dda0d1ab3c09828f7dac46f4ac7
2020-11-13 19:08:43 -08:00