Commit graph

69467 commits

Author SHA1 Message Date
David Anderson
c2bb3ee6d6 libsnapshot: Propagate merge phase across merge failures.
If a merge fails we write a new snapshot status indicating that the merge
failed. If this happens to occur during the second merge phase, we fail
to propagate the phase counter to the new status. This means the merge
is unlikely to make progress and succeed later.

Bug: 193549218
Test: manual test
Change-Id: I31fdae6bde48e3a71b6f3fcc663541257f7ebd8f
2021-07-16 20:05:39 -07:00
Wenhao Wang
8b6dac42c9 Merge changes Ib90f8b28,I391ecff9
* changes:
  trusty:storageproxyd: Add wakelock to the UFS commands
  trusty:storageproxyd: Fix return paths on errors
2021-07-16 19:32:14 +00:00
Nikita Ioffe
1a257af822 Merge "Deflake libdm#CreateEmptyDevice test" 2021-07-16 11:15:32 +00:00
Wenhao Wang
6e0a762290 trusty:storageproxyd: Add wakelock to the UFS commands
We add a wakelock to the sequence of UFS commands so that
the sequence will not be disrrupted when devices get suspended.

Bug: 193456223
Test: Trusty storage tests
Change-Id: Ib90f8b284017cf261d2a2aea940834a42c21de02
2021-07-15 22:34:58 -07:00
Wenhao Wang
09b493b143 trusty:storageproxyd: Fix return paths on errors
The function send_ufs_rpmb_req is missing return paths on errors.
This patch fixes it so that any UFS command failure will return
error code to the function caller.

Bug: 193855098
Test: Trusty storage tests
Change-Id: I391ecff9ed3f892b7c3adae0ceeb18930791326f
2021-07-15 22:24:11 -07:00
Nikita Ioffe
7756779289 Deflake libdm#CreateEmptyDevice test
Judging from local experiments, it looks like device-mapper doesn't
always generate a uevent after DM_DEV_CREATE ioctl.

Test: presubmit
Bug: 193462349
Change-Id: I8a74375631b20c14a32a41dbaf38380ebc0078e6
2021-07-15 15:33:17 +01:00
Greg Kaiser
615bf4ef14 Merge "Revert "Remove unused String8::setPathName."" 2021-07-15 13:33:54 +00:00
Greg Kaiser
70d9fb63e6 Revert "Remove unused String8::setPathName."
This reverts commit c214426e0c.

Reason for revert: This is not unused; broke build internally

Change-Id: I18e8b7954256ae015ad32743fa6a75850b00913e
2021-07-15 13:33:10 +00:00
Treehugger Robot
d939aa2405 Merge "Revert "Re-land removing RECOVERY_AS_BOOT check for init_first_stage"" 2021-07-15 05:38:21 +00:00
David Anderson
16aa3c9573 Merge "libsnapshot: Fix inconsistency in how merge ops are counted." 2021-07-15 01:00:33 +00:00
David Anderson
0f707941d4 libsnapshot: Fix inconsistency in how merge ops are counted.
A recent change to libsnapshot caused us to filter out duplicate COW
ops. The merge consistency check relied on the old method of manually
counting ops, causing it to come up with a different number. Fix this by
using the already computed "official" count.

Bug: 193532829
Test: new test case in vts_libsnapshot_test
      manual test with incremental OTA
Change-Id: I68d1e41f5c140af20a04ba80e3db0780a916ecf8
2021-07-14 16:44:54 -07:00
Elliott Hughes
40a0664b84 Merge "Remove unused String8::setPathName." 2021-07-14 21:20:24 +00:00
Andrew Walbran
1ed24f477e Merge "virtualizationservice will clear its own temporary directory." 2021-07-14 18:29:04 +00:00
Seth Moore
8fe5602099 Merge "Client side implementation of Trusty IRPC HAL" 2021-07-14 16:35:37 +00:00
Andrew Walbran
1f885aee3d virtualizationservice will clear its own temporary directory.
Bug: 192917795
Bug: 193365943
Test: flashed on a VIM3L and booted
Change-Id: Ib9657843c4d13c428670982a3f8d0e5dfdb78211
2021-07-14 14:18:25 +00:00
Bowgo Tsai
ab079af28f Revert "Re-land removing RECOVERY_AS_BOOT check for init_first_stage"
This reverts commit 4818f74888.

