Commit Graph

2582 Commits

Author SHA1 Message Date
Akilesh Kailash 3e807e9651 libsnapshot:snapuserd: Cut down memory usage
Use sorted std:vector instead of std:map to store
the mapping between chunk-id to COW operation.

Addtionally, use shrink_to_fit to cut down vector
capacity when COW operations are stored.

On a full OTA of 1.8G, Anon RSS usage is
reduced from 120MB to 68MB.  No variance observed
when merge was in progress.

Bug: 182960300
Test: Full and Incremental OTA - verified memory usage
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I50cacbe0d03837a830dedcf9bd0ac9663fc68fa7
2021-03-19 06:32:52 +00:00
Yifan Hong 4bf547af43 Merge changes from topic "fastboot_fetch"
* changes:
  fuzzy_fastboot: Add tests for fetch:vendor_boot
  fuzzy_fastboot: Add conformance test for getvar:max-fetch-size.
  fastboot driver: repack vendor boot ramdisk
  fastboot driver: Allow colon in partition name when flashing
  fastboot driver: add fetch command in driver
  fastboot driver: RunAndReadBuffer don't allocate too much mem
  fastboot driver: add RunAndReadBuffer helper
  fastboot driver: Fix ownership of fd in fastboot_buffer.
  fastboot driver: fix message
  fastbootd: add O_CLOEXEC/O_BINARY for OpenPartition
  fastbootd: add read arg to OpenPartition
  fastbootd: Add fetch command on device
  fastbootd: Add getvar max-fetch-size.
2021-03-18 23:33:56 +00:00
Yifan Hong 17d469bd57 fastboot driver: RunAndReadBuffer don't allocate too much mem
Instead of allocating the buffer for the whole
upload (which can be arbitrary number of bytes as
the device determines), read 1 MiB at a time.

Test: pass
Bug: 173654501
Change-Id: Ib601b0341b10b7dccbb429cd21aad86a2d3bfda8
2021-03-17 15:38:06 -07:00
David Anderson 102f7e4d7e Merge "libsnapshot: Add boot_complete metrics." 2021-03-16 00:30:46 +00:00
David Anderson a0992300f2 libsnapshot: Add boot_complete metrics.
Bug: 180535575
Test: apply OTA
Change-Id: Ifea51c4c83ba03012f557927e8694e7c613335a7
2021-03-12 18:35:44 -08:00
David Anderson bf3020b749 libsnapshot: Fix CowWriter::Finalize() not restoring footer correctly.
Bug: 173432386
Test: cow_api_test
Change-Id: If1b856fcdcd6b6ded5e00342037308c6b35d6fc0
2021-03-11 16:16:36 -08:00
Akilesh Kailash bd83b72bc8 Merge "libsnapshot:snapuserd: Multithreading support" 2021-03-11 00:51:20 +00:00
Akilesh Kailash 8f0840940e libsnapshot:snapuserd: Multithreading support
Add worker threads per partition to serve the IO request.

Remove memset of buffer in IO path which was impacting
4k IO performance.

update_verifier performance:

1: ~10-12 seconds with this change (both on full OTA and incremental
OTA); ~70 seconds observed without this changeset

2: ~8 seconds without the daemon once merge is completed
and snapshot devices are removed.

Bug: 181293939
Test: update_verifier, full OTA, incremental OTA
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: Id90887f3f4a664ee5d39433715d1c166acbd6c60
2021-03-10 07:53:16 +00:00
Devin Moore 0a799bdfd6 Handle "hardware" bootconfig parameter as "androidboot.hardware"
The parameter "androidboot.hardware" has been removed from bootconfig
and replaced by "hardware" parameter.

