Commit graph

3882 commits

Author SHA1 Message Date
Treehugger Robot
68c89b7d7c Merge "Updated 'cc' field of fuzz_config in Android.bp file" into main 2024-05-08 03:42:25 +00:00
Akshata Kadam
87b1dc23c2 Updated 'cc' field of fuzz_config in Android.bp file
corrected cc field in fuzz_config

Bug: 306435930
Test: Build liblp_apis_fuzzer

Change-Id: Id74b2d0d6328ba84df1dcabd47ab1795206f8ca2
2024-05-07 11:42:02 +00:00
Daniel Zheng
c542da2674 libsnapshot: update write error logs
We want to print how much total data we are attempting to write if a
failure occurs

Bug: 336461151
Test: th
Change-Id: I269b7e280df34994c80fa8ef7d39163d053fa9ea
2024-05-06 09:49:07 -07:00
Treehugger Robot
4dced90fdc Merge "Add device= in Fstab" into main 2024-05-02 20:11:52 +00:00
Jaegeuk Kim
d18649eab3 Add device= in Fstab
This adds a raw partition to /data.

Bug: 336319772
Change-Id: Iaae51452be621a15ccd9c2530dae44f4c8714b2f
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2024-05-02 00:54:46 +00:00
Kelvin Zhang
6cdee65b8b Allow querying for fstab for a mount point with fstype
Test: th
Bug: 293313353
Change-Id: I8e12c465d0a3e886fcfa0cebf546b145b785c220
2024-04-25 09:48:13 -07:00
Daniel Zheng
885bd1c8d6 libsnapshot: remove hard coded cow version
Remove hard coded global variables referencing cow version in
libsnapshot. This value should stem from the build system, or set
individually in test cases.

Bug: 307452468
Test: th
Change-Id: I3d536246008acca92cd93e77886e5f7d17a131e0
2024-04-19 11:39:46 -07:00
Akilesh Kailash
fa5cf6884a snapshotctl: Check for cow path when allocated from /data
If the COW device is allocated only from /data, then
the COW device name will end with -cow-img. Hence, check
that path as well.

Bug: 335552315
Test: snapshotctl apply-update
Change-Id: Id3c5cf8afd77994da117de41bb98a226b350f8e4
Signed-off-by: Akilesh Kailash <akailash@google.com>
2024-04-18 06:19:56 -07:00
Treehugger Robot
ef1a559b1f Merge "vts_fs_test: Annotate fs type test for VSR." into main 2024-04-11 05:04:11 +00:00
Daniel Zheng
361120ca71 Merge "support negative zstd compression levels" into main 2024-04-10 17:56:45 +00:00
Daniel Zheng
3785e7b1f7 support negative zstd compression levels
Zstd compression goes all the way down to -7. zstd compression level -3
gives around the same compression ratio as lz4 level=3. Need further
testing to see performance comparison

Test: ota_from_target_files, update_device.py
Change-Id: Ic082b31aa8af938f80be628c73667e02353835f0
2024-04-10 10:56:18 -07:00
Daniel Zheng
f5e9af16b6 Merge "libsnapshot: fix warnings" into main 2024-04-08 19:32:48 +00:00
Treehugger Robot
a45e51339d Merge "Add dm-thin support" into main 2024-04-03 21:46:00 +00:00
Jooyung Han
2f814176ea Add dm-thin support
thin-pool and thin targets are supported via DmTargetThinPool and
DmTargetThin. DM_TARGET_MSG is also added via a new method
SendMessage() because it's used to create a thin volumn.

dmctl is extended to support thin-pool and thin targets.

TODO: thin-pool target constructor can accept feature arguments.

Bug: 327081431
Test: atest libdm_test (CF with dm-thin enabled kernel)
Change-Id: I4c51c668bfe1489b959f6d03c205a5e2e63d9a1d
2024-04-03 10:47:47 +09:00
Treehugger Robot
2dab9f2968 Merge "snapshotctl: Build few commands only for userdebug/eng builds" into main 2024-04-02 17:39:16 +00:00
David Anderson
65f2a49632 vts_fs_test: Annotate fs type test for VSR.
Bug: 302209455
Test: N/A
Change-Id: I5be7472b9d68072bb1400479187e7aee10beb0c7
2024-03-29 11:49:36 -07:00
Akilesh Kailash
a2aa83c5a5 libsnapshot: don't kill the daemon for legacy vab snapshots
If partitions are mounted off the daemon, there is no need
to kill if the tests are being run for legacy vab snapshots.

This also removes vabc_legacy_test as it is no longer required.

Bug: 331053511
Test: vab_legacy_test, vts_libsnapshot_test on Pixel - No flake observed
with 10 iterations
Change-Id: Ie8b29fef77948d23d920c19d816376290cf2fed9
Signed-off-by: Akilesh Kailash <akailash@google.com>
2024-03-27 22:49:04 +00:00
Akilesh Kailash
b0cf1d2370 libsnapshot: Propagate legacy_snapuserd status during WriteUpdateState
Bug: 304829384
Test: OTA on Pixel
Change-Id: I841612c111148523d13166051512314d6fa1986f
Signed-off-by: Akilesh Kailash <akailash@google.com>
2024-03-26 19:59:02 -07:00
Daniel Zheng
98df25ba2e Merge "libsnapshot: Cache Ops correctly" into main 2024-03-26 21:55:13 +00:00
Daniel Zheng
abd3552713 Merge "libsnapshot: remove temporary solution" into main 2024-03-26 21:55:13 +00:00
Akilesh Kailash
c375878b8e snapuserd: Use snapshots during install
If on Androd 12, continue to use snapshots

Bug: 304829384
Test: OTA on Pixel
Change-Id: I94890c308e7f297b695ddbd71659ebb1cf4d278c
Signed-off-by: Akilesh Kailash <akailash@google.com>
2024-03-26 16:36:01 +00:00
Akilesh Kailash
35d5c94bb0 libsnapshot: Enable snapshots during OTA install for S vendor
ro.virtual_ab.userspace.snapshots.enabled is a vendor property which isn't present in Android S. Hence, during OTA install with S vendor, userspace_snapshots is disabled.

However, both update_engine and snapuserd are already on the system partition during install. Hence, forcefully enable userspace_snapshots if this is a path of legacy dm-snapshots with Vendor on Android S.


Bug: 331156940
Test: OTA tests on treehugger, pixel OTA
Change-Id: I3d1c03493d83e670e37df088d4b676c4aa1dc720
Signed-off-by: Akilesh Kailash <akailash@google.com>
2024-03-25 21:10:05 +00:00
Akilesh Kailash
da9db4f396 Merge changes Id9263be8,Idd9a60b0 into main
* changes:
  snapuserd: Remove legacy dm-snapshot based snapshot and snapshot-merge
  libsnapshot: Prepare removal of legacy snapshot
2024-03-25 07:50:30 +00:00
Daniel Zheng
5e8e488c13 libsnapshot: Cache Ops correctly
Change the meaning of batch_size_. Previously, a batch size of 200 meant
200 compressed data ops. With variable block size, each compressed data
op can be up to 256k uncompressed size -> batch size meaning should be
changed to 200 blocks of block size.

With this being said, the default batch size can be increased to 4mb to
better accomodate variable block size

The way we calculate the number of blocks to compress at once also
needs to be changed. Since there's no way of determining the comperssed
data size ahead of time, allow overwriting the cache by batch_size_ and
then flushing the cache as needed

Bug: 322279333
Test: Ota on pixel and measuring system image cow
Change-Id: Ie8e08d109dc5c3b4f5f36a740bbbcd37362a7ab3
2024-03-22 14:47:45 -07:00
Daniel Zheng
d7efbea407 cow_api_test: big replace op
With the modified cache system we might be processing big replace ops at
once. Our old tests didn't catch a case where a big replace op was
chunked into seperate batch writes.

Test: cow_api_test
Change-Id: I3bc80a2f9ed3e4c73dd9f74d9affaba79d49e4d2
2024-03-22 14:47:45 -07:00
Daniel Zheng
c60d2fc566 libsnapshot: chunk iov writes
Currently if our iov that we are trying to write is greater than 1024
our write will fail with error "INVALID ARGUMENT". This is because
pwritev() system call takes a max input size of IOV_MAX (which is device
dependant).

With our increased cache size of 1mb or maybe even more (or if user
configures batch size to be large), our write size could be greater than
IOV_MAX, and will fail with an unhelpful error. We should chunk these
writes to ensure they succeed.

Bug: 322279333
Test: cow_api_test + manual testing with large iov write sizes
Change-Id: Ia1fb53cbfc743cfcdfc7256ff9df075ad0c2dd38
2024-03-21 10:52:37 -07:00
Treehugger Robot
a8c6a92f43 Merge "liblp_builder_fuzzer: Bug Fix" into main 2024-03-21 04:29:17 +00:00
Akilesh Kailash
92b7d837b9 snapuserd_test: check writer != nullptr
Cow Writer used to fail with ENOSPC during initialization.

Try temporaryFile creation with path set to current working directory.

Bug: 328879200
Test: th, snapuserd_test
Change-Id: I7b3833967952c74142f1d5a35cb8d94dd6d894fc
Signed-off-by: Akilesh Kailash <akailash@google.com>
2024-03-21 00:21:11 +00:00
Akilesh Kailash
10233e2fc4 snapuserd: Remove legacy dm-snapshot based snapshot and snapshot-merge
Clean up all the legacy dm-snapshot based approach.

This will continue to maintain backward compatibility with vendor
partition on Android S.

Bug: 304829384
Test: OTA on Pixel
th - OTA from Android S to TOT with vendor on S
Change-Id: Id9263be881dd1a06923cd0ace007f1c027e6969d
Signed-off-by: Akilesh Kailash <akailash@google.com>
2024-03-20 11:10:49 -07:00
Akilesh Kailash
25eabc44f5 libsnapshot: Prepare removal of legacy snapshot
During OTA install, when vendor partition is on Android S, add a new flag in SnapshotUpdateStatus file to indicate that we need to support dm-snapshot based snapshot process. This will be used only during post OTA reboot.

The primary change here is the OTA install path. Earlier, dm-snapshot based approach was used; with this change, since both "snapuserd" and "update-engine" resides on system partition, OTA installation will use the userspace snapshot approach.

To maintain backward compatibility, the new flag "legacy_snapuserd" is used only after OTA reboot. This flag will make sure that update-engine will take the dm-snapshot based approach post reboot and for the entire duration of snapshot-merge.

Additionally, during first-stage init if the vendor is on Android S, then "snapuserd" binary will continue to work based off dm-snapshot as none of this change will impact the mount process.

Bug: 304829384
Test: OTA on Pixel
th - OTA from Android S to TOT with vendor on S
Change-Id: Idd9a60b09417cee141b2810e2d4b35e91c845a5c
Signed-off-by: Akilesh Kailash <akailash@google.com>
2024-03-20 11:08:18 -07:00
Harsh Abichandani
553c9d4fb6 liblp_builder_fuzzer: Bug Fix
Updated FuzzedDataProvider value ranges to avoid Abort due to division by zero.

exec/s: 14786
Test: ./liblp_builder_fuzzer clusterfuzz-testcase-minimized-liblp_builder_fuzzer-5371251289292800
Bug: 328948968

Change-Id: I2568bd104b5fb09744baf42ffca6aabd24797b12
2024-03-19 13:36:07 +05:30
Daniel Zheng
8e6ab87328 libsnapshot: reserve 16x space for ops
We have updated logic for v3 cow we should allow non-data ops to be
cached at 16x the amount of data ops. Changing the reserve size to match
this.

Test: th
Change-Id: I825ffef4e1a2ce4eb5c105d266bf95cb3d776ed9
2024-03-19 00:34:15 -07:00
Treehugger Robot
0b671f4432 Merge "dmctl: add report of IMA" into main 2024-03-18 16:59:31 +00:00
Jaegeuk Kim
9459f7c09c dmctl: add report of IMA
This adds an option "ima" in dmctl.

$ dmctl ima product-verity
Targets in the device-mapper table for product-verity:
0-7463768: verity, target_name=verity,target_version=1.9.0,hash_failed=V,verity_version=1,data_device_name=254:4,hash_device_name=254:4,verity_algorithm=sha256,root_digest=d7af9fcb04d184219ba5477b97bb2bbc89fd23a46e03d1dea31d674cc4934769,salt=19d4f2345adfc8b7cc22a3c2f21dd413e5020fc7920a08a33f46f3c61492dfcc,ignore_zero_blocks=y,check_at_most_once=n,verity_mode=restart_on_corruption;

Change-Id: I057970b6c786b3f9a394b4919f5f5115b27cbc08
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2024-03-15 16:34:20 -07:00
Daniel Zheng
9ce8219f52 libsnapshot: fix warnings
Fix unused header warning

Test: th
Change-Id: I5c9f22f3f74d6ca44e738e1dc8e9fe146749857f
2024-03-13 22:31:58 -07:00
Daniel Zheng
da960a1341 libsnapshot: remove temporary solution
Remove temporary estimation solution (using 4k to overestimate the cow).
With the updated estimation logic, we should be able to accurately
estimate the cow size with variable block sized compression

Bug: 322279333
Test: th
Change-Id: I199970048605a8d21d3791614ad88ca61662e1a3
2024-03-13 22:28:43 -07:00
Jiakai Zhang
6480d875b5 Make snapshotctl also log to logd.
Since http://r.android.com/2994274, snapshotctl can be run by init.
Therefore, we need it to log to logd for better debuggability.

Bug: 311377497
Test: adb shell setprop sys.snapshotctl.map requested
Test: adb shell setprop sys.snapshotctl.unmap requested
Change-Id: I287ecf77d45fb9e6c44bea36e14d2624029afea5
2024-03-08 18:56:13 +00:00
Kelvin Zhang
eed1c42087 Merge "Add annotations to VTS tests" into main 2024-03-01 02:35:40 +00:00
Kelvin Zhang
98522c0e2d Add annotations to VTS tests
This helps reviewers understand which VTS requirement these test are
covering

Bug: 302208814
Test: th
Change-Id: I52712d9888b73fc7a9f8eeeb035a3303618efd69
2024-02-29 14:30:35 -08:00
Akilesh Kailash
b9f2361dd9 snapshotctl: Build few commands only for userdebug/eng builds
Bug: 319309466
Test: Build on -user and -userdebug targets
Change-Id: I2a668193972495769ecedbb687f561ed7345ffbc
Signed-off-by: Akilesh Kailash <akailash@google.com>
2024-02-29 13:58:46 -08:00
Treehugger Robot
b6fc19c308 Merge "adb-remount-test: Adb shell command could return 0 or 255 if device is disconnected" into main 2024-02-29 16:59:14 +00:00
Yi-Yo Chiang
2f298bcb21 adb-remount-test: Adb shell command could return 0 or 255 if device is
disconnected

Background: aosp/I25f740bd222263fcb3c501def38977db6af1e0d9

Bug: 327552188
Test: abtd
Change-Id: Ida33bfa00887e8ac358e057fc37fd45095ccc26b
2024-02-29 19:45:14 +08:00
Akilesh Kailash
3aef00da3d Merge "Reapply "snapshotctl: Add apply-update option"" into main 2024-02-29 06:27:11 +00:00
Treehugger Robot
8fefa5a96b Merge "Support for striped in libdm" into main 2024-02-28 23:16:32 +00:00
Akilesh Kailash
cac1cf3ae9 Reapply "snapshotctl: Add apply-update option"
This reverts commit 1af7260931.

Fix: Allow BootControlClient.h to be used in -user builds

Bug: 319309466
Test: Build on -user branch
Change-Id: I93e95e35b29a98816b2f33fe9fa6859655934cd5
2024-02-28 11:29:10 -08:00
Raphaël Hérouart
1af7260931 Revert "snapshotctl: Add apply-update option"
This reverts commit 77337c2975.

Reason for revert: b/327325747

Change-Id: I6796717774d28a7c306e19dd448c3c830f3fd550
2024-02-28 10:12:05 +00:00
Akilesh Kailash
77337c2975 snapshotctl: Add apply-update option
$snapshotctl apply-update <directory containing snapshot patches>

This command is equivalent to applying incremental-ota but
bypasses all of the update-engine subsystem. Snapshot-patches
which are created on the host will be used directly and
will be written to the COW block devices.

No change to any of the libsnapshot or the I/O path logic.

Once the snapshot patches are applied, device is ready
to reboot as if an OTA update is applied.

Once the device reboots, snapshot merge will be initiated
as usual.

This will help test the changes to libsnapshot + init + snapuserd
extremely quick.

Incremental flashing becomes quite simple in the CI workflow.

Here are numbers tested on live builds where the actual builds/testing
is done on CI.

Patch-Create+Apply = Create the snapshot patches between two
builds and apply them to the device

Branch(main)     Patch-Creation+Apply Merge        Snapshot-size
=================================================================
Build-1 -> Build-2  14 seconds        40 seconds   160MB

Build-2 -> Build-3  21 seconds        26 seconds   331MB

Build-3 -> Build-4  30 seconds        45 seconds   375MB

Build-X -> Build-X  3 seconds	       4 seconds   8MB

Bug: 319309466
Test: On Pixel 6, incremental builds

Change-Id: I271b2cb5df4abde91571ec70ce06f926a1d01694
Signed-off-by: Akilesh Kailash <akailash@google.com>
2024-02-27 14:21:14 -08:00
Akilesh Kailash
69d574c612 libsnapshot: Fetch device size from header
Now that V3 is enabled, relax the header version check.
For V3, header op_count_max contains the information of the device size.

Bug: 299011882
Test: snapshotctl map-snapshots on Pixel with V3 format

Change-Id: Ia1cb20b24857136a742e20408ee95e56e98b256a
Signed-off-by: Akilesh Kailash <akailash@google.com>
2024-02-23 22:26:42 +00:00
Daniel Zheng
bee3f962fc libsnapshot: stride compression
Alternate dispatching blocks between threads rather than splitting the
data beforehand and then sending to threads in order to ensure that
single threading + multithreading chunks data at the same locations.
Without this change, the resulting op count + data section of the cow
will differ between --enable-threading && --disable-threading at
runtime, which is a result we don't want

Test: th
Change-Id: I3ed8add0552745a281fce2aa7f1d1d32eb547e63
2024-02-22 21:38:47 -08:00
Ed Tsai
43de4ef22d Support for striped in libdm
Add dm stripe in dmctl framework to support stripe on two block devices.

Bug: 321628121
Change-Id: I2f326f19f7ccff1ee03598743022fb702b3e8d6a
Signed-off-by: Ed Tsai <ed.tsai@mediatek.com>
2024-02-23 08:11:30 +08:00