Commit graph

81664 commits

Author SHA1 Message Date
Kelvin Zhang
786dac3d50 Update some fs_mgr/debuggerd to use getpagesize() instead of PAGE_SIZE
Test: th
Bug: 279808236
Change-Id: I9d30cfe19d2b1a7d624cc5425e4315dc6e3b2ad2
2023-06-27 10:50:07 -07:00
Treehugger Robot
8ec7d3da58 Merge "Revert "snapuserd: Make header_response a state variable."" 2023-06-27 06:55:22 +00:00
David Anderson
e2e8f55b81 Revert "snapuserd: Make header_response a state variable."
This reverts commit d4e035ebc3.

Reason for revert: Breaks incremental OTAs

Change-Id: Ib9703a66b83e08114ca4d11370d669b8bcdf4789
2023-06-27 05:29:20 +00:00
Jooyung Han
c288e14001 Merge "No need to read ro.apex.updatable now" 2023-06-27 00:55:25 +00:00
David Anderson
53bb327f29 Merge "snapuserd: Make header_response a state variable." 2023-06-26 22:51:41 +00:00
David Anderson
b41cd681aa Merge changes I07031e89,I1ba276e1
* changes:
  libsnapshot: Remove direct accesses of CowOperation::source and compression.
  libsnapshot: Add helpers for accessing CowOperation offsets.
2023-06-26 18:39:57 +00:00
Nikita Ioffe
4ad8a68f2d Merge "init selinux.cpp: use a better way to detect if we run in Microdroid" 2023-06-26 18:31:34 +00:00
Treehugger Robot
c5d1978666 Merge "Make libfstab available to APEXes." 2023-06-26 16:29:26 +00:00
Nikita Ioffe
a66adf45aa init selinux.cpp: use a better way to detect if we run in Microdroid
We are now conditionally compiling init binaries & libinit for
Microdroid (adding -DMICRODROID=1 cflag), so instead of checking for the
presence of the /system/etc/selinux/microdroid_precompiled_sepolicy we
can check if the code is compiled for Microdroid.

In a follow-up changes we can split the sepolicy loading logic into 2
separate headers (one for Android and one for Microdroid) and include
the necessary one depending on the target we compile for.

Bug: 287206497
Test: atest MicrodroidTestApp
Change-Id: Id9c837d03a96ff9564688d33955ec85094eee487
2023-06-26 16:43:16 +01:00
Jiakai Zhang
cf16f4d794 Make libfstab available to APEXes.
The ART module needs this library to determine whether to put dexopt
artifacts in dalvik-cache.

Bug: 287958783
Test: m
Change-Id: Idf338702d4f54e9c40c0692ea29e7d83e91aca38
2023-06-23 22:28:49 +01:00
David Anderson
d4e035ebc3 snapuserd: Make header_response a state variable.
header_response is meant to only be true for the first call to
WriteDmUserPayload. Codify this by making it a member variable and
resetting it on each request.

Bug: 288273605
Test: snapuserd_test
Change-Id: Ia125f86b7f22f4801be1e0796e8f85540ed5f31f
2023-06-23 13:14:50 -07:00
David Anderson
cf311bd00f libsnapshot: Remove direct accesses of CowOperation::source and compression.
For the remaining use cases of accessing CowOperation::source and
compression, directly, introduce helper functions, since these fields
will be removed in the v3 format.

Bug: 280529365
Test: cow_api_test
Change-Id: I07031e8968525a7c1314ca45c284e476b51d8104
2023-06-23 13:14:50 -07:00
David Anderson
09ccef4961 libsnapshot: Add helpers for accessing CowOperation offsets.
These helpers avoid manual inspection of CowOperation::source, and
fiddling with block sizes.

Bug: 280529365
Test: cow_api_test
      vts_libsnapshot_test
      apply OTA
Change-Id: I1ba276e155eb8232a3115066caaa11030c171e11
2023-06-23 13:14:50 -07:00
Treehugger Robot
8790a71bc4 Merge "Remove dead code from fs_mgr" 2023-06-23 20:07:09 +00:00
David Anderson
c6d615dd17 Merge "libsnapshot: Add a helper around CowReader::GetRawBytes." 2023-06-23 18:33:44 +00:00
Paul Lawrence
c7998f2abb Remove dead code from fs_mgr
Test: Compiles
Change-Id: I76402758396b658fc1539f81541b162723b709a2
2023-06-23 09:27:55 -07:00
Jooyung Han
918971c69e No need to read ro.apex.updatable now
Bug: 288202251
Test: m
Test: device boots
Change-Id: I97a3c2fab69489cdfbb5103b148194d7e2ee4d1a
2023-06-23 14:22:44 +09:00
David Anderson
27fb5200aa libsnapshot: Add a helper around CowReader::GetRawBytes.
This avoids having to use op->source which will require more work after
the new format lands.

