Commit graph

1777 commits

Author SHA1 Message Date
Treehugger Robot
4bd1f92e0b Merge "libsnapshot/test: Re-enable the failing tests" 2020-02-27 17:42:38 +00:00
Treehugger Robot
b03ff7dbbf Merge "Mark fs-verity support for ext4 userdata if first_api_level >= R" 2020-02-27 00:26:15 +00:00
Alessio Balsini
e7f1087fa1 libsnapshot/test: Re-enable the failing tests
Some tests were temporarily disabled due to errors in Cuttlefish.
Now that the issues were fixed, the tests can be put back in presubmit.

Bug: 148889015
Test: vts_libsnapshot_test (Cuttlefish + Pixel 4)
Signed-off-by: Alessio Balsini <balsini@google.com>
Change-Id: Idcb2b7831b2183b2d734bdf8821fd34746f2beee
2020-02-26 21:49:25 +00:00
Eric Biggers
91bcfd8d7f fs_mgr: fix checking for casefold feature already enabled
EXT4_FEATURE_INCOMPAT_CASEFOLD is a flag in s_feature_incompat, not in
s_feature_ro_compat.

Bug: 138322712
Test: Treehugger
Change-Id: I07bb1d2b818d423196d8ceebda8900a8adbb19e9
2020-02-26 19:11:48 +00:00
Victor Hsieh
98296fcf2a Mark fs-verity support for ext4 userdata if first_api_level >= R
fs-verity is required for new devices launched with R. This change
remove a manual setup for vendors going forward. The original fs mgr
flag still allows old devices to opt in, which can only to be done
manually because of kernel dependency.

Test: build
Bug: 150034150
Change-Id: I152b63d7889153d41f29677f72074afb1881b65d
2020-02-26 09:49:45 -08:00
Jaegeuk Kim
5283816074 fs_mgr: use "-T now" for tune2fs
No functional change.

Bug: 149039306
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: Ic9dd04f268fcd949ee2e9b30b1598f35ef37b5bf
2020-02-24 19:59:33 -08:00
Yifan Hong
98dc71f4ff Merge "libsnapshot: dump rollback indicator" 2020-02-24 19:00:11 +00:00
Jaegeuk Kim
04bf79dcb4 Merge "fs_mgr: support metadata_csum for ext4 partition" 2020-02-21 05:40:48 +00:00
Yifan Hong
738a94b798 libsnapshot: dump rollback indicator
Test: snapshotctl dump
Bug: 149956852
Change-Id: Ib0308ab75d6dce4047b46d06cece95eed23620a9
2020-02-20 18:41:10 -08:00
Alessio Balsini
91da9dfeef libsnapshot: fix stats write in Resume()
The Resume() operation is supposed to increment the resume counter, but
the updated counter value was not written to the device.
Fix by adding the write operation and refactoring the code.

Bug: none
Test: m
Change-Id: I3fffd61cc779c59e2780900809f0ce0b84258e78
Signed-off-by: Alessio Balsini <balsini@google.com>
2020-02-20 15:05:13 +00:00
Paul Crowley
5ed0698b41 Merge "Add wrapped key support for metadata encryption" 2020-02-18 23:17:06 +00:00
Barani Muthukumaran
2ca1d83ddb Add wrapped key support for metadata encryption
Change metadata_cipher fstab option to metadata_encryption
that includes encryption flags in addition to the cipher.
wrappedkey_v0 encryption flag is used to denote that the
inline encryption hardware supports wrapped keys. dm-default-key
device is created and a wrappedkey is provided along with the
optional wrappedkey_v0 argument.

Bug: 147733587

Test: FBE validation with Fscrypt v2 + inline crypt + wrapped
key changes kernel and metadata encryption with wrapped key.

Change-Id: Id1a18db175680dd6b0adb4594d06566eb1285785
2020-02-18 12:44:40 -08:00
Alessio Balsini
41b00ca46e libsnapshot: Temporarily disable flaky ImageManagerTest
This test was causing the failure of vts_libsnapshot_test.
Disable until a fix is found and tests are stable again.

Bug: 149738928
Test: atests vts_libsnapshot_test
Change-Id: Ibbe5cd72aad93d9ade4ac1542f08dec9cd926a3b
Signed-off-by: Alessio Balsini <balsini@google.com>
2020-02-18 15:53:45 +00:00
Alessio Balsini
adfa9fddd9 SnaspshotManager uses SnapshotMergeStats
The SnapshotMergeStats class is issued by SnapshotManager to track the
merge duration and possible reboots during the merge process.

