Commit graph

75964 commits

Author SHA1 Message Date
David Anderson
89d84e1de4 Merge "remount: Refactor partition filtering into helper functions." 2022-08-05 22:10:29 +00:00
Akilesh Kailash
760074068c Merge "libsnapshot: Store index of COW ops vector" 2022-08-05 19:31:18 +00:00
David Anderson
0b0b2b6b5f remount: Refactor partition filtering into helper functions.
There is a small change of behavior in this patch. If "remount"
specifies a list of arguments, and one of them is invalid, it will now
error rather than try to remount the remaining partitions.

Bug: 241179247
Test: remount
Change-Id: I7a9ef41886f32ae97173796358b41844a1e42ea8
2022-08-05 11:52:24 -07:00
Akilesh Kailash
2823900efb libsnapshot: Store index of COW ops vector
Using vector + unordered_map to retrieve the index in
a COW op vector consumes significant memory; this
is a problem especially when there are hundreds
of thousands of operations.

Instead, just store the index of the COW op vector
during pre-processing.

On Pixel, peak memory usage when all the partitions
are mapped:

Without patch:
	RssAnon:	  118804 kB
With path:
	RssAnon:	   55772 kB

Additionally, post OTA reboot, memory usage further goes
down as the partition merge completes.

Bug: 238052240
Test: OTA on Pixel
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: Icc68a9688ceb89572821cee2dac689779f5e7c11
2022-08-04 17:31:03 +00:00
David Anderson
18d8cd76fa Merge "remount: Split fstab and checkpointing code into helper functions." 2022-08-04 05:11:06 +00:00
David Anderson
eb2d8e966e remount: Split fstab and checkpointing code into helper functions.
Bug: 241179247
Test: remount
Change-Id: I0c3ca23696b71f72cdd2d650872d1d9ab34f9de5
2022-08-03 13:36:40 -07:00
Treehugger Robot
67d70ffe03 Merge "storageproxy: Report fsync failures with a distinct error code" 2022-08-03 17:16:48 +00:00
Treehugger Robot
eb9780feb6 Merge "storageproxy: Support POST_COMMIT sync for all commands" 2022-08-02 23:52:38 +00:00
Stephen Crane
1c75d1e3a7 storageproxy: Report fsync failures with a distinct error code
Fsync failures are special because they may indicate a failure of an
operation before the current operation. Report these cases as a new,
distinct error.

Test: Cause fsync failure and check error response
Bug: 239105007
Change-Id: Ie9d4a1949586e90006256c975786e21ced655e66
2022-08-02 10:59:30 -07:00
Stephen Crane
57770a5318 storageproxy: Support POST_COMMIT sync for all commands
Previously we did not support STORAGE_MSG_FLAG_POST_COMMIT for anything
but RPMB operations (in which case it was a no-op). We need to support
this flag in order to store a superblock in non-secure storage, as we
need that write to commit atomically wrt all other writes.

Test: com.android.storage-unittest.nsp
Bug: 228793975
Change-Id: Ia453c1916970e0b65a91e42f18b920ac4e1f01db
2022-08-02 10:59:30 -07:00
Matthew Maurer
2e81ec2191 Merge "rust: Visibility exports for bindgen" 2022-08-01 20:50:41 +00:00
Treehugger Robot
f662134ff6 Merge "Update OWNERS" 2022-08-01 19:53:10 +00:00
Tri Vo
7104ffee7e Update OWNERS
Change-Id: I5ab0364d0e6d19c92c1e11f72fced067b1026ba5
2022-08-01 11:45:25 -07:00
Tri Vo
a6ac1d6b3f Merge "trusty: metrics: Drain events before each test" 2022-07-29 23:17:59 +00:00
Steven Moreland
5daa3bb90e Merge "RefBase: test for stack check" 2022-07-29 18:10:03 +00:00
Matthew Maurer
132a2b26b9 rust: Visibility exports for bindgen
We are now default restricting bindgen visibility to subpackages. This
change is part of a set of changes adding explicit visibility for
bindgen libraries which are already being used elsewhere.

