Commit graph

3266 commits

Author SHA1 Message Date
Tianjie Xu
5aa52d91dd Revert "libsnapshot: Partially implement OpenSnapshotWriter."
Revert "Link to libsnapshot_cow everywhere libsnapshot is linked."

Revert submission 1433573-vab-libsnapshot-linkage

Reason for revert: b/169981170, update crash for droidfooders.
Reverted Changes:
Ie75bba98c:Link to libsnapshot_cow where libsnapshot is linke...
Ieedfadc55:libsnapshot: Partially implement OpenSnapshotWrite...
I28a5d4a88:Link to libsnapshot_cow everywhere libsnapshot is ...

Exempt-From-Owner-Approval: Revert to unblock dogfood
Change-Id: I0677df77672aca9fd54d94e009ac0be7c88a1a9d
2020-10-03 19:26:18 +00:00
David Anderson
75b982ad30 libsnapshot: Partially implement OpenSnapshotWriter.
Implement OpenSnapshotWriter for non-compressed Virtual A/B. This is
done by adding an OnlineKernelSnapshotWriter class, which forwards all
writes to a dm-snapshot block device.

This also introduces a new ISnapshotWriter class which extends
ICowWriter, and adds features specific to libsnapshot (versus ICowWriter
which is intended only for the new COW format). The OpenSnapshotReader
call has been moved here since the writer retains all the information
needed to create the reader.

To test the new call, vts_libsnapshot_test has been modified to use
OpenSnapshotWriter.

As part of this change, all consumers of libsnapshot must now link to
libsnapshot_cow.

Bug: 168554689
Test: vts_libsnapshot_test
Change-Id: Ieedfadc557833c1e0540922aabc6e95c80266a64
2020-09-28 11:24:37 -07:00
Jooyung Han
2833e5d37d ueventd: change firmware location in apexes
To be consistent with other prebuilt modules within APEXes, the location
for firmware files is switched from /apex/*/firmware to
/apex/*/etc/firmware.

Bug: 167942098
Test: loading vibrator firmware from vibrator apex(sunfish)
Change-Id: Ia05735bf5a54482fded26525fa4a8f795dcfc029
2020-09-21 10:56:10 +09:00
Jooyung Han
21cad321db ueventd: scans /apex/*/firmware for firmwares
In addition to "firmware_directories", ueventd scans /apex/*/firmware/
directory as well to find firmware files.

Bug: 167942098
Test: loading firmware from vibrator apex successfully.
      (sunfish)