Bug: 138817833
Test: m
Change-Id: I04e53bb8f6aa9e740c0dcc77c3a9566383954fba
Signed-off-by: Alessio Balsini <balsini@google.com>
2020-02-17 16:38:21 +00:00
Alessio Balsini
cd3915d2e7 Utility class to measure snapshot merge duration
With the Virtual A/B feature, when the device successfully boots after an OTA
update, a dm-snapshot merge operation is performed, which consolidates the
updated images to the base devices.  This merge operation depends on the OTA
size and may affect the device performance until completed.
Create the SnapshotMergeStats class that takes care of measuring the duration
of a merge operation and manages the merge state file to continue tracking the
merge in the case of an interruption due to a reboot.

Bug: 138817833
Test: m
Change-Id: I9dcf1423716c89d8f9b4a0feb4e75bb7b9d18935
Signed-off-by: Alessio Balsini <balsini@google.com>
2020-02-17 16:36:36 +00:00
Treehugger Robot
34ad19f4c4 Merge "snapshot: helper to get access snapshot_state path" 2020-02-17 12:31:49 +00:00
Wei Wang
02e89ecdb5 fsmgr: print unabbreviated log when exec child commands
logs need to be printed at time when it is generated by the child
process which is very useful to understand the boottime impact of
those blocking commands.

Bug: 149418646
Test: boot
Change-Id: Ibee343af6088d57b2976bceb812abb58f3b3f610
2020-02-14 23:34:39 +00:00
Alessio Balsini
be0e44d0f1 snapshot: helper to get access snapshot_state path
/metadata/ota/snapshot_state is a temporary file that keeps track of
snapshot merge operations across reboots.

Bug: 138817833
Test: m
Change-Id: I9785db3f73e1575b8ac8a522d938d09f8948e1b0
Signed-off-by: Alessio Balsini <balsini@google.com>
2020-02-14 20:49:08 +00:00
Mark Salyzyn
f7aa5403c5 fs_mgr: overlayfs: test: if wait_for_screen times out, skip later
To improve the test period for adb-remount-test.sh, if the device
fails to get to the launcher on the first try when wait_for_screen,
then print a warning to skip all later wait_for_screen conditions.

The wait_for_screen testing is really there to deal with first
confirming that the device is capable of getting to the launcher,
and that later tests that influence corners of adb remount behavior
do not result in a failure to get to the launcher screen.  The
developer should look into ways to fix the failure to get to the
launcher on the first try, but failure to do so should have no
bearing on the remaining tests, so dropping the wait_for_screen
functionality is not an issue.

Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Test: adb-remount-test.sh
Bug: 148881519
Change-Id: I5b4a87d6e1f545a304eb74f2114aadd1128f25b3
2020-02-14 11:19:35 -08:00
Mark Salyzyn
ba2449b6ca fs_mgr: remount: add -v option
By default print only ERROR message, or messages without a source
(eg: [fs_mgr]) library.  Print all messages to stderr if the -v
option is added.  Always log all messages to the Android logger.

Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Test: adb-remount-test.sh
Change-Id: I131315d4bae6ed29991043033811cf22e6032f8b
2020-02-14 11:19:35 -08:00
Jaegeuk Kim
78f040c6d6 fs_mgr: support metadata_csum for ext4 partition
The metadata_csum can enhance ext4 stability, so this patch adds a way to
enable it.

Requiring "metadata_csum" in fsmgr flag of fstab.

Bug: 149039306
Change-Id: I618a65d7afc63a617f5f2582c93002af7f8e7234
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2020-02-14 09:50:36 -08:00
Treehugger Robot
4ddb495354 Merge "fs_mgr: fstab: Fix parse warning typo" 2020-02-12 18:20:49 +00:00
Yifan Hong
da8a404473 Merge changes from topic "snapshotctl_log"
* changes:
  libsnapshot callstack files readable by dumpstate
  snapshotctl logs readable by dumpstate
  snapshotctl_log dir readable by dumpstate
2020-02-12 18:18:59 +00:00
Felix
92ed423711 fs_mgr: fstab: Fix parse warning typo
Looks like a copy-paste omission.

Change-Id: Ib8ad3a938654786747540690f4bba93d6573d74d
Signed-off-by: Felix <google@ix5.org>
2020-02-12 17:30:28 +01:00
Yifan Hong
faa49d1d00 libsnapshot callstack files readable by dumpstate
Set callstack logs as 0644 so that they are readable
by dumpstate.