The previous commit might introduce a build break on legacy
devices that with a smaller /boot partition size, because it
outputs the first-stage init and the second-stage init binaries
in the following locations, respectively (when
BOARD_USES_RECOVERY_AS_BOOT is true).

    * $OUT/recovery/root/first_stage_ramdisk/init
    * $OUT/recovery/root/system/bin/init

The first one is not needed because there is already a symlink
under $OUT/recovery/root:  init -> /system/bin/init.

Bug: 193565271
Test: `lunch aosp_flame-userdebug`, `make bootimage_debug` then
      checks the output under $OUT/debug_ramdisk/.
Test: Performs the same check for `lunch aosp_bramble-userdebug`.
Change-Id: I6277a6c4c0980bd976cc35db6ca99eafc6bf3f5a
2021-07-14 19:21:40 +08:00
Elliott Hughes
c214426e0c Remove unused String8::setPathName.
Test: treehugger
Change-Id: Idc8d7e748b0df4ce8a26227dc73a5eef2b04244f
2021-07-13 17:20:53 -07:00
Tri Vo
e3ec5f9363 Merge "trusty: Increase timeout for ConfirmationUI fuzzer" 2021-07-13 21:09:38 +00:00
Treehugger Robot
a7e63d9952 Merge "task_profiles.json: add taskprofile for dex2oat boot_complete policy" 2021-07-13 12:22:58 +00:00
Wei Wang
814673ace3 task_profiles.json: add taskprofile for dex2oat boot_complete policy
Since installation time is also critical and sometime we want a finer
control on its behavior for vendor. Instead of set dex2oat to background
group, add a new task profile.

The default policy is to mirror SP_BACKGROUND to be compatible with
legacy devices.

Test: Boot
Bug: 188947181
Signed-off-by: Wei Wang <wvw@google.com>
Change-Id: I7d5e113d1c368205f712eadad27775de226131ce
(cherry picked from commit 3745ce7aa8)
2021-07-12 18:49:52 -07:00
Treehugger Robot
df72c168d3 Merge "fs_mgr: License boilerplate" 2021-07-13 01:33:43 +00:00
Treehugger Robot
662729bc2e Merge "Re-land removing RECOVERY_AS_BOOT check for init_first_stage" 2021-07-13 01:32:21 +00:00
Tri Vo
f9cfeac49e trusty: Increase timeout for ConfirmationUI fuzzer
Bug: 192923547
Test: trusty_confirmationui_msg_fuzzer
Change-Id: I72755b0a35bbc3f2540672ca53acd14b1add38cb
2021-07-12 16:34:01 -07:00
Inseob Kim
4818f74888 Re-land removing RECOVERY_AS_BOOT check for init_first_stage
This has kept adb_debug.prop from being installed for
legacy devices with BOARD_USES_RECOVERY_AS_BOOT set to
true.

Bug: 192432810
Bug: 193291885
Test: `lunch aosp_flame-userdebug` and checks `get_build_var
      BOARD_USES_RECOVERY_AS_BOOT` is true.
Test: `make bootimage_debug` then checks
      $OUT/debug_ramdisk/adb_debug.prop exists
Test: build/soong/build_test.bash --dist --incremental

Change-Id: I28e2c082512791407167b610843f18731ed6d673
2021-07-10 23:42:53 +08:00
Bowgo Tsai
a8c6b9d27f fs_mgr: License boilerplate
Bug: 191507548
Test: TreeHugger
Change-Id: I2924d1733fc64de69681971ab42a526dc3bbcc1d
2021-07-09 06:24:04 +00:00
Treehugger Robot
1f92dc1a07 Merge changes I70c174c4,Ifc365e3b
* changes:
  Correctly implement a stub for ICowWriter::AddXorBlocks
  Add MockSnapshotWriter
2021-07-08 21:28:08 +00:00
Kelvin Zhang
c801d5b8f0 Correctly implement a stub for ICowWriter::AddXorBlocks
Test: th
Change-Id: I70c174c4d44ef979993063256e3eededf18bd086
2021-07-08 16:12:16 -04:00
Kelvin Zhang
e475852cf6 Add MockSnapshotWriter
Test: th
Change-Id: Ifc365e3bafc07f0708d9e2113afa434d73f32e28
2021-07-08 16:11:16 -04:00
Devin Moore
53ad66f41b Merge "init: remove extra space in list of bootconfig values" 2021-07-08 16:06:43 +00:00
Treehugger Robot
905ef0e025 Merge "init: Enable hwasan error reporting." 2021-07-08 15:56:07 +00:00
Max Bires
95b5b04872 Client side implementation of Trusty IRPC HAL
This change includes the code necessary to communicate to the
IRemotelyProvisionedComponent backend implementation running in Trusty.
It also makes the relevant changes to the manifest XML file to add the
IRemotelyProvisionedComponent HAL.