Test: launch_cvd with 4.19 and 5.10 kernels
Test: atest CtsFsMgrTestCases
Bug: 173815685
Change-Id: I627426ae1bd0a165b70b8f2584ec184abfb4236f
2021-03-09 14:10:48 -08:00
David Anderson 9865e47e1e Merge "libsnapshot: Collect more COW size data in snapshot merge stats." 2021-03-09 18:48:58 +00:00
David Anderson bc3dec4e8c Merge "liblp: Remove uses of alignment_offset." 2021-03-08 22:24:47 +00:00
Devin Moore 20b74257a6 fs_mgr: handle more bootconfig parameters
As parameters are moved from kernel cmdline to bootconfig,
fs_mgr needs to be updated to handle the new location.
/proc/bootconfig should be checked first, if not present, then check
/proc/cmdline.

Test: atest CtsFsMgrTestCases
Test: launch_cvd
Test: launch_cvd with 4.19 kernel artifacts that do not support
bootconfig
Test: Both of the above configurations with --num_instances 0 or 4
Test: Both configurations with androidboot.boot_devices or
androidboot.boot_device set
Bug: 173815685

Change-Id: I23fb07a17c25c9459833cb931ced79d5ccc3e42a
2021-03-05 09:21:19 -08:00
David Anderson cdf3b39840 libsnapshot: Collect more COW size data in snapshot merge stats.
Bug: 180535575
Test: manual test
Change-Id: Iea433aa5fd9390e462d5bf9841524ed345427af3
2021-03-03 21:46:24 -08:00
David Anderson cbc204b39b libsnapshot: Use the compression algorithm specified in the DeltaArchiveManifest.
update_engine and libsnapshot must agree on CowOptions parameters,
otherwise the COW size estimation may be incorrect.

Bug: N/A
Test: vts_libsnapshot_test
      apply OTA, snapshotctl dump
Change-Id: I219ae458dfa19e4b3c96360d3b847edb2a01ebc8
2021-03-03 18:27:54 -08:00
George Burgess IV c08abac855 Merge "snapuserd: fix a use of an uninitialized value" 2021-03-03 22:43:36 +00:00
David Anderson 5aa0527499 liblp: Remove uses of alignment_offset.
alignment_offset restrictions were removed in R and are no longer
needed.

Bug: 180571070
Test: liblp_test
Change-Id: I43fa4a929c20cc8c6ec2fece71d5400351c13dbe
2021-03-02 18:35:05 -08:00
Treehugger Robot 9539282751 Merge changes Ifcb52754,I29f79097
* changes:
  COW file size: better explain the exception size
  libsnapshot: COW size is computed within the container capability
2021-03-02 22:35:48 +00:00
David Anderson 04502383f6 Merge changes Idcb30151,I0f746870
* changes:
  libsnapshot: Harden merge-in-recovery for factory data resets.
  libsnapshot: Quell error spam during factory data resets.
2021-03-02 17:51:57 +00:00
Jiyong Park 7e7b7a156a Search fstab also from /first_stage_ramdisk
I828ce999be6d786bf46dd5655dfda81d046906ab made a slight behaviral change
that fstab is searched and read before /first_stage_ramdisk is mounted
as root. Without this change, the attempt to read fstab from / fails at
the moment, leaving an empty fstab object. But as a side effect of the
attempt, DoCreateDevices() is not called again even after
/first_stage_ramdisk is mounted as root and the fstab is found under /.

This change fixes the problem by adding /first_stage_ramdisk to the list
of places to find the fstab file.

Bug: N/A
Test: Watch TH
Change-Id: I9826610cce436ba706aaea14c9a991822d2bae96
2021-03-02 12:42:09 +09:00
David Anderson 2a55e81166 libsnapshot: Harden merge-in-recovery for factory data resets.
This addresses bugs where unexpected edge cases in the snapshot state
could prevent a merge or data wipe from completing in recovery.

Invalid snapshots (eg on the wrong slot) are now ignored in
CheckMergeState(). This prevents those snapshots from being detected as
"cancelled" and thus falling into RemoveAllUpdateState.

ProcessUpdateState will no longer call RemoveAllUpdateState in recovery.
Furthermore, when RemoveAllUpdateState fails, we will no longer return
the "old" state. If this state is Merging, ProcessUpdateState can
infinite loop.

