Commit graph

71749 commits

Author SHA1 Message Date
Treehugger Robot
4ed4ac6ea4 Merge "Add a small testcase for snapshot writer." am: f737614ce9
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1696066

Change-Id: I5e15b76ffe92f930bfbb373f72a2741c1c07138d
2021-05-04 20:02:12 +00:00
Treehugger Robot
f737614ce9 Merge "Add a small testcase for snapshot writer." 2021-05-04 19:37:19 +00:00
Kelvin Zhang
ab42259321 Add a small testcase for snapshot writer.
update_engine heavily relies on snapshot writer, add a testcase

Test: th
Change-Id: I4e3cf47dcff92ec4df0b3b84a0a8c7cb7866e7e7
2021-05-04 13:51:34 -04:00
Andrew Scull
ef2864edd5 Link libcrypto in host unit tests for libavb
libavb is moving to use boringssl for crypto operations in user space
rather than using its own implementation. Link with libcrypto to
resolved the new dependencies.

Test: atest --host --host-unit-test-only --test-mapping system/core/fs_mgr/libfs_avb
Bug: 185329132
Change-Id: I412f4ef677aa6e29c5b67ffe5e3e8377640a2847
2021-05-04 15:18:58 +00:00
Tri Vo
bbc9f3216e Merge "trusty: Helper library for metrics" am: e23e85bee5 am: 1eed4fbf64 am: e8f8a915d1
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1629434

Change-Id: Ic516d1bc54eaee18751400f40f8c7b00a0b68ac5
2021-05-04 15:04:21 +00:00
Tri Vo
e8f8a915d1 Merge "trusty: Helper library for metrics" am: e23e85bee5 am: 1eed4fbf64
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1629434

Change-Id: Ia54a4aa6dd5768f6e0ca44fb15eb72b22499a477
2021-05-04 14:47:41 +00:00
Tri Vo
1eed4fbf64 Merge "trusty: Helper library for metrics" am: e23e85bee5
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1629434

Change-Id: Ie2a265b9ad6b18902a395d12eb2bd9e4d2310b11
2021-05-04 14:31:27 +00:00
Tri Vo
e23e85bee5 Merge "trusty: Helper library for metrics" 2021-05-04 14:17:05 +00:00
Akilesh Kailash
27595361c0 Merge changes from topic "snapuserd-enable-read-ahead" am: 362b2b7537 am: aa5be17a2a am: 646db6c47c
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1690661

Change-Id: Ie3084fe832b1a93c7fd6321e92a359497df08a2c
2021-05-04 05:34:15 +00:00
Akilesh Kailash
646db6c47c Merge changes from topic "snapuserd-enable-read-ahead" am: 362b2b7537 am: aa5be17a2a
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1690661

Change-Id: I3d4a8307106710447a1eb91a2fecceab9a779216
2021-05-04 05:06:04 +00:00
Akilesh Kailash
aa5be17a2a Merge changes from topic "snapuserd-enable-read-ahead" am: 362b2b7537
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1690661

Change-Id: Iccce1cbfcd7e99e40a5be8ff8a4ecbc64ba24cb0
2021-05-04 04:47:11 +00:00
Eric Biggers
1c51525f66 init: make reboot_on_failure not apply to manually stopped services
Add a new service flag SVC_STOPPING which tracks whether a service is
being manually stopped by init, and make the "reboot_on_failure" service
setting not apply when SVC_STOPPING is set.

This is needed for devices that use FDE, because otherwise the device
reboots during the following init script fragment:

    on property:vold.decrypt=trigger_shutdown_framework
        class_reset late_start
        class_reset main
        class_reset_post_data core
        class_reset_post_data hal

... because that stops all services, including apexd which has been
marked with reboot_on_failure since
https://android-review.googlesource.com/c/platform/system/apex/+/1325212.
So init was killing apexd, then rebooting the device because apexd
"failed" due to having been killed.  Making reboot_on_failure not apply
when init stops a service itself fixes the problem.

This is one of a set of changes that is needed to get FDE working again
so that devices that launched with FDE can be upgraded to Android 12.

Bug: 186165644
Test: Tested FDE on Cuttlefish
Change-Id: I599f7ba107e6c126e8f31d0ae659f0ae672a25e4
2021-05-03 21:38:50 -07:00
Akilesh Kailash
362b2b7537 Merge changes from topic "snapuserd-enable-read-ahead"
* changes:
  libsnapshot: snapuserd: Enable read-ahead functionality
  libsnapshot: Bump up the kCowVersionManifest version
2021-05-04 04:28:29 +00:00
Akilesh Kailash
a1647cfe47 Merge changes from topic "snapuserd-read-ahead" am: eebf447fef am: fcc5b53c7e am: 6093592fbb
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1656316