Bug: 280529365
Test: inspect_cow
Change-Id: Iffa18974bb0152dad73d69bb03c683f1aa549031
2023-06-22 20:52:10 -07:00
Treehugger Robot
c7465ab5d2 Merge "Build libsparse and simg2img for Mac OS X as part of Cuttlefish launcher tools" 2023-06-23 02:12:44 +00:00
Treehugger Robot
b190adfc2e Merge "init_kill_services_test: wait 120s for apexd" 2023-06-23 01:07:14 +00:00
A. Cody Schuffelen
0236af54cd Build libsparse and simg2img for Mac OS X as part of Cuttlefish launcher tools
Bug: 288493595
Test: m libsparse simg2img
Change-Id: I9e0c5c77b9b2b5994bf52e1ca9fdb84bc1523d5d
2023-06-22 17:11:37 -07:00
Treehugger Robot
fe4066520e Merge "Only skip checkpointing for freshly formatted ext4" 2023-06-22 23:28:01 +00:00
Daniel Zheng
6c58df5766 Merge "Change HardcodedFlash to add flashtasks" 2023-06-22 20:32:43 +00:00
Daniel Zheng
7e0a31e79d Merge "use FlashingPlan sparse_limit for testing" 2023-06-22 20:32:29 +00:00
David Anderson
9fd1147017 Merge changes Icaeba861,I19007a78,I11863dcb
* changes:
  inspect_cow: Add --show_raw_ops.
  inspect_cow: Switch to gflags.
  libsnapshot: Remove dependence between CowWriterV2 and CowReader.
2023-06-22 20:10:41 +00:00
Steven Moreland
14e7b76dcf init_kill_services_test: wait 120s for apexd
This is likely waiting for the Java garbage collector to run,
and due to the lockless implementation of BinderProxyNativeData
and BpBinder, it's very difficult to efficiently force this
object to be deleted.

Change-Id: I4df667b9b47327967a43d75664fb506b8704f905
Fixes: 285458033
Test: N/A
2023-06-22 18:56:09 +00:00
Daniel Zheng
90fc835d48 Merge "Add flag to disable super optimization" 2023-06-22 18:02:13 +00:00
Daniel Zheng
77ac76c094 Merge "Removing local image lookup from load_buf" 2023-06-22 18:02:06 +00:00
Daniel Zheng
93710811ca Merge "Moving source class declaration" 2023-06-22 18:01:59 +00:00
Daniel Zheng
ba07ef5732 Change HardcodedFlash to add flashtasks
Changing Hardcoded FLash to add flash tasks, also modifying do_flash to
download signature data if a source is provided

Test: fastboot flashall
Change-Id: Ic33bc4076f269d0d48146a3de457a72eedd5e6df
2023-06-22 09:52:08 -07:00
Daniel Zheng
5769b268bf use FlashingPlan sparse_limit for testing
Have get_sparse_limit() return FlashingPlan's sparse limit if set. Used
for testing to compare task lists

Test: fastboot_test
Change-Id: I7ac1eb4dc83a53b3d7aa59aa668a780b4b550664
2023-06-22 09:52:06 -07:00
Daniel Zheng
d62002cf06 Add flag to disable super optimization
Adding flag to turn off the super optimization. Makes for easier testing
as dynamic partitions flash tasks won't be replaced by one flash super
layout task