Finally, HandleImminentDataWipe now guarantees the final state will be
either MergeFailed or None. For testing purposes, the old mechanism was
too susceptible to state machinery changes. And for practical purposes,
either we're going to wipe data (which removes the OTA), or a merge
failed and we can't. So the effective outcome is always no update or a
failed update.

Bug: 179006671
Test: vts_libsnapshot_test
Change-Id: Idcb30151e4d35cbeccf14369f09707ae94a57c66
2021-02-26 17:28:06 -08:00
David Anderson 4e936b4b6e libsnapshot: Quell error spam during factory data resets.
QuerySnapshotStatus assumes IsSnapshotDevice() would return true.

Additionally, recovery does not have access to /dev/loop-control, which
cannot be used by libfiemap anyway. Access it on-demand instead of
preemptively.

Bug: N/A
Test: manual test
Change-Id: I0f746870d7a8ec6d666f0bdd2fef3464b214928b
2021-02-26 17:27:42 -08:00
Christopher Di Bella 68c70b5884 follows the advice of -Wsign-compare
Bug: 181177782
Test: None
Change-Id: I6c53a243639d6b086dc676995d83286d034d1083
2021-02-25 02:20:17 +00:00
Devin Moore a4ef15bebb Support bootconfig in first stage init and fs_mgr
Androidboot parameters are being moved from the kernel commandline to
bootconfig.
fs_mgr looks for these parameters in properties and falls back to
reading directly from /proc/cmdline. So both of these sources are
updated for bootconfig.
The androidboot parameters from /proc/bootconfig
are added as ro.boot properties, and fs_mgr will fall back to searching
/proc/bootconfig if it is too early.

Test: boot cuttlefish with androidboot.fstab_suffix and
androidboot.hardware in bootconfig and not in cmdline.
Test: atest CtsFsMgrTestCases
Bug: 173815685

Change-Id: Iea36a0da94c26e1aa37d97c576725e0ad77cd3ad
2021-02-23 07:42:06 -08:00
Jaegeuk Kim 5ad7b3cbc5 Try to remount mounted points only
If we don't mount a certain partition intentionally, should be okay to bypass
remounting the partition.

Bug: 180435772
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: I7e4d420693f8ba35ec7881d39d0ca682688743c5
2021-02-22 20:46:41 +00:00
George Burgess IV a263a88381 snapuserd: fix a use of an uninitialized value
`header` is only initialized in the `if` block of this condition. Hence,
its use in the `else` portion isn't correct. Refactor the code a bit to
make this kind of bug a bit harder to write in the future.

Caught by the static analyzer:
> system/core/fs_mgr/libsnapshot/snapuserd.cpp:457:9: warning: 1st
function call argument is an uninitialized value
[clang-analyzer-core.CallAndMessage]

Bug: None
Test: TreeHugger