Change-Id: If48d39cf0bc1ae6cf2cc91d1a24acea65f6faa68
2021-05-04 02:50:42 +00:00
Akilesh Kailash
b2e125cb1a libsnapshot: snapuserd: Enable read-ahead functionality
This enables read-ahead functionality by having
scratch space in the COW

Bug: 183863613
Test: OTA tests with new COW format

Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I7988687c81d0ea239e71695818199db4653ddb80
2021-05-04 02:41:35 +00:00
Akilesh Kailash
c67686ecb9 libsnapshot: Bump up the kCowVersionManifest version
kCowVersionManifest will be 2. This should now
be in sync with kCowVersionMajor.

Bug: 183863613
Test: OTA with new COW format (by enabling scratch space option)
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: Ia6c31e399de723ee83459b59d6b076b48f5c88d5
2021-05-04 02:41:23 +00:00
Akilesh Kailash
6093592fbb Merge changes from topic "snapuserd-read-ahead" am: eebf447fef am: fcc5b53c7e
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1656316

Change-Id: I8861386eb0289bd7d473cbad04cb2b2e3f527ace
2021-05-04 01:31:37 +00:00
Akilesh Kailash
fcc5b53c7e Merge changes from topic "snapuserd-read-ahead" am: eebf447fef
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1656316

Change-Id: I9d623ff7206acc32bec19974672a9f7204f32e16
2021-05-04 01:16:25 +00:00
Akilesh Kailash
eebf447fef Merge changes from topic "snapuserd-read-ahead"
* changes:
  libsnapshot:snapuserd:Add unit test for read-ahead code path.
  libsnapshot: Flush data to scratch space only for overlapping regions
  libsnapshot:snapuserd: read-ahead COW copy ops
  libsnapshot: Retrieve COW version from update engine manifest
  libsnapshot:snapuserd: Add 2MB scratch space in COW file
  libsnapshot:snapuserd: mmap + msync header after merge
2021-05-04 00:55:28 +00:00
Tri Vo
a8919a2e82 trusty: Helper library for metrics
Bug: 182489121
Test: libtrusty_metrics_test
Change-Id: I7fc45ea3319185a8ac55889e56bd484d4774e928
2021-05-03 17:15:30 -07:00
Christopher Ferris
fe751c5a61 Re-add backtrace note about unreadable elf.
When moving to the proto-ized tombstones, the note about unreadable
elf files in a backtrace got lost. This re-adds it and adds a test
to verify that the note properly shows up.

Bug: 185428454

Test: Ran unit tests.
Change-Id: I1150cc737772e1b79fd73ec5c782caadc4629421
2021-05-03 15:21:11 -07:00
Treehugger Robot
d41a75a5f0 Merge "Make mkbootfs self-contained" am: 4f8a56f15d am: 14f3b1b0d2 am: 434735eab7
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1690535

Change-Id: I6bbf10d4d326d069f8e311ade2b487e7c66bc201
2021-05-03 18:03:59 +00:00
Treehugger Robot
434735eab7 Merge "Make mkbootfs self-contained" am: 4f8a56f15d am: 14f3b1b0d2
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1690535

Change-Id: I8c679e880ecea0539d84bd2a0cd4dd09fcc8fbb8
2021-05-03 17:39:48 +00:00
Treehugger Robot
14f3b1b0d2 Merge "Make mkbootfs self-contained" am: 4f8a56f15d
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1690535

Change-Id: If2264860a48b2c5e240808eccace000a30689952
2021-05-03 17:18:57 +00:00
Treehugger Robot
4f8a56f15d Merge "Make mkbootfs self-contained" 2021-05-03 16:58:55 +00:00
Yi-Yo Chiang
288f9eec0f Make mkbootfs self-contained
Now that mkbootfs is in prebuilt build tools, make it have no dynamic
dependency so that the binary is portable.

Bug: 184490452
Test: Presubmit
Change-Id: Ida4ee9af3c51ba9d163cf9c1e7b7098fd24e0de1
2021-05-02 19:36:23 +08:00
Treehugger Robot
8f4082617e Merge "filesystem_config: Add a aid/uid for UWB subsystem" am: 2de90ca526 am: a6528dee6e am: 000f1c0fd3
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1690654

Change-Id: Ia2c811c60616eb1033fc44e5e1a431b04b86998c
2021-04-30 20:10:17 +00:00
Treehugger Robot
000f1c0fd3 Merge "filesystem_config: Add a aid/uid for UWB subsystem" am: 2de90ca526 am: a6528dee6e
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1690654