Bug: 192228022
Test: atest VtsHalRemotelyProvisionedComponentTargetTest
Change-Id: I32c30ce2dc44e95ff91574ce405f10e3b5dc9699
Merged-In: I32c30ce2dc44e95ff91574ce405f10e3b5dc9699
2021-07-08 03:00:51 +00:00
Devin Moore
6d5445b9f4 init: remove extra space in list of bootconfig values
If a bootconfig argument has a list of values, it has a space between
them in /proc/bootconfig.

Example:
BOARD_BOOTCONFIG := parameter=value1,value2,value3

In /proc/bootconfig, it looks like:
parameter = "value1", "value2", "value3"

Before this CL, that example would end up with the value string of:
"value1, value2, value3"

To keep consistent behavior with kernel cmdline the value string should be:
"value1,value2,value3"

Test: Boot cuttlefish with test bootconfig params and verify ro.boot.*
Bug: 192257482
Change-Id: Iccdec451f53330162fa2c9ad2b7c2630f32b4168
2021-07-08 01:52:46 +00:00
David Anderson
8138717679 init: Enable hwasan error reporting.
Bug: 172541617
Test: builds with SANITIZE_TARGET=hwaddress
Change-Id: Ic749172bf9dd64bca0e8c7e34ac0b323685ad945
2021-07-07 18:49:19 -07:00
Nikita Ioffe
fb1e841a9f Merge "Also populate lastUpdateMillis in ActivateFlattenedApexesIfPossible" 2021-07-08 01:16:49 +00:00
Daniel Rosenberg
b19c333f2f Merge changes from topic "CowSequenceOp"
* changes:
  libsnapshot: Switch merge to CowRevMergeOpItr
  libsnapshot: Add seq op support to inspect_cow
  libsnapshot: Add CowRevMergeOpIter
  libsnapshot: Add IsOrderedOp
  libsnapshot: Cleanup iterators
  libsnapshot: Add Sequence Ops
2021-07-07 23:59:43 +00:00
Suren Baghdasaryan
86e0c6f409 Merge "libprocessgroup: Remove unnecessary permissions change in uid/pid hierarchy" 2021-07-07 23:09:48 +00:00
Daniel Rosenberg
437a49ae66 libsnapshot: Switch merge to CowRevMergeOpItr
This switches merge code over from using the old RevOpItr to the new
MergeRevOpItr. Since there are no other users, RevOpItr is no longer
needed.

Changed names of copy_ops_ and total_data_ops_ to more accurately
reflect their meaning.

Bug: 177104308
Test: cow_snapuserd_test
Change-Id: Ic053be4877cfdc86656551f5a3d5d95f3825f937
2021-07-07 22:23:44 +00:00
Daniel Rosenberg
fffb9ff8ee libsnapshot: Add seq op support to inspect_cow
This adds the -m option to inspect_cow, allowing it to display the ops
according to CowRevMergeOpItr

Bug: 177104308
Test: inspect_cow -m on file with and without seq ops
Change-Id: Ic9a062b8175c77084e76c437414c23fd09e34cc6
2021-07-07 22:23:38 +00:00
Daniel Rosenberg
9b34ea8541 libsnapshot: Add CowRevMergeOpIter
This presents cow ops in the reverse of their merge order, as requested
when we perform a merge. It starts with sorted non-ordered ops sorted by
blocks, and then the ordered ops. Already merged ops are removed.

Bug: 177104308
Test: cow_api_test
Change-Id: I864bcab5cda447cf4a197abc02d954f9db08b744
2021-07-07 22:23:27 +00:00
Daniel Rosenberg
f7001fad6f libsnapshot: Add IsOrderedOp
Ordered Ops are Cow Ops with source block dependencies.
Currently this is only Copy Ops, but will extend to XOR
blocks when they're added.