Change-Id: Ie56578520acf3cc972efa3336e40698feed20200
2021-02-19 13:04:07 -08:00
Bob Badour d69ad69a93 [LSC] Add LOCAL_LICENSE_KINDS to system/core
Added SPDX-license-identifier-Apache-2.0 to:
  bootstat/Android.bp
  cli-test/Android.bp
  code_coverage/Android.bp
  cpio/Android.bp
  debuggerd/crasher/Android.bp
  debuggerd/proto/Android.bp
  diagnose_usb/Android.bp
  fs_mgr/libdm/Android.bp
  fs_mgr/libfiemap/Android.bp
  fs_mgr/liblp/Android.bp
  fs_mgr/libsnapshot/Android.bp
  fs_mgr/libstorage_literals/Android.bp
  fs_mgr/libvbmeta/Android.bp
  fs_mgr/tests/Android.bp
  fs_mgr/tools/Android.bp
  gatekeeperd/Android.bp
  healthd/Android.bp
  healthd/testdata/Android.bp
  init/Android.bp
  init/Android.mk
  init/sysprop/Android.bp
  init/test_kill_services/Android.bp
  init/test_service/Android.bp
  libappfuse/Android.bp
  libasyncio/Android.bp
  libbinderwrapper/Android.bp
  libcrypto_utils/Android.bp
  libcrypto_utils/tests/Android.bp
  libdiskconfig/Android.bp
  libgrallocusage/Android.bp
  libkeyutils/mini_keyctl/Android.bp
  libmodprobe/Android.bp
  libnetutils/Android.bp
  libpackagelistparser/Android.bp
  libprocessgroup/Android.bp
  libprocessgroup/cgrouprc/Android.bp
  libprocessgroup/cgrouprc_format/Android.bp
  libprocessgroup/profiles/Android.bp
  libprocessgroup/setup/Android.bp
  libqtaguid/Android.bp
  libsparse/Android.bp
  libstats/push_compat/Android.bp
  libsuspend/Android.bp
  libsync/Android.bp
  libsystem/Android.bp
  libsysutils/Android.bp
  libusbhost/Android.bp
  libutils/Android.bp
  libvndksupport/Android.bp
  libvndksupport/tests/Android.bp
  llkd/Android.bp
  llkd/tests/Android.bp
  property_service/libpropertyinfoparser/Android.bp
  property_service/libpropertyinfoserializer/Android.bp
  property_service/property_info_checker/Android.bp
  qemu_pipe/Android.bp
  reboot/Android.bp
  rootdir/Android.bp
  rootdir/Android.mk
  rootdir/avb/Android.bp
  rootdir/avb/Android.mk
  run-as/Android.bp
  sdcard/Android.bp
  set-verity-state/Android.bp
  shell_and_utilities/Android.bp
  storaged/Android.bp
  toolbox/Android.bp
  trusty/apploader/Android.bp
  trusty/confirmationui/Android.bp
  trusty/confirmationui/fuzz/Android.bp
  trusty/coverage/Android.bp
  trusty/fuzz/Android.bp
  trusty/fuzz/test/Android.bp
  trusty/gatekeeper/Android.bp
  trusty/gatekeeper/fuzz/Android.bp
  trusty/keymaster/Android.bp
  trusty/keymaster/fuzz/Android.bp
  trusty/libtrusty/Android.bp
  trusty/libtrusty/tipc-test/Android.bp
  trusty/secure_dpu/Android.bp
  trusty/storage/interface/Android.bp
  trusty/storage/lib/Android.bp
  trusty/storage/proxy/Android.bp
  trusty/storage/tests/Android.bp
  trusty/utils/spiproxyd/Android.bp
  trusty/utils/trusty-ut-ctrl/Android.bp
  usbd/Android.bp
  watchdogd/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to:
  debuggerd/Android.bp
  fastboot/Android.bp
  libkeyutils/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
    SPDX-license-identifier-MIT
to:
  libcutils/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-MIT
to:
  fs_mgr/Android.bp
  fs_mgr/libfs_avb/Android.bp
  trusty/Android.bp
  trusty/utils/rpmb_dev/Android.bp

Added SPDX-license-identifier-BSD
to:
  fastboot/fuzzy_fastboot/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: Id740a7d2884556081fdb68876584b25eb95e1bef
2021-02-19 12:59:05 -08:00
Yi-Yo Chiang 67e3bbc7f6 Explicitly cast to 64bit integer when calculating filesystem size
Else the result may overflow on platforms that have 32bit long.

Bug: 165925766
Test: Presubmit
Change-Id: I3018f0bd9846651848bd9b3645f2eeaa5b61c646
2021-02-18 08:24:51 +00:00
Yi-Yo Chiang d1ff1bcfbc fs_mgr: Add OverlayMountPoints() to get the list of overlayfs backing storage
Remove kOverlayMountPoints; add OverlayMountPoints().

Fix a regression where if host system didn't install a scratch_gsi
partition and physical /cache partition is mounted, then DSU guest
system could use /cache as its overlayfs backing storage. This is
generally unwanted as the /cache partition could be shared between host
and guest.
Dynamically return the list of overlayfs backing storage candidates, so
we don't accidentally fall back to use /cache storage within a DSU
system.