Change-Id: I14327ad6b7d91e3e899f5bd7470539eed5247b11
2021-04-30 19:40:15 +00:00
Treehugger Robot
a6528dee6e Merge "filesystem_config: Add a aid/uid for UWB subsystem" am: 2de90ca526
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1690654

Change-Id: I250b410112c97ad4f2e1023b85a6a5c8f6a5c0c5
2021-04-30 19:22:48 +00:00
Akilesh Kailash
b913e9d261 Merge "libsnapshot: Add Version field which will be used by update-engine manifest" am: 0ec13ceda9 am: a728724a34 am: 0bfd808995
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1676194

Change-Id: Iddee4f742bc6dfb8c7e07b0d5697360f5404d4fa
2021-04-30 19:08:03 +00:00
Treehugger Robot
2de90ca526 Merge "filesystem_config: Add a aid/uid for UWB subsystem" 2021-04-30 19:04:57 +00:00
Akilesh Kailash
0bfd808995 Merge "libsnapshot: Add Version field which will be used by update-engine manifest" am: 0ec13ceda9 am: a728724a34
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1676194

Change-Id: I7411a1b89bb3efe4c069f6e5b039c449252f0644
2021-04-30 18:50:57 +00:00
Akilesh Kailash
a728724a34 Merge "libsnapshot: Add Version field which will be used by update-engine manifest" am: 0ec13ceda9
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1676194

Change-Id: Iec662bd6a12d8be199fe15ffb0511309110e0945
2021-04-30 18:26:15 +00:00
Akilesh Kailash
0ec13ceda9 Merge "libsnapshot: Add Version field which will be used by update-engine manifest" 2021-04-30 18:08:54 +00:00
Akilesh Kailash
936e9ce79d libsnapshot:snapuserd:Add unit test for read-ahead code path.
Add overlapping copy ops to test the read-ahead logic.

Bug: 183863613
Test: cow_snapuserd_test
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: Ie96bc644c5f2eaae45cf048d9ba8a206930c3ce8
2021-04-30 06:49:03 +00:00
Akilesh Kailash
150bcbf7c6 libsnapshot: Flush data to scratch space only for overlapping regions
When read-ahead thread caches the data from base device, flush the data
only if there are overlapping regions. If there is crash, subsequent
reboot will not recover the data from scratch space. Rather, data
will be re-constructed from base device.

Additionally, allow batch merge of blocks by the kernel even for
overlapping region given that we have the read-ahead thread
taking care of the overlapping blocks.

Bug: 183863613
Test: 1: Incremental OTA from build 7284758 to 7288239. Merge time
         reduces from ~6 minutes to ~2.5 minutes
      2: Reboot and crash kernel multiple times when merge was in
         progress
      3: Verify read-ahead thread re-constructs the data for overlapping
         region.
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I50e0d828f4fb36a23f0ca13b07a73229ba68874d
2021-04-30 06:46:47 +00:00
Akilesh Kailash
580312bc95 libsnapshot:snapuserd: read-ahead COW copy ops
Introduce read-ahead mechanism for COW copy ops.

1: Read-ahead thread will read from base device
   and store the data in scratch space along with the metadata.
2: Worker threads during merge will retrieve the data
   from read-ahead cache
3: Fixed set of blocks are read during each cycle by the read-ahead
   thread.
4: When the last block in the region is merged, read-ahead thread
   makes forward progress.

Scratch space is set to 2MB and is only used from COW copy operations.
We can extend this to Replace Ops based on performance evaluation.

Performance:

As mentioned in bug 181883791, Incremental OTA of size 55M with
235K copy operations where every block is moved by 4k:

Without read-ahead: 40 Minutes for merge completion
With read-ahead:  21 Minutes for merge completion

Bug: 183863613

Test: 1: Full OTA - no regression observed.
2: Incremental OTA - with older COW format. Daemon will just skip
   the read-ahead feature for older COW format.
3: Incremental OTA - with new COW format.
4: Reboot and crash kernel when multiple times when incremental OTA is in-flight.
   Verify post reboot, read-ahead thread re-constructs the data from scratch
   space.
5: No regression observed in RSS-Anon memory usage when merge in-flight.

Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: Ic565bfbee3e9fcfc94af694596dbf44c0877639f
2021-04-30 06:46:33 +00:00
Akilesh Kailash
d967d01f56 libsnapshot: Retrieve COW version from update engine manifest
update_metadata.proto will have the COW version. Retrieve
that from the manifest and compare it with the COW library.
If the versioning doesn't match, disable VABC.

The primary use case of this is during downgrade tests
in pre-submit. Whenever we have a COW format changes,
we may have to disable VABC for that specific transition
build. At a high level, the flow of version check will be:

1: Create a initial COW version of 1 in manifest (update_metadata.proto)
2: The latest COW version of libsnapshot is 2
3: libsnapshot will return VABC disabled
4: Check-in the CL and changes to manifest
5: Once the CL is baked in and the build is green, bump up the COW version to 2 in the manifest
6: Next set of tests, since both versions match, libsnapshot will enable VABC
7: Downgrade should be done to the build which was checked in at (5)

Bug: 183863613
Test: Apply OTA and verify if VABC is disabled if the versions don't
match
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: Id55f33a90bb31b417e72f4fbe370daf05a68f05a
2021-04-30 06:46:24 +00:00
Akilesh Kailash
771b17f509 libsnapshot:snapuserd: Add 2MB scratch space in COW file
Add 2MB scratch space in the COW file. This is a preparation
patch for read-ahead patch. This just add the buffer
space right after the header. Bump up the version number
in the header in order to distiguish between older and newer
COW formats.

No operation is done on this buffer with this patch-set.

Scratch space option is disabled by default.

Bug: 183863613
Test: 1: Create Full OTA with the new COW format.
2: Incremental OTA with older COW format.
3: vts_libsnapshot_test

Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I42a535a48ec22adb893dfe6f86a4f51650e1f88a
2021-04-30 06:45:57 +00:00
Akilesh Kailash
31e0426489 libsnapshot:snapuserd: mmap + msync header after merge
mmap the CowHeader and use msync to flush only the
first 4k page after merge is complete.

This cuts down ~30 seconds of merge completion time
on a 55M incremental OTA with 235k copy operations.

Although, this isn't a significant gain but this patch
creates a scaffolding for the next set of read-ahead patches.

Bug: 183863613
Test: Incremental and Full OTA
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I15bfec91ea1d5bdf4390670bcf406e1015b79299
2021-04-30 06:31:12 +00:00
Akilesh Kailash
acc1c5d189 libsnapshot: Add Version field which will be used by update-engine
manifest

Bug: 183863613
Test: Build
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: If4b6a60669a55eb2ea1167fb2cc49ce04c054748
2021-04-30 06:31:01 +00:00
Daniel Rosenberg
4a0ecf9c1f Merge "libsnapshot: Allow inspect_cow to show failed blocks" am: 82129fd4ce am: 2377825899 am: 1a24b1fcde
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1673894

Change-Id: If01dc84ebe5bab56b8e436832bd6a13e1b93a559
2021-04-30 06:21:51 +00:00
Daniel Rosenberg
1a24b1fcde Merge "libsnapshot: Allow inspect_cow to show failed blocks" am: 82129fd4ce am: 2377825899
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1673894

Change-Id: I0950b60a2206f192d2816e47129987b27c16b52c
2021-04-30 06:05:16 +00:00
Daniel Rosenberg
2377825899 Merge "libsnapshot: Allow inspect_cow to show failed blocks" am: 82129fd4ce
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1673894

Change-Id: I13fb8346d1526f274a840a94ccd7af773430577c
2021-04-30 05:47:26 +00:00
Daniel Rosenberg
82129fd4ce Merge "libsnapshot: Allow inspect_cow to show failed blocks" 2021-04-30 05:31:51 +00:00
Inseob Kim
43f3a6b92c Merge "Fix precompiled sepolicy logic" am: 4664bbc6c7 am: ff9de56e37 am: 257a50e59d
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1690527

Change-Id: I359d9a1ea580a79d10f06825ee0a9c554f996c7b
2021-04-30 03:06:34 +00:00
Inseob Kim
257a50e59d Merge "Fix precompiled sepolicy logic" am: 4664bbc6c7 am: ff9de56e37
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1690527

Change-Id: Ie8c7fe471d068414c1951fc1dc0ce90c0aa1db1e
2021-04-30 02:38:53 +00:00
Inseob Kim
ff9de56e37 Merge "Fix precompiled sepolicy logic" am: 4664bbc6c7
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1690527

Change-Id: I095b5009b7a0ff346c5f28b2e9ad2e37efcae178
2021-04-30 01:50:04 +00:00
Inseob Kim
4664bbc6c7 Merge "Fix precompiled sepolicy logic" 2021-04-30 01:14:15 +00:00
Daniel Rosenberg
05a73c5788 libsnapshot: Allow inspect_cow to show failed blocks
Adds the -b option to show the bad data block that failed to decompress.
If the block is large enough, display the front as though it were a
CowOperation, as this is the most likely culprit.

Change-Id: I287f13e0794a1ca9d647d4b1099ab238a6202b23
Bug: 183985866
Test: inspect_cow -db <COW_FILE>
2021-04-29 21:58:58 +00:00