Test: fastboot flashall --disable-super-optimization
Bug: 194686221
Change-Id: I9142490ecfe587725872e4b734486d3db1728aa7
2023-06-22 09:49:09 -07:00
Daniel Zheng
59c22c33a0 Removing local image lookup from load_buf
The initial logic for adding this in was incorrect. This changed had
allowed us to do fastboot flash dts dt.img on command line. But really
we should enforce that we pass in the path to the image. This change was
added so the command line tool with resemble fastboot-info format which
will support flash dts dt.img (situation where image name and partition
name don't match).

Test: fastboot flash {partition}, fastboot flashall
Bug: 194686221
Change-Id: I62f170e14860d865453ab52793e346fe4066c6d4
2023-06-22 09:49:09 -07:00
Nikita Ioffe
2032b2f6a9 Merge "Introduce microdroid variants of init_first_stage and init_second_stage" 2023-06-22 10:11:31 +00:00
Daniel Rosenberg
2127b87b70 Only skip checkpointing for freshly formatted ext4
"Do not reboot with commit failure when ext4 userdata is wiped" has
caused a regression in cuttlefish on f2fs. Overlay.img rapidly grows to
the full userdata size. This updates that CL to only affect partitions
marked for block based checkpointing.

Test: Boot Cuttlefish, monitor overlay.img for 5 minutes
Bug: 285019395
Change-Id: I7d8634e6535ee1531a0df9fb51c6f9c410cbfe92
2023-06-21 18:56:28 -07:00
David Anderson
8542f3e4bb Merge "libsnapshot: Remove ISnapshotWriter." 2023-06-21 22:41:18 +00:00
Daniel Zheng
7f8fff0360 Moving source class declaration
Moving zipImageSource and localImageSource to header file to be used for
testing purposes

Test: m fastboot
Bug: 194686221
Change-Id: I689e73eb0102d3b2cdd0c4fc232b2b60b9022c47
2023-06-21 14:23:56 -07:00
Roy Luo
7f72b30e65 Merge "fastboot: remove retries on invalid IO iterator in OSX" am: be65e040d4
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2631070

Change-Id: I72e150f757da768780af09bc2484bf21c95a59b5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-21 20:35:30 +00:00
Treehugger Robot
867458fa6b Merge "libdm: don't expect uevent for devices that have never been activated" am: 684a66c8ec
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2628999

Change-Id: Iafd0fd9df3b38ecc1d1ac30dd6d063b7744e987f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-21 20:34:31 +00:00
Roy Luo
be65e040d4 Merge "fastboot: remove retries on invalid IO iterator in OSX" 2023-06-21 19:33:29 +00:00
Treehugger Robot
684a66c8ec Merge "libdm: don't expect uevent for devices that have never been activated" 2023-06-21 19:05:56 +00:00
Nikita Ioffe
55dd32538f Introduce microdroid variants of init_first_stage and init_second_stage
These variants will compile with -DMICRODROID flag, which will allow us
to exclude init features that are not needed for Microdroid, and
introduce features that only work in Microdroid.

Bug: 287206497
Test: build com.android.virt APEX
Change-Id: Ib9af0cfcdf06c70fc39e6e6ac8ef07bb69982969
2023-06-21 16:44:40 +01:00
Jiyong Park
e09de2a5ca libdm: don't expect uevent for devices that have never been activated
Previously, libdm ensured that uevent will be generated when a dm device
is deleted. However, there actually are cases where uevent can't be
expected; for example, if an empty dm device is created, but then gets
deleted without being activated, then there should be no uevent upon
deleting because there actually is nothing to remove from /dev. (dm
device gets added to /dev only if it is activated).

Actually such a case exists in apexd. As a performance optimization, it
proactively creates empty dm devices for all APEXes it scanns. But
some of them don't ever get activated if the APEX is already in a
dm-verity protected block device (i.e. the pre-instaled APEX is the
latest one). In that cases, the empty dm devices are deleted at the end
of the boot process as a clean up.

The libdm triggered error during the clean up, because there was no
uevent generated for the empty dm devices. This has triggered a lot of
false alarms to the apex team.

This CL fixes this by ensuring uevent only for activate dm devices. If
the dm device doesn't show up in /dev, we just delete the in-kernel
object and don't expect it to generate uevent for it - which actually is
the kernel's behavior.

Bug: 286176029
Test: build and run aosp_cf_x86_64_phone. observe dmesg.

Before the change:
I apexd   : Deleting unused dm device com.android.hardware.core_permissions
E apexd   : Didn't generate uevent for [com.android.hardware.core_permissions] removal
W apexd   : Failed to delete dm-device com.android.hardware.core_permissions

After the change:
I apexd   : Deleting unused dm device com.android.hardware.core_permissions
<no error or warning logs>

Change-Id: I52042de7d4d9ab62e6a13428c32a67e13395d1b5
2023-06-22 00:43:32 +09:00
Roy Luo
d1d5f5ab69 fastboot: remove retries on invalid IO iterator in OSX
When IOServiceGetMatchingServices returns an invalid
iterator, IOIteratorReset doesn't help. Break the loop
to prevent being stuck in the reset loop forever.
This should be fine as the open_device() call in the
upper layer is already doing retries.

Bug: 286495045
Test: fastboot update
Change-Id: Ia58fa9285640be34aa22cd77e4f58cc9092679a4
2023-06-20 21:44:53 +00:00
Eric Biggers
c7f7743f4f Merge "Remove write permission from file mode of top-level user dirs" am: 46477f1d82
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2620458

Change-Id: Idc00da3c1d5ce7f5ffc8a3f7942b947fe1b59833
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-20 17:54:45 +00:00
Eric Biggers
46477f1d82 Merge "Remove write permission from file mode of top-level user dirs" 2023-06-20 17:15:24 +00:00
David Anderson
17421a93ba inspect_cow: Add --show_raw_ops.
This bypasses CowReader and shows ops directly from CowParserV2. This
will come in handy once CowOperation is versioned and CowReader will be
translating from older versions to new versions.

Bug: 280529365
Test: inspect_cow
Change-Id: Icaeba86105c31c4dfe2812309a4028dd1d0248c0
2023-06-15 11:18:25 -07:00
David Anderson
691b78a0fd inspect_cow: Switch to gflags.
gflags is a lot cleaner to use than getopt, and we don't really need any
advanced argument parsing.

Test: inspect_cow
Bug: N/A
Change-Id: I19007a787a2e5cd3a67486c7949b34ba76f762e4
2023-06-15 11:01:56 -07:00
Treehugger Robot
614857c782 Merge "Fix LruCache, allow std:string caching" am: 1477714262
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2627034

Change-Id: I633542894afa2dd1a8a6f84c222097bd41a4e68e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-15 15:05:17 +00:00
Treehugger Robot
1477714262 Merge "Fix LruCache, allow std:string caching" 2023-06-15 14:31:47 +00:00