Bug: 165925766
Bug: 179980369
Test: 1. Prepare a DUT that have a physical cache partition, such as
  cuttlefish.
  2. Install a DSU system, and unsure that scratch_gsi is not installed.
  3. Reboot into DSU, verify that adb remount fails and overlayfs
     scratch is not created under /cache.
Change-Id: I1815ac5367c0aac8614aeaabebe0e2cb91cbe161
2021-02-18 04:36:52 +00:00
Alessio Balsini 2f9a4ff57d COW file size: better explain the exception size
The exception size was hardcoded and its explanation hidden in one of
the comments.
Move it to a separate constant e better explain why that is 64 * 2 / 8.

Bug: 176972301
Test: m
Signed-off-by: Alessio Balsini <balsini@google.com>
Change-Id: Ifcb527540882222916ada07dacf3f76f87609539
2021-02-17 09:47:13 +00:00
Jaegeuk Kim 286e5aba63 Merge "fiemap: support FIEMAP_EXTENT_MERGED" 2021-02-17 01:42:23 +00:00
Treehugger Robot ca474f994d Merge "Revert "[LSC] Add LOCAL_LICENSE_KINDS to system/core"" 2021-02-16 23:25:31 +00:00
Akilesh Kailash 51858a0494 Merge "libsnapshot: Print merge completion ops" 2021-02-16 22:03:30 +00:00
Jaegeuk Kim 0724e48f9f fiemap: support FIEMAP_EXTENT_MERGED
F2FS starts to give a hint, FIEMAP_EXTENT_MERGED, in fiemap, so please allow it.

Bug: 180137825
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: Ic4e3f573e385d248627da1a2ad64fbbd4a74e679
2021-02-16 13:22:13 -08:00
Elliott Hughes c3a206ccda Revert "[LSC] Add LOCAL_LICENSE_KINDS to system/core"
This reverts commit 187b7d1950.

Reason for revert: system/core is multiple projects, not one.

Change-Id: I790ea41741f8cd9b8b6db2f59a49e71fb0958fd6
2021-02-16 20:01:20 +00:00
Akilesh Kailash 1ce6a7e40c libsnapshot: Print merge completion ops
Once the daemon is terminated, print merge completion
ops and the total ops present in the COW file. This
will help to know if the merge operation was interrupted
and how many pending operations were done during
each reboot until merge is completed