Test: take OTA, cancel, delete /data/misc/update_engine/prefs/*
manually, retrigger OTA (so that callstack is logged), then re-take bug report
Bug: 148818798

Change-Id: I598e484b57dcd3ce6ed7bb483aee57ce2ba881e7
2020-02-11 10:57:51 -08:00
Yifan Hong
bdf93248a3 snapshotctl logs readable by dumpstate
Set persistent logs for snapshotctl to 0644
so that they are readable by dumpstate.

Not using mode field in open() because it is masked
by umask. Directly use fchmod instead.

Test: reboot and take bugreport
Bug: 148818798

Change-Id: I515f8fd1345fcfb82aa2a1ec0c95da4b6921c039
2020-02-11 10:57:51 -08:00
Mark Salyzyn
5ced7600d1 fs_mgr: overlayfs: CreateDynamicScratch for *partition_exists
Commit 69def12f08
("overlayfs: Refactor how the scratch device is deduced, again.")
introduced a regression which dropped a call to
dm.GetDmDevicePathByName.  The call was formerly done to check if
a partition existed and shortcuted the logic.  As a result when
the partition exists and is already instantiated, CreateDynamicScratch
function fails to fill out *scratch_device return value.

The bandaid is to call GetBootScratchDevice() to leverage its own
GetDmDevicePathByName call to fill out if it is detected as an empty
value in CreateDynamicScratch, only called under this condition.

Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Test: adb-remount-test.sh
Bug: 148881519
Change-Id: I40464e8dd17d25a292a275d0b9df5f9519b794fb
2020-02-11 09:41:09 -08:00
Howard Chen
cd8b982e40 Merge "Add a switch to enforce avb for DSU in userdebug" 2020-02-11 06:21:38 +00:00
Howard Chen
f4d345c5ee Add a switch to enforce avb for DSU in userdebug
Bug: 148997664
Test: adb root && adb shell touch /metadata/gsi/dsu/avb_enforce
Change-Id: I5308fa1ae3ca32ee49575fdc52475ad67d51c176
2020-02-10 18:39:57 +00:00
Bernie Innocenti
ba9b73ef8f Convert system/core/fs_mgr to Result::ok()
No functionality changes.

Test: m checkbuild
Change-Id: I96b2adfe7aaea2b2e67307a3ce308455bc1d7a0a
2020-02-10 08:20:25 +09:00
Treehugger Robot
86e13d79cc Merge "rm libbinderthreadstate" 2020-02-07 11:18:51 +00:00
Steven Moreland
f5f9e3594c rm libbinderthreadstate
This library is empty, and its functionality has moved
into libbinder/libhwbinder.

Bug: 148692216
Test: N/A
Change-Id: I306a2c18ec7770cfb6c3939b5e3d42a55c3165fb
2020-02-06 13:25:34 -08:00
Bernie Innocenti
cecebbbacc Convert system/core to Result::ok()
No functionality changes, this is a mechanical cleanup.

Test: m
Test: cd system/core && atest
Change-Id: Ifdaa3ce1947ed578f656d5a446978726eb416c36
2020-02-06 17:04:27 +00:00
Treehugger Robot
a6bc86aae7 Merge "Add libsnapshot_test to presubmit" 2020-02-06 16:58:43 +00:00
David Anderson
24c70ea7ba Merge "libsnapshot: Restrict when snapshots can be deleted." 2020-02-06 16:46:58 +00:00
Alessio Balsini
9ab7fe2768 Add libsnapshot_test to presubmit
Add libsnapshot test to the TEST_MAPPING's presubmit of fs_mgr to run
the test on TH whenever changes are applied to the fs_mgr contents.
Some of the tests are temporarily disabled due to a WIP bug.

Test: TH
Bug: 142513589
Change-Id: I2a283645b433ed1fd2b08d1c4919cac26d19cf16
Signed-off-by: Alessio Balsini <balsini@google.com>
2020-02-06 14:58:25 +00:00
David Anderson
367cca3937 libsnapshot: Restrict when snapshots can be deleted.
Do not delete snapshots for any reason other than merge-complete or a
cancel request from update_engine. Additionally, create a rollback
indicator file if booting into the source slot, so update_engine can
attempt to cancel the update.

Bug: 147819418
Bug: 147347110
Test: libsnapshot_test gtest
Change-Id: Id357a91cec467a60246c7c3d133f6c54ccb3fc93
2020-02-05 17:16:17 -08:00
Alessio Balsini
c352179e10 fiemap: add image_test and writer_test tests to presubmit
Add fiemap_image_test and fiemap_writer_test to TEST_MAPPING to be run
by TH as presubmits.
Because of a bug under investigation, the actual
fiemap_image_test_presubmit is used instead of the original, that has
one test case disabled.

Bug: none
Test: TH, fiemap_image_test, fiemap_writer_test
Change-Id: I63b5e69b5c245a18eceb1e5896df7bd0577f289b
Signed-off-by: Alessio Balsini <balsini@google.com>
2020-02-05 22:08:29 +00:00
Alessio Balsini
f6034544c0 fiemap: fix fiemap size and log message when last extent
Fix the total fiemap struct plus extents size allocation.
Fix also the logging in IsLastExtent, that was printing error messages
every time.

Bug: none
Test: fiemap_*_test
Change-Id: I85c6af63ba3a75b993a5e8ad7d7170dc7af59582
Signed-off-by: Alessio Balsini <balsini@google.com>
2020-02-05 18:27:40 +00:00
Bowgo Tsai
e0f5c10691 first_stage_mount: reading all avb_keys before chroot
Avb keys used to verify a partition are stored in the first-stage
ramdisk. However, after /system is mounted, init will chroot into it.
This makes those keys inaccessible for later mounts, e.g., /vendor or
/product.

This change retains avb keys by reading all of them before chroot
into /system.

Note that it is intentional to perform public matching for both
preload_avb_key_blobs and fstab_entry.avb_keys in libfs_avb.
As some keys might only be availble before init chroots into /system,
e.g., /avb/key1 in the first-stage ramdisk, while other keys might
only be available after the chroot, e.g., /system/etc/avb/key2.

Bug: 147585411
Test: specify avb_keys for a partition and checks the keys are preloaded
Test: atest libfs_avb_test
Test: atest libfs_avb_internal_test
Change-Id: I6bd490c4215480db2937cdfc3fea0d616e224a91
2020-02-05 15:51:41 +08:00
Treehugger Robot
3cbb753b0d Merge "liblp: add test to presubmit" 2020-02-05 01:20:36 +00:00
Yifan Hong
e8cd50a7a0 Merge "libsnapshot::RemoveAllUpdateState log stack" 2020-02-04 23:31:47 +00:00
Treehugger Robot
405d26dacb Merge "Set e2freefrag and e2fsdroid as required by libfs_mgr_defaults" 2020-02-04 22:57:36 +00:00
Yifan Hong
c19b08a66a Merge "Make snapshotctl logging better." 2020-02-04 22:18:33 +00:00
Treehugger Robot
b34a729469 Merge "snapshot/test: Add delay to all the CreateLogicalAndSnapshotPartitions" 2020-02-04 22:16:52 +00:00
Yifan Hong
e8148150c3 libsnapshot::RemoveAllUpdateState log stack
Bug: 148818798
Test: apply OTA but cancel it in the middle, then
      delete /data/misc/update_engine/prefs/*, then
      reapply it again (to trigger CancelUpdate()).
      Stack is dumped.

Change-Id: I2dfb6b7f15b9d5854d0b81ed8ad260538d21c922
2020-02-04 14:01:24 -08:00
Yifan Hong
12fe03d470 Make snapshotctl logging better.
snapshotctl merge --logcat --log-to-file
- If --logcat, log to logcat
- If --log-to-file, log to /data/misc/snapshotctl_log/
- If both, log to both
- If none, log to stdout

Test: manually test these 4 cases
Bug: 148818798
Change-Id: I44b52936c0d095867acc6ee781c6bec04f6ebd6b
2020-02-04 14:01:24 -08:00
Alessio Balsini
13d2d968d9 liblp: add test to presubmit
Add liblp_test to TEST_MAPPING to be triggered as TH presubmit test.

Bug: none
Test: liblp_test
Change-Id: If4d60e816e4e1b321603e1a5ed00e21297567d38
Signed-off-by: Alessio Balsini <balsini@google.com>
2020-02-04 21:33:56 +00:00
Alessio Balsini
272ef868f1 Extra logging for metadata errors
Increase logging in metadata image management.

Bug: none
Test: m
Change-Id: Ie49ca9ac90cd593c95d31f4651ae724d617d5695
Signed-off-by: Alessio Balsini <balsini@google.com>
2020-02-04 20:49:59 +00:00
Alessio Balsini
841bccc1eb snapshot/test: Add delay to all the CreateLogicalAndSnapshotPartitions
In tests CreateLogicalAndSnapshotPartitions may give flaky results
because not synchronous.
Add a bounded delay that prevents this behavior defined by a single
constexpr.

Bug: none
Test: libsnapshot_test
Change-Id: Iad3c24b1d3e82e3bd695d6dbbc8af8eab75bee32
Signed-off-by: Alessio Balsini <balsini@google.com>
2020-02-04 19:33:35 +00:00