Change-Id: I90fc8f9ad843a08b1ca98a2be1b5d22c0c5954a3
2020-09-19 08:07:35 +09:00
Treehugger Robot
fd19ef40e8 Merge "Freeze com.android.sysprop.init API" 2020-09-15 02:02:25 +00:00
Jooyung Han
7bfe477b3d init: "init subcontext" in default mount namespace
"init subcontext" is responsible to handle a few commands in vendor
context. To support Vendor APEX, "init subcontext" is now started in
"default" mount namespace so that those commands can access /apex/*.

For example, insmod should see the contents of /apex to install kernel
modules in apexes.

Bug: 162701747
Test: adb shell ps -ef | grep init
      => check pid of <init subcontext>
      adb shell readlink /proc/<pid: init>/ns/mnt
      adb shell readlink /proc/<pid: init subcontext>/ns/mnt
      => check if these are equal
Change-Id: Icd5e862e52d78635e83824b267b6d32d8f3e9eea
2020-09-14 17:40:45 +09:00
Inseob Kim
2a8c714145 Freeze com.android.sysprop.init API
Bug: 145259948
Test: m com.android.sysprop.init-check-api
Change-Id: I5909c16390c35b5e5adf4c82eed191cc9ae82014
2020-09-14 13:51:27 +09:00
Tom Cherry
9481c67321 Merge "init: do not create dev.mnt. properties for emulated mounts" 2020-09-10 20:47:35 +00:00
Tom Cherry
e1bcd93326 init: do not create dev.mnt. properties for emulated mounts
dev.mnt. properties are primarily intended for tuning parameters for
mounts such as /system and /data but don't have much use for emulated
mounts.

There are additional emulated mounts created for each user on a
device, so if too many users are created, init would otherwise create
too many dev.mnt. properties, filling the property file that backs
these properties, and preventing more properties from being
generated.

Therefore, this change stops init from creating dev.mnt. properties
for emulated mounts.

Bug: 156721033
Test: user creation stress test doesn't create large numbers of
properties

Change-Id: I6475956719b7c938b8289189abfef661140d526d
2020-09-10 18:09:25 +00:00
Nikita Ioffe
4e311d69b5 Merge "Only store result of mount_all that mounted userdata" am: edc501d674
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1420053

Change-Id: I444f74692633b2bc4f5bcf03cd036b5c52b120aa
2020-09-08 23:10:11 +00:00
Nikita Ioffe
9ede7ec273 Only store result of mount_all that mounted userdata
During boot sequence there can be multiple calls to mount_all. For the
userspace reboot to correctly remount userdata, we need to store the
return code of the one that was responsible in mounting userdata.

Test: adb root
Test: adb shell setprop init.userspace_reboot.is_supported 1
Test: adb reboot userspace
Test: checked dmsg
Bug: 166353152
Change-Id: Id0ae15f3bcf65fa54e4e72b76f64716c053af7fb
2020-09-08 21:58:43 +01:00
Xin Li
0a112d52f8 Merge Android R (rvc-dev-plus-aosp-without-vendor@6692709)
Bug: 166295507
Merged-In: Id18cb0e2d2f3e776a42b566c4a1af2e250890896
Change-Id: Iba7cab32ab3aa6f47952c840ff6dc8492e8d0704
2020-08-29 01:42:13 -07:00
Gavin Corkery
c0d11aa73a Merge "Store userspace reboot info in /metadata" 2020-08-26 21:47:19 +00:00
Gavin Corkery
8c92256df5 Store userspace reboot info in /metadata
Store pertinent information about userspace reboot events in the case
of failure. This information is any services which failed to stop
cleanly, the output of the default fstab and /proc/mounts, and
a list of mounts which failed to unmount. This information is only
stored as necessary (i.e. mount information will not be stored if
everything unmounted, even if some services failed to stop).

Added new /metadata/userspacereboot directory to persist this
information. Information older than 3 days will be deleted.

Test: adb reboot userspace with sigterm/sigkill timeouts set to
      very low values
Test: Manual test of storing all other information
Bug: 151820675
Change-Id: I6cfbfae92a7fc6f6c984475cad2c50c559924866
2020-08-21 17:32:34 +01:00
Treehugger Robot
d7cb6e1fd0 Merge "Revert "Fix non-existent module error"" 2020-08-18 07:41:01 +00:00
Paul Crowley
9acab5a4d6 Set ro.crypto.type even on failure
Move responsibility for setting ro.crypto.type into fs_mgr_mount_all,
so that even if setting up the filesystem fails, the type is set
correctly and so errors are appropriately handled.

Bug: 162289984
Test: simulate a failure and check that it's set.
Change-Id: Ib061a454e7e21d7206c3c1fa8e88e16618099581
2020-08-14 11:36:39 -07:00
Yo Chiang
4adce5fec3 Revert "Fix non-existent module error"
This reverts commit 78ee4c1005.

Reason for revert: revert bad fix

Change-Id: I45c2bc2414679d525677b0bc103167316e16b0c4
2020-08-13 04:54:18 +00:00
Yo Chiang
78ee4c1005 Fix non-existent module error
TARGET module init_vendor requires non-existent TARGET module: init_first_stage

Module `init_first_stage` is skipped (not defined) on ASAN builds.

Bug: 163802658
Test: TH
Change-Id: I5aa030dfaa59a21511a7112ff89f8a5d8b8dc735
2020-08-12 16:27:08 +00:00
Jooyung Han
f7c2585f6d Fix the order for boot scripts scanning
To support "override" services, we need to scan partitions from least
speicific to most specific.

Bug: 163021585
Test: m
Change-Id: I26a6de4f7fb571c60038e803137a4b1c237792fd
2020-08-07 10:44:14 +09:00
Treehugger Robot
30e542983a Merge "cts: Skip CtsInitTestCases over a native bridge." 2020-08-06 17:31:56 +00:00
Kazuhiro Inaba
c293c58660 cts: Skip CtsInitTestCases over a native bridge.
The set of linked binaries was making it difficult to run
the test over a native bridge. Since init won't usually
run over a native bridge, the test can be skipped.

Bug: 161081809, 142324733, 162288553
Test: Arm build of CtsInitTestCases skips rammus-arc-r Chromebook.
Change-Id: Icdd8b03111d0f3fd6658ee6d9a97fca27181db45
(cherry picked from commit 9cecf8422a)
2020-08-07 01:11:29 +09:00
Christopher Ferris
ab60ca583a Add new caps from kernel 5.8.
Test: Builds and boots on a bonito.
Change-Id: I8dff4818bb98be3d731256be100a1c4aed4d414c
2020-08-04 22:57:44 -07:00
Steven Moreland
fe8dec0447 Merge "perfboot: significant figures + units for summary" 2020-08-04 18:10:32 +00:00
Steven Moreland
18b73dd0b6 perfboot: significant figures + units for summary
This is correct significant figures/units based on the precision of our
measurements, but it does not reflect our actual certainty re the output
data, since in reality, confidence is diminished by temperature, device,
hardware revision, time of day/month/year, spurious activity, data
connectivity, app install list, inherent randomness of multiprogramming,
sensor activity, user interaction, /data caches, build-by-build
differences, charging state, data fragmentation, race-driven sleeps,
cosmic radiation, factory defects, local magnetic or gravitational field
differences, changes in device momentum, or other known and unknown
causes.

Bug: N/A
Test: run perfboot.py, and output has:
    mean: 10801 ms
    median: 10801 ms
    standard deviation: 18 ms
Change-Id: I796396acc203b29e9a14e4d6dffa58db7b8cd9fb
2020-08-04 00:58:40 +00:00
Elliott Hughes
e79b8c2092 Cleanup for #inclusivefixit.
Test: treehugger
Change-Id: I651689e2d59c017a9bde44251d95b57e594f0b5b
2020-07-28 11:09:03 -07:00
Tom Cherry
2d451663be Cleanup for #inclusivefixit.
Test: build
Change-Id: If11a32c130367560394eccf442de95d941918073
2020-07-27 11:37:19 -07:00
David Anderson
67665a4571 Merge changes I49495684,I0db2e0f4,I07bb811b
* changes:
  init: Initiate other misc devices from BlockDevInitializer.
  Allow snapuserd to be included in the initial ramdisk.
  Add experimental daemon for handling dm-user requests.
2020-07-24 19:18:45 +00:00
Hung-ying Tyan
d1bd5f20eb Merge "init: set $PATH in second stage init" 2020-07-24 03:01:33 +00:00
Tom Cherry
d36f4a36ed init: set $PATH in second stage init
If the system partition has been updated and _PATH_DEFPATH has a new
value, then we must set $PATH in second stage init to take on the new
value, as well as having set it in first stage init.

Bug: 160210288
Test: build
Change-Id: I18765709dc9bff9379b0ae39272199cf74a79d2f
2020-07-23 09:13:37 -07:00
Tom Cherry
e122701142 Merge "Ueventd: Fix a corner case in ReadUevent() that triggers duplicate firmware loading." 2020-07-21 21:14:52 +00:00
P.Adarsh Reddy
a86bf05a01 Ueventd: Fix a corner case in ReadUevent() that triggers duplicate firmware loading.
Presently, within ReadUevent(), true is returned for a successful case
as well as for the case where we read an invalid uevent (overflowed
buffer)where the Uevent object is not cleared, and the caller calls the
callback (with the earlier stored uevent object),leading to duplicate
firmware loading.

Uevent uevent;
while (ReadUevent(&uevent)) {
  if (callback(uevent) == ListenerAction::kStop) return;
}

Scenario:
1. Proper Uevent received and callback is called (firmware loading
   is triggered).
2. Overflowed uevent is received as part of the same ReadUevent session,
   ReadUevent() returns true, but the uevent object is not cleared and
   still has earlier event values.
3. Callback is called again, leading to duplicate firmware load.

Handle it by adding explicit return codes to let the caller know if the
uevent read is invalid, and the caller can ignore it and read
further pending uevents.

Bug: 161580785

Change-Id: I09e80052337fd1495b968dc02ecff5ceb683da18
2020-07-21 03:09:28 +05:30
Tom Cherry
939b41c79b ueventd: bump UEVENT_MSG_LEN to 8192
The previous size, 2048, is only the size of the 'environment' for the
uevent message, but doesn't include the <action>@<dev path> portion.
The <action> portion has a max length < 10, but the <dev path> portion
is unbounded.

8192 should be plenty to capture all of these parameters.

Bug: 161580785
Test: ueventd still works
Change-Id: I6de6fd3a444ac91b3b4df154097abde3696e21b3
2020-07-20 13:18:01 -07:00
Yifan Hong
30b52007e5 Merge changes from topic "odm_dlkm" am: 3e31ec8392 am: 8c3a7ca939
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1363939

Change-Id: I8cdd4583c894d7fb5168fce1df789f2973a57357
2020-07-17 22:52:14 +00:00
Yifan Hong
9258f2e423 Load sysprops from odm_dlkm.
Load sysprops from /odm_dlkm/etc/build.prop. Note that no
property contexts are loaded from odm_dlkm.

Test: getprop | grep odm_dlkm
Bug: 156020364
Change-Id: I90c3a54a110462736d9888101d4281100d586632
2020-07-15 17:15:49 -07:00
Yifan Hong
a8e5779e18 Merge changes from topic "vendor_dlkm" am: 7ca7680ec5 am: 0c1a242060
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1350785

Change-Id: I7db376a03c329023a626c1130b7a55dc74ae9ae1
2020-07-14 19:47:16 +00:00
Yifan Hong
7ca7680ec5 Merge changes from topic "vendor_dlkm"
* changes:
  load sysprops from vendor_dlkm.
  fastboot: Add vendor_dlkm
  rootdir: add vendor_dlkm symlinks
2020-07-14 19:15:12 +00:00
Treehugger Robot
b64af0cc2a Merge "init README: document AIDL service interface" am: 4d3c284605 am: e526b545cd
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1360957

Change-Id: Ib8b619145c77c42afe771755e3e2199bfa5c68dc
2020-07-10 20:03:59 +00:00
Steven Moreland
fa2457e1cd init README: document AIDL service interface
There is documentation for how AIDL works with ctl commands or
interface_start commands, however it seems we were missing documentation
on declaration of interfaces.

Bug: N/A
Test: N/A
Change-Id: I0e5d2350b6b847a870eafbc69828e75f1f6ca4f0
2020-07-10 17:53:18 +00:00
Yifan Hong
2ed3cdaa06 load sysprops from vendor_dlkm.
Load sysprops from /vendor_dlkm/build.prop. Note that
no property contexts are loaded from vendor_dlkm.

Test: getprop | grep vendor_dlkm
Bug: 156020364
Change-Id: Ib0e8ba1791e1d2c11d055ef496208993e11d9b0f
2020-07-09 15:06:44 -07:00
Tom Cherry
f18e009f97 Merge "init: skip RejectsCriticalAndOneshotService for devices launched before R" am: c8e4154d89 am: 9c590e4c97
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1359383

Change-Id: I8d77c402b55b1e460dd49c4a37fd00baada98d5d
2020-07-09 20:06:57 +00:00
Tom Cherry
c8e4154d89 Merge "init: skip RejectsCriticalAndOneshotService for devices launched before R" 2020-07-09 19:35:34 +00:00
Tom Cherry
0e40ba3183 init: skip RejectsCriticalAndOneshotService for devices launched before R
This restriction is only added for devices launching with R or later.

Bug: 160663765
Test: this test runs when appropriate
Change-Id: I2353bfa7f598bd19ba57498cc5bbad7a3ed34707
2020-07-09 08:49:29 -07:00
David Anderson
67cd9f09ca init: Initiate other misc devices from BlockDevInitializer.
This allows init to easily ensure misc devices other than device-mapper
are present.

Bug: 154536437
Test: manual test
Change-Id: I49495684edee322f9787ce7ab7f79d0e8060171d
2020-07-08 15:46:28 -07:00
Wei Wang
b35f076d7f Merge "Boost init priority before main loop" am: 4203129353 am: 7531866047
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1355811

Change-Id: I8ee40c5247f52e5d09ed0e9a04db0777612dfc05
2020-07-08 05:29:34 +00:00
Wei Wang
4203129353 Merge "Boost init priority before main loop" 2020-07-08 04:53:04 +00:00
Treehugger Robot
086b322d10 Merge "Move build.prop to ./etc subdir for some partitions" am: 90fe62e76e am: e47bb665c0
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1351307

Change-Id: Ib09d8413c20d24652f6188c1c4124f7a4c7a8187
2020-07-08 00:37:06 +00:00
Treehugger Robot
90fe62e76e Merge "Move build.prop to ./etc subdir for some partitions" 2020-07-08 00:03:30 +00:00
Wei Wang
30bbf7d0ad Boost init priority before main loop
Now we have more things e.g. loading kernel modules, initialize
selinux. And before all these, system cannot make further progress. It
should be beneficial to boost this critical peroid in init.

Benchmark on a Pixel device shows this saves 100+ms on early boot

ToT release + This CL (P15538587)
D/BaseBootTest: init_stage_second_START_TIME_avg : 1563.4
D/BaseBootTest: ueventd_Coldboot_avg : 219.0
D/BaseBootTest: action_init_/system/etc/init/hw/init.rc:114_START_TIME_avg : 2103.7

ToT release (6654154)
D/BaseBootTest: init_stage_second_START_TIME_avg : 1639.0
D/BaseBootTest: ueventd_Coldboot_avg : 238.2
D/BaseBootTest: action_init_/system/etc/init/hw/init.rc:114_START_TIME_avg : 2226.0

Bug: 143857500
Bug: 147997403
Bug: 160271169
Bug: 160696502
Test: Boottime
Signed-off-by: Wei Wang <wvw@google.com>
Change-Id: I21c9e051f4ae3e953d991c031f151b2779702548
2020-07-07 15:50:58 -07:00
Jiyong Park
8178c5f0c9 Move build.prop to ./etc subdir for some partitions
build.prop files under system_ext, product, and odm partitions are moved
to the ./etc subdirectory. This is to be in-line with the established
practice of having all configuration files under ./etc subdir.
build.prop doesn't need to be an exception.

However, system/build.prop and vendor/build.prop were not moved because
there are a lot of apps and tools that depend on the path.

Bug: 158735147
Test: device has build.prop under ./etc and is bootable
Change-Id: I26300574c23c78cc4e5bc20f98fc9702838465e1
2020-07-08 02:18:16 +09:00
Tom Cherry
09100b7fbd Merge "Add AMBA bus support to platform devices" am: b88a97b41e am: 8edc5e449c
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1353606

Change-Id: I7e3e0835a7066ff46c888ce801e027b314c5d674
2020-07-07 15:48:49 +00:00