Bug: 167409187
Test: Incremental and full OTA
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: Ie33c840e80aaeca86f51adc8085cb4e306dca110
2021-02-16 19:19:40 +00:00
Bob Badour 187b7d1950 [LSC] Add LOCAL_LICENSE_KINDS to system/core
Added SPDX-license-identifier-Apache-2.0 to:
  bootstat/Android.bp
  cli-test/Android.bp
  code_coverage/Android.bp
  cpio/Android.bp
  debuggerd/crasher/Android.bp
  debuggerd/proto/Android.bp
  diagnose_usb/Android.bp
  fs_mgr/libdm/Android.bp
  fs_mgr/libfiemap/Android.bp
  fs_mgr/liblp/Android.bp
  fs_mgr/libsnapshot/Android.bp
  fs_mgr/libstorage_literals/Android.bp
  fs_mgr/libvbmeta/Android.bp
  fs_mgr/tests/Android.bp
  fs_mgr/tools/Android.bp
  gatekeeperd/Android.bp
  healthd/Android.bp
  healthd/testdata/Android.bp
  init/Android.bp
  init/Android.mk
  init/sysprop/Android.bp
  init/test_kill_services/Android.bp
  init/test_service/Android.bp
  libappfuse/Android.bp
  libasyncio/Android.bp
  libbinderwrapper/Android.bp
  libcrypto_utils/Android.bp
  libcrypto_utils/tests/Android.bp
  libdiskconfig/Android.bp
  libgrallocusage/Android.bp
  libkeyutils/mini_keyctl/Android.bp
  libmodprobe/Android.bp
  libnetutils/Android.bp
  libpackagelistparser/Android.bp
  libprocessgroup/Android.bp
  libprocessgroup/cgrouprc/Android.bp
  libprocessgroup/cgrouprc_format/Android.bp
  libprocessgroup/profiles/Android.bp
  libprocessgroup/setup/Android.bp
  libqtaguid/Android.bp
  libsparse/Android.bp
  libstats/push_compat/Android.bp
  libsuspend/Android.bp
  libsync/Android.bp
  libsystem/Android.bp
  libsysutils/Android.bp
  libusbhost/Android.bp
  libutils/Android.bp
  libvndksupport/Android.bp
  libvndksupport/tests/Android.bp
  llkd/Android.bp
  llkd/tests/Android.bp
  property_service/libpropertyinfoparser/Android.bp
  property_service/libpropertyinfoserializer/Android.bp
  property_service/property_info_checker/Android.bp
  qemu_pipe/Android.bp
  reboot/Android.bp
  rootdir/Android.bp
  rootdir/Android.mk
  rootdir/avb/Android.bp
  rootdir/avb/Android.mk
  run-as/Android.bp
  sdcard/Android.bp
  set-verity-state/Android.bp
  shell_and_utilities/Android.bp
  storaged/Android.bp
  toolbox/Android.bp
  trusty/apploader/Android.bp
  trusty/confirmationui/Android.bp
  trusty/confirmationui/fuzz/Android.bp
  trusty/coverage/Android.bp
  trusty/fuzz/Android.bp
  trusty/fuzz/test/Android.bp
  trusty/gatekeeper/Android.bp
  trusty/gatekeeper/fuzz/Android.bp
  trusty/keymaster/Android.bp
  trusty/keymaster/fuzz/Android.bp
  trusty/libtrusty/Android.bp
  trusty/libtrusty/tipc-test/Android.bp
  trusty/secure_dpu/Android.bp
  trusty/storage/interface/Android.bp
  trusty/storage/lib/Android.bp
  trusty/storage/proxy/Android.bp
  trusty/storage/tests/Android.bp
  trusty/utils/spiproxyd/Android.bp
  trusty/utils/trusty-ut-ctrl/Android.bp
  usbd/Android.bp
  watchdogd/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to:
  debuggerd/Android.bp
  fastboot/Android.bp
  libkeyutils/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
    SPDX-license-identifier-MIT
to:
  Android.bp
  libcutils/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-MIT
to:
  fs_mgr/Android.bp
  fs_mgr/libfs_avb/Android.bp
  trusty/utils/rpmb_dev/Android.bp

Added SPDX-license-identifier-BSD
to:
  fastboot/fuzzy_fastboot/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: I5bd81adb5cdcf2b4dd4141b204eb430ff526af8f
2021-02-16 04:10:03 -08:00
Alessio Balsini aab166132a libsnapshot: COW size is computed within the container capability
Enforce the checking of what chunk/sector/byte is written to the COW
size calculator to avoid possible overflows in the container.
If an undesired behavior occurs, the COW computation is aborted and,
the class user will be notified with an empty returned value.

Bug: 176972301
Test: vts_libsnapshot_test
Change-Id: I29f7909780853434a09032c27c943f505c6d0d19
2021-02-16 11:08:21 +00:00
Akilesh Kailash 7cd1c03178 Merge "libsnapshot:snapuserd: Batch merge copy operation" 2021-02-10 05:08:48 +00:00
Akilesh Kailash b5f0a3b73b Merge "libsnapshot: No transition of snapuserd during second stage init" 2021-02-10 00:35:23 +00:00
Akilesh Kailash 66914e2b2e libsnapshot:snapuserd: Batch merge copy operation
Allow batch merge of copy operations during merge.
When metadata is read from COW device, assign
the chunk-id by validating there is no overlap
of copy operations. Furthermore, detect the blocks
which are contiguous and batch merge them.

No regression in merge time for full OTA (~35-40 seconds)