Bug: 177104308
Test: Builds, does not impace cow_api_test/cow_snapuserd_test
Change-Id: I0a50dfe3316ec3a3b1d035335f094c62296649a5
2021-07-07 22:23:22 +00:00
David Anderson
ccea7dfae7 Merge "Fix gid not being set in ueventd when device nodes already exist." 2021-07-07 22:06:09 +00:00
Suren Baghdasaryan
29c9e26776 libprocessgroup: Remove unnecessary permissions change in uid/pid hierarchy
When a new process is launched it ensures that all files under its uid/
and uid/pid hierarchy are accessible by the user/group of that process.
If the directory already exists that means the access permissions have
been already set before, therefore we do not need to reset them again.
This also avoids a race between two processes in the same uid with one
process being launched and walking the uid/ directory while the other
process is being killed and changing the content of that directory. In
such a race the process walking uid/ might find the uid/pid directory of
the process being killed but by the time it tries to set its permissions
the directory might be removed because the process got killed. The
change eliminates the possibility of this race.

Bug: 192421915
Bug: 192512069
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I182298c36f6b0b4580ab59e440bd3aea16f5fbfe
Merged-In: I182298c36f6b0b4580ab59e440bd3aea16f5fbfe
2021-07-07 19:42:25 +00:00
Nikita Ioffe
1f662999e3 Also populate lastUpdateMillis in ActivateFlattenedApexesIfPossible
Test: m
Bug: 192647837
Change-Id: I11dca132168d6a30372d7a68fe590894d3cc5ccf
2021-07-05 16:44:03 +01:00
Treehugger Robot
a436f589ab Merge "init: disable watermark_boost feature" 2021-07-04 08:16:08 +00:00
David Anderson
f8825fafc8 Fix gid not being set in ueventd when device nodes already exist.
The chown() call will fix the uid for pre-existing nodes, but not the
gid. This fix ensures the correct gid is set if needed.

Bug: 187738549
Test: manual test modifying ueventd.rc
Change-Id: I0fadd745a7c57a089fed9afc2572ace597a05396
2021-07-02 20:50:23 -07:00
Daniel Rosenberg
f0d9beb162 libsnapshot: Cleanup iterators
The libsnapshot iterators can all use the same interface instead of
duplicating the interface. We don't have any need for the internal class
variable iterators, so remove them.

Test: Builds, does not impact cow_api_test/cow_snapuserd_test
Change-Id: I5f008401e067a55a57812b7bf101a472ad97df18
2021-07-02 20:53:16 +00:00
Treehugger Robot
4717129e57 Merge "libprocessgroup: Do not remove uid cgroups directory" 2021-07-02 18:28:04 +00:00
Li Li
d0464b0c01 libprocessgroup: Do not remove uid cgroups directory
In some rare cases, race happens between 2 processes in the same uid.

1. Process A is dying
2. system_server calls RemoveProcessGroup() for A
3. Zygote forks Process B with the same uid of A
4. system_server calls MkdirAndChown(uid) for B
5. system_server calls MkdirAndChown(uid, pid) for B

As 2 & 4/5 belong to different threads, 2 might happens before or after
step 4/5, or even in the middle of 4/5. In such a case, 4 or 5 will
fail, leaving process B in wrong (Zygote) group.

The uid dir is only created when the corresponding apps have been
launched at least once. It's reasonable to assume one of them is going
to be launched again. Deleting and recreating the uid dir just slows
down applaunch.

Introducing a new lock in libprocessgroup can also solve the race issue.
But that will slow down the applaunch further.

Therefore, reusing the uid dir is an optimized way to solve the race.

Ignore-AOSP-First: Freezer is not a public feature yet

Bug: 192512069
Bug: 168907513
Test: Kill corresponding apps and check the uid cgroupfs dir
Merged-In: I2e91088f21f45e4eda6c709a4af65ace7e135801
Change-Id: I2e91088f21f45e4eda6c709a4af65ace7e135801
2021-07-02 10:27:00 -07:00
Daniel Rosenberg
83127b73b8 libsnapshot: Add Sequence Ops
This adds the ability to write sequence ops. A Sequence op is a list of
block values in the new image. These ops may have dependencies on data
that is overwritten by future ops, so must be merged in a specific
order, regardless of their order in the cow file.

This patch only introduces the operation. The following patches will
actually make use of it.

Bug: 177104308
Test: Builds
Change-Id: I9162b49e5061079416ac9e5661c8b1245298044b
2021-07-01 20:09:44 -07:00
Treehugger Robot
da2f0aceb5 Merge "Forward HAT and ConfirmationToken to TA on finish." 2021-07-01 23:44:25 +00:00