* If these visibility rules are to allow access by the safe bindings
  library which lives elsewhere in the codebase, no action is needed.
* If safe bindings do not exist, and you own this library, now is a good
  time to think about producing them and transitioning your (now
  enumerated) client list.
* If safe bindings exist, but there is a surprise client of the raw
  bindings on this list, now is a good time to talk to them about why
  they don't want to use your safe bindings.

Bug: 166332519
Test: m
Change-Id: I1320a72d61cf0d760da3e037dec6ad35c8c979f8
2022-07-29 09:06:38 -07:00
David Anderson
811eed3bb6 Merge changes Iedc94613,I58621281
* changes:
  libsnapshot: Improve vts_libsnapshot_test alternate configuration testing.
  libsnapshot: Switch to IPropertyFetcher.
2022-07-29 04:03:04 +00:00
Steven Moreland
cd4ef87efd RefBase: test for stack check
Surprised this isn't breaking anything, so wanted to
make sure it worked.

Bug: 232557259
Test: libutils_test
Change-Id: Iaec47d644c02dc190e397c6f84dcfab4cc76f566
2022-07-29 00:54:57 +00:00
Tri Vo
4b38ffab15 trusty: metrics: Drain events before each test
Also add tighter checks to make sure we didn't drop events.

Bug: 240617890
Test: libtrusty_metrics_test
Change-Id: I0029d91ad0ff67eb97913b2316efca627b118616
2022-07-28 17:09:00 -07:00
Steven Moreland
ea25b4ba5b Merge "libutils: disallow extending lifetime on stack" 2022-07-28 23:17:35 +00:00
David Anderson
8ae1c5d81a libsnapshot: Improve vts_libsnapshot_test alternate configuration testing.
Change -force_config to -force_mode. Change inputs to vab-legacy
(Android R) and vabc-legacy (Android S). Default is device
configuration. There is no explicit option for Android T since it is the
default.

This also adds -compression_method which overrides the default of "gz".

Bug: 208944665
Test: vts_libsnapshot_test -compression_method lz4
      vts_libsnapshot_test -force_mode vab-legacy
      vts_libsnapshot_test -force_mode vabc-legacy
Change-Id: Iedc9461325229ccffd84478e1971f8b6b959e160
2022-07-28 13:14:20 -07:00
David Anderson
76c6c5bc2f libsnapshot: Switch to IPropertyFetcher.
vts_libsnapshot_test uses IPropertyFetcher, as does liblp, but
libsnapshot doesn't. Fix this by switching relevant cases in
utility.cpp.

This also changes SnapshotTestPropertyFetcher from a mocked class to a
pseudo-implementation. This is useful because sometimes we want the
actual device's properties and sometimes we don't, and this setup is
more flexible.

Bug: 208944665
Test: vts_libsnapshot_test
Change-Id: I58621281715b3efb045b6be6f788934fddaa1a0c
2022-07-28 11:28:29 -07:00
Steven Moreland
51e98b8378 Merge "libutils: RefBase always disallow on stack" 2022-07-28 16:11:10 +00:00
David Anderson
ef46fe4e2b Merge "libsnapshot: Clarify the meaning of "compression.enabled"." 2022-07-28 04:47:32 +00:00
David Anderson
d3ecda57c4 libsnapshot: Clarify the meaning of "compression.enabled".
The compression.enabled property only refers to legacy snapuserd.
However, everywhere it's used, we almost always mean "using the new COW
format with snapuserd, whether compression is enabled or not".

This patch clarifies things by renaming "compression_enabled" fields to
"using_snapuserd".

This also simplifies the feature detection code quite a bit, by removing
some redundant checks and clarifying which cases are legacy vs userspace
snapshots.

Bug: 208944665
Test: vts_libsnapshot_test
      apply OTA, snapshotctl dump
Change-Id: Ie617ed3f92eefb8dff0a5cf13e5a2caa47b9e8e0
2022-07-27 18:32:15 -07:00
Treehugger Robot
16efb76c24 Merge "libmodprobe: allow module with soft dependencies to load in parallel" 2022-07-27 16:16:14 +00:00
chungkai
d84c42e3b3 libmodprobe: allow module with soft dependencies to load in parallel
1. integrate modules which have soft dependencies into parallel loading flow. First, check the soft dependencies are in `module.load`  list. If yes, regard soft dependencies as hard dependencies and load the modules only when their dependencies are loaded. If not, abandon these soft dependencies.

2. also add an allowlist and use the term "load_sequential=1" to load specific modules in sequential.

Test: R4 saves 350ms+ (48%) to load all modules
Bug: 229794277
Signed-off-by: chungkai <chungkai@google.com>
Change-Id: I904fe31cd02f9d499dadc537335cadc88d8add70
2022-07-27 04:57:10 +00:00
Steven Moreland
b0fe01da56 Merge "libutils: RefBase: extra check for double own" 2022-07-26 22:22:47 +00:00
Steven Moreland
d086fe5109 libutils: disallow extending lifetime on stack
Bug: 232557259
Test: libutils_test
Change-Id: Iacf45b9f295a48904606ced35994ba35566bfcc3
2022-07-26 22:11:13 +00:00
Steven Moreland
c340a08b1b libutils: RefBase always disallow on stack
Before, we only did this in sp<> constructors, but we can always make
this check during the initial incStrong.

Since prebuilts call into the existing report race function declared
in StrongPointer.h, we still call this function from RefBase.cpp.

Bug: 232557259
Test: libutils_test
Change-Id: I4080b1869b83ecf655fc9c182b6de768a6358adf
2022-07-26 22:10:51 +00:00
David Anderson
02a04511ab Merge "libsnapshot: Refactor WriteSnapshotAndHash." 2022-07-26 20:53:30 +00:00
Steven Moreland
483a2def8d libutils: RefBase: extra check for double own
Bug: 232557259
Test: libutils_test
Change-Id: Ibd400750e7973600ec3fa493838a3b52cafe3add
2022-07-26 17:59:14 +00:00
Treehugger Robot
4304cbd8db Merge "trusty-binder: Add AIDL files for trusty-binder tests" 2022-07-26 15:19:56 +00:00
David Anderson
808078ef75 libsnapshot: Refactor WriteSnapshotAndHash.
This adds a helper around WrapSnapshotAndHash to avoid manually calling
it as most tests have to do. It also changes the signature so a
PartitionUpdate is passed rather than a name, which gives access to
partition information for debugging.

Bug: 208944665
Test: builds
Change-Id: Icd1cdf9d49c48f5a44c35ab1b86f43287e429f86
2022-07-25 16:56:33 -07:00
Akilesh Kailash
8f7aaf9d97 Merge "Flush after every 2MB merge of replace ops." 2022-07-25 21:27:40 +00:00
Akilesh Kailash
58377417e9 Flush after every 2MB merge of replace ops.
This will be in sync with incremental OTA's where the sync
is done every 2MB. This improves performance on devices
with low memory.

Merge times for full OTA may increase by couple of seconds but
that is ok given it decreases the memory footprint.

Bug: 238052097
Test: OTA
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: Ic2c8d2ffdbdb677e0c4d44e5de68ce8ccf86df34
2022-07-25 19:08:46 +00:00
Thiébaud Weksteen
6eb4d64eae Merge "Remove unused execution paths when formatting" 2022-07-24 23:59:18 +00:00
Treehugger Robot
e7bc3e3764 Merge "libfiemap: Add a test case for larger block size filesystems." 2022-07-23 03:18:58 +00:00
David Anderson
d76c31ba40 libfiemap: Add a test case for larger block size filesystems.
This adds a test case for filesystems with larger than 4KiB alignment.
It creates a temporary FAT filesystem and attempts to create a backing
image. The actual size of the block device should be the requested size.