Merge time for incremental OTA of ~200M takes about 2 minutes
as compared to 15-20+ minutes without this change.

Add unit test to test ReadMetadata() functionality.

Multiple incremental OTA and full OTA test done on pixel.
adb reboot during merge and validate the merge resume operations.

Bug: 179629624
Test: incremental OTA and full OTA on pixel,
      cow_snapuserd_test
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I4cd84e4923e42afacc796b8cec01738b1bb1f420
2021-02-09 23:53:49 +00:00
Akilesh Kailash 03e803455e libsnapshot: No transition of snapuserd during second stage init
When there is a transition of daemon from selinux stage, we observe
intermittent hangs during OTA. This is a workaround wherein
we don't do the transition and allow the daemon to continue which
was spawned during selinux stage.

Bug: 179331261
Test: Incremental OTA, full OTA on pixel
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I622a0ed8afcd404bac4919b1de00728de2c12eaf
2021-02-09 22:45:29 +00:00
Treehugger Robot dc0ea9d65e Merge "adb-remount-test.sh: Fix failure due to missing host tool `hexdump`" 2021-02-09 21:52:19 +00:00
Yi-Yo Chiang fa405414d7 adb-remount-test.sh: Fix failure due to missing host tool `hexdump`
As we are just using it to generate gibberish, we might as well just
hardcode the gibberish in the script.

Also fix unhandled `grep` failure.

Bug: 179752308
Test: Forrest
Change-Id: I534c7cacdb12a104f26d380fe3a571332091490e
2021-02-09 16:11:23 +08:00
Treehugger Robot c9924a763d Merge "libfs_avb: verifying vbmeta digest early" 2021-02-09 01:20:20 +00:00
Yifan Hong 2277c27fcc Merge "Add compression to dump" 2021-02-08 22:47:05 +00:00
Treehugger Robot a24aef614a Merge "libsnapshot: Disable the update space swap test on non-VABC." 2021-02-08 21:31:13 +00:00
Treehugger Robot 20bf5a8aff Merge "Add support for compressed snapshot merges in fastboot." 2021-02-08 21:30:11 +00:00
Yifan Hong 3e6b93ca11 Merge "libsnapshot: Communicate compression status to update_engine." 2021-02-08 21:13:10 +00:00
Bowgo Tsai ec10d3cf6e libfs_avb: verifying vbmeta digest early
We should check FLAGS_VERIFICATION_DISABLED is set or not
after verifying the vbmeta digest against `androidboot.vbmeta.digest`
from bootloader. This is to ensure the /vbmeta content is not
changed since the bootloader has verified it.

We still allow vbmeta digest verification error if the device is
unlocked. Note that this change will introduce a limitation that
the device will not boot if:

  1. The image is signed with FLAGS_VERIFICATION_DISABLED is set
  2. The device state is locked

However, it should not be a concern as we shouldn't boot a locked
device without verification.

Bug: 179452884
Test: build image with BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --flag 2,
      boot the device, then `adb shell touch /metadata/gsi/dsu/avb_enforce`.
      Reboot the device, checks the device does not boot because
      `androidboot.vbmeta.digest` is empty but AVB is enforced.

Change-Id: Id15a25403d16b36d528dc3b8998910807e801ad2
2021-02-08 21:36:15 +08:00
David Anderson 565577f926 Add support for compressed snapshot merges in fastboot.
SnapshotManager::New() is now preferred in recovery. Previously we used
NewForFirstStageMount(), which is technically incorrect as that enables
code paths specifically for first-stage init.

We also explicitly label the snapuserd context, since rootfs in recovery
has unlabelled files.

Finally, we add a timeout to internal calls to
CreateSnapshotsAndLogicalPartitions. Without this, WaitForDevice() calls
will terminate immediately, which breaks VABC given the more complex
device stacking that is created.

Bug: 168258606
Test: fastboot snapshot-update merge
Change-Id: I3a663b95c0b1eabaf14e6fde409c6902653c3c5e
2021-02-04 20:21:18 -08:00