Test: fiemap_image_test
Bug: N/A
Change-Id: I8ef574b22dbf6d47f4855b7de681c927cf81f2b7
2022-07-22 17:44:12 -07:00
Deyao Ren
ec73481e58 Merge "Add apex name to service" 2022-07-22 23:03:45 +00:00
Jooyung Han
ba1fbaf50c Merge "Respect namespace mnt" 2022-07-22 22:41:14 +00:00
Jooyung Han
5eb441caca Respect namespace mnt
This fixes the regression of aosp/2153354.
SwitchToMountNamespaceIfNeeded() is supposed to switch between "default"
mount namespace and "bootstrap" mount namespace. But it shouldn't affect
services with its own mount namespace.

Bug: 239882455
Test: make a hal service start in a separate mount namespace
    using 'namespace mnt' in its definition.
    see the mount namespace of the service process
    $ cat /proc/$(pgrep -f myservice)/ns/mnt
Change-Id: I8c80eaec723241c405f48980b9e88640123c43ad
2022-07-23 01:41:18 +09:00
Deyao Ren
df40ed1be1 Add apex name to service
Passed apex file name to service. The file name will be parsed
to determine 1) whether the service is from an apex; 2) apex name

Bug: 236090201

Change-Id: I2c292c0c067f4bf44bb25b1f80e4f972b94f7258
2022-07-22 04:00:30 +00:00
Tri Vo
6a058f492c Merge "storageproxyd: Remove setuid, setgid, and capset" 2022-07-21 23:59:45 +00:00
David Anekstein
c6768f7aad trusty-binder: Add AIDL files for trusty-binder tests
Bug: 224644083
Change-Id: I4818bfee421996dbf313c96d3ab53d9d0429f0c4
2022-07-21 15:34:43 -04:00
Thiébaud Weksteen
5d72d6ce20 Remove unused execution paths when formatting
fastboot uses the internal functions generate_ext4_image and
generate_f2fs_image when called via the `format` subcommand. An option
for populating the newly created fs with an initial directory exists,
but it is not exposed to the command line interface (initial_dir is
always ""). Remove the unused codepaths for this preloading.

Test: atest --host fastboot_test
Bug: 237960487
Change-Id: I7acfe6352cf26b5cbe0e5553b288c3798e96a893
2022-07-21 14:50:05 +10:00
Yi-yo Chiang
44f1f094b3 Merge "fs_mgr_overlayfs: Try "/system" and "/" when setting "/system" shared type" 2022-07-21 03:52:52 +00:00
Yi-Yo Chiang
379be50f9c fs_mgr_overlayfs: Try "/system" and "/" when setting "/system" shared type
b/239574953 uncovers an obscure test device configuration that breaks
with aosp/2146960.

Without aosp/2146960, "/system" is not a mountpoint, because after
switch_root, the "/system" mount entry becomes "/", thus changing the
subtree propagation type of "/system" would fail.
With aosp/2146960, "/system" is bind-mounted to itself after
switch_root, ensuring "/system" being a mountpoint, thus changing the
subtree propagation type of "/system" is allowed.

Before we can re-land aosp/2146960, just try both "/system" and "/"
when changing the subtree shared propagation type of "/system", so
both scenarios are handled.

Test: Add submount under /system and adb remount
Change-Id: I4006a5c1b1987d5f6452efa069ec5c7d2ac7c8ec
2022-07-21 03:52:26 +00:00
David Anderson
c20b6b58fc Merge "remount: Ensure that scratch images are block-size aligned." 2022-07-21 01:56:09 +00:00
David Anderson
2d8bc21823 remount: Ensure that scratch images are block-size aligned.
Bug: 218976943
Test: adb remount
Change-Id: I46a4592c4ba504865a633437d734ce26e5fba6a5
2022-07-20 16:20:03 +00:00