Commit graph

78524 commits

Author SHA1 Message Date
Victor Chang
1498382581 Revert "Add ::1 to localhost in etc/hosts"
Revert submission 2291455-localhost_v6

Reason for revert: b/258627476
Reverted Changes:
Icd11fab47:[Test] Update test to comply with etc/hosts change...
Ibcee52a14:Add ::1 to localhost in etc/hosts

Bug: 258627476
Change-Id: I42c8b0aebdbd8b73a90606c0a999f25d8d071cd1
2022-11-11 12:26:49 +00:00
Ken Chen
7e6f2a44db Add ::1 to localhost in etc/hosts
::1 is IPv6 loopback address.

Bug: 256507503
Test: $ adb shell /data/dnschk localhost
      # localhost (via nethandle 0):
      127.0.0.1
      ::1
Change-Id: Ibcee52a14143856db50fca301c48ea9e2591914b
2022-11-09 17:05:35 +08:00
Bart Van Assche
5e524e28ee Merge "init: Introduce class InterprocessFifo" 2022-10-25 23:33:28 +00:00
Treehugger Robot
c052460659 Merge "fs_mgr_overlayfs: Fallback to allocate scratch on super if /data failed" 2022-10-25 20:56:59 +00:00
Akilesh Kailash
7952a7b081 Merge "libsnapshot: Do not store CowOperations in memory during writes" 2022-10-25 20:00:05 +00:00
Yi-Yo Chiang
1c76ccb554 fs_mgr_overlayfs: Fallback to allocate scratch on super if /data failed
b/255593675 showed that gsid can fail to allocate scratch on /data on
some device configurations. Before we can locate the root cause,
gracefully fallback to previous "scratch-on-super" logic in case of
error.

Bug: 255593675
Test: Presubmit
Test: manual test
Change-Id: I229ab51f11fa354a6f231c4d083dd6329d6a9579
2022-10-26 03:17:37 +08:00
Bart Van Assche
1693f420d4 init: Introduce class InterprocessFifo
Prepare for introducing a second interprocess communication channel by
introducing the class InterprocessFifo. Stop using std::unique_ptr<> for
holding the pipe file descriptors. Handle EOF consistently.

Bug: 213617178
Change-Id: Ic0cf18d3d8ea61b8ee17e64de8a9df2736e26728
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-10-25 06:56:50 -07:00
Akilesh Kailash
b71b32dc83 libsnapshot: Do not store CowOperations in memory during writes
The only use case of storing COW operations in memory
was to calculate SHA256 sum during Finalize() - However,
we haven't been doing that since day one of libsnapshot_cow library.

This consumes peak memory ~14mb on an incremental OTA which has 700k+
COW operations writes on one partition.

We can rather use this memory for Async operations where we will have
to cache the buffers.

Bug: 254188450
Test: Incremental OTA
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I2165ed95ff26a9dfb465dc3120df61bb02eee27b
2022-10-25 06:59:36 +00:00
Treehugger Robot
ce45c8ffd8 Merge "Replaced -1 with EXIT_FAILURE and validated confirmationui service status after registering it with CHECK_EQ macro." 2022-10-25 02:52:09 +00:00
Nikita Ioffe
0543f0649c Merge "Switch to tombstoned.microdroid" 2022-10-24 23:25:43 +00:00
David Anderson
9d8637289b Merge "snapshotctl: Add a test-blank-ota command for development." 2022-10-24 20:36:58 +00:00
Rajesh Nyamagoud
4092a77774 Replaced -1 with EXIT_FAILURE and validated confirmationui service
status after registering it with `CHECK_EQ` macro.

Bug: b/205760172
Test: atest VtsHalConfirmationUITargetTest
Change-Id: I00f5a09ca525e3abb63a5d1f404fb6f3daed9442
2022-10-24 19:25:35 +00:00
David Anderson
d62bdd2974 snapshotctl: Add a test-blank-ota command for development.
The test-blank-ota command is for iterating on changes to snapuserd or
the Virtual A/B boot flow, which is normally very time consuming to
test.

It works by creating a partial OTA outside of update_engine, purely
through SnapshotManager calls. Every partition except system is
preserved. system is "updated" entirely with copy operations. The entire
"OTA" takes about ten seconds.

Tested on cuttlefish, but a physical device should work as long as
physical partitions are flashed to both slots beforehand.

The big limitation is that since update_engine does not run, there is no
merge action on reboot. This can be done manually with "snapshotctl
merge" however.

This type of tool could be easily used in the future for quickly testing
specific bugs or performance ideas in snapuserd.

Bug: N/A
Test: launch_cvd
      adb wait-for-device root
      adb shell snapshotctl test-blank-ota
      adb reboot
      adb wait-for-device root
      adb shell snapshotctl dump
Change-Id: I5911440cbe14ee909905a0b0fc17da95ba4c5d68
2022-10-24 11:49:25 -07:00
Nikita Ioffe
75be784fba Switch to tombstoned.microdroid
The long term plan is to completely remove tombstoned from microdroid (b/243494912), however it might take time some time to implement it.

In the meantime, we've recently removed cgroups support from the microdroid kernel. This means that starting a tombstoned results in a bunch of non-fatal errors in the logs that are related to the fact that tombstoned service specifies task_profiles.

To get rid of these error messages we temporary add a microdroid variant of the tombstoned (tombstoned.microdroid) that doesn't specify task_profiles.

Bug: 239367015
Test: microdroid presubmit
Change-Id: Ia7d37ede2276790008702e48fdfaf37f4c1fd251
2022-10-24 15:56:33 +00:00
Treehugger Robot
882c1681df Merge "libfstab_fuzzer: fuzz TransformFstabForDsu() and skip mount logic" 2022-10-24 09:48:05 +00:00
Nikita Ioffe
537ab23872 Merge "init: skip cgroup/task_profiles configuration if cgroups are disabled" 2022-10-24 07:14:12 +00:00
Treehugger Robot
1f50b0edb1 Merge changes Ia080132f,I0d344b5f
* changes:
  init: Fix the implementation of the task_profiles keyword
  Add __ANDROID_API_[STU]__ definitions
2022-10-22 03:31:22 +00:00
Bart Van Assche
77f3fe5e68 init: Fix the implementation of the task_profiles keyword
The documentation added by commit c9c0bbac53 ("init: Add task_profiles
init command") mentions that the task_profiles keyword sets process
attributes. Make the implementation of that keyword match the
documentation.

Change-Id: Ia080132f16bfc2488f8c25176d6aed37a2c42780
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-10-21 15:34:19 -07:00
Bart Van Assche
4029b05b04 Add __ANDROID_API_[STU]__ definitions
Bring the host_init_stubs.h header file in sync with the
<android/api-level.h> header file.

Change-Id: I0d344b5f89f909e5315a0075773efd0b725a72a4
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-10-21 15:33:09 -07:00
Treehugger Robot
202a688068 Merge "libutils: Include limits for std::numeric_limits::max" 2022-10-21 17:21:01 +00:00
Nikita Ioffe
c2b1654c11 init: skip cgroup/task_profiles configuration if cgroups are disabled
We are planning to remove cgroups from the Micrdroid kernel, since the
entire VM belongs exclusively to a single owner, and is in the control
of the cgroups on the host side.

This patch expoxes CgroupAvailable API from libprocessgroup, and changes
init to query the CgroupAvailable API before doing any
cgroups/task_profiles related work.

Bug: 239367015
Test: run MicrodroidDemoApp
Test: atest --test-mapping packages/modules/Virtualization:avf-presubmit
Change-Id: I82787141cd2a7f9309a4e9b24acbd92ca21c145b
2022-10-21 13:14:23 +01:00
Yi-Yo Chiang
40a8223d34 libfstab_fuzzer: fuzz TransformFstabForDsu() and skip mount logic
These functions contain complex logic and parse user input. It shall be
valuable to fuzz these functions to prevent regression.

Bug: 254832225
Test: Build and run the fuzzer
Change-Id: I21099c3fc1c226f95a0f8f996bb751030e0c59bc
2022-10-21 19:51:25 +08:00
Biswapriyo Nath
9e25bf0136 libutils: Include limits for std::numeric_limits::max
This fixes the following error:
core/libutils/String8.cpp:316:67: error: incomplete type 'std::numeric_limits<long long unsigned int>' used in nested name specifier
  316 |         if (static_cast<size_t>(n) > std::numeric_limits<size_t>::max() - 1 ||
      |                                                                   ^~~

Change-Id: I80cdd2442e2798c37e066e3fdeee7dd5ac34b669
2022-10-21 10:26:08 +05:30
Tri Vo
7014fa9fa3 Merge "Changes to adapt confirmationui AIDL spec." 2022-10-20 16:51:56 +00:00
Bart Van Assche
51706e7718 Merge "init/epoll: Stop using smart pointers" 2022-10-20 16:36:05 +00:00
Bart Van Assche
72b884ba91 Merge "init/epoll: Make Epoll::Wait() easier to use" 2022-10-20 16:35:49 +00:00
Bart Van Assche
44d7397b98 Merge "init/epoll: Switch to aggregate initialization" 2022-10-20 16:34:58 +00:00
Bart Van Assche
5c7dc40926 Merge "init: Improve readability of the code in SecondStageMain()" 2022-10-20 16:34:21 +00:00
Bart Van Assche
dcd23dfc58 init/epoll: Stop using smart pointers
Change the type of 'handler' from std::shared_ptr<Handler> into Handler.
This change is safe since a previous CL moved the handler calls from the
Epoll::Wait() caller into Epoll::Wait() itself.

Bug: 213617178
Change-Id: Ife79e6863536b96ee4bb3cd778f6b0b164a95fed
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-10-20 09:32:51 -07:00
Bart Van Assche
bc5c4a4659 init/epoll: Make Epoll::Wait() easier to use
Invoke the callback functions from inside Epoll::Wait() instead of
returning a vector with pointers to callback functions. Remove handlers
after handler invocation finished to prevent that self-removal triggers
a use-after-free.

The CL that made Epoll::Wait() return a vector is available at
https://android-review.googlesource.com/c/platform/system/core/+/1112042.

Bug: 213617178
Change-Id: I52c6ade5746a911510746f83802684f2d9cfb429
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-10-20 09:32:51 -07:00
Bart Van Assche
a1c8a622b2 init/epoll: Switch to aggregate initialization
Make it easier to verify for humans that all data structure members are
initialized. No functionality is changed.

Bug: 213617178
Change-Id: I1ce2af566dba51f2032f2e7518576a67e666d12e
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-10-20 09:32:51 -07:00
Bart Van Assche
4842650043 init: Improve readability of the code in SecondStageMain()
Change the type of epoll_timeout from
std::optional<std::chrono:milliseconds> into std::chrono::milliseconds.
No functionality is changed.

Bug: 213617178
Change-Id: Ieb150e0aeabdb79c8da4649875ea3ed59297343b
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-10-20 09:32:51 -07:00
Yi-yo Chiang
cc7ddc04f9 Merge "Revert "fs_mgr_overlayfs: Revert to use /data only if VAB"" 2022-10-20 08:11:57 +00:00
Tri Vo
a693071690 Merge "Trusty IRemotelyProvisionedComponent v3 HAL implementation" 2022-10-20 02:43:12 +00:00
Treehugger Robot
9c3113ab46 Merge "init/epoll: Fix a potential use-after-free" 2022-10-20 00:38:06 +00:00
Akilesh Kailash
ad5cc05ca2 Merge "libsnapshot: Changes to AddCopy() API" 2022-10-19 20:56:20 +00:00
Akilesh Kailash
b23bf16efc libsnapshot: Changes to AddCopy() API
If the copy blocks are contiguous, add a third
argument which takes the number of blocks
which are contiguous. With this, update engine
can call the API in one shot for all the
contiguous COPY operations.

This is required for batching the I/O
for async writes.

This should still continue to support the existing
API where we pass one COPY block at a time.

Bug: 254188450
Test: Incremental OTA from A->B with new API changes in A
      Incremental OTA from A->B with plain VAB
      cow_api_test
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I7edc52a152e02de28a44ef1dc2c88b76a28c4109
2022-10-19 17:55:52 +00:00
Bart Van Assche
b0177a0828 init/epoll: Fix a potential use-after-free
If UnregisterHandler() is called from inside a handler for an event that
has not yet been processed then that will result in a use-after-free.
Fix this by passing file descriptors to epoll_ctl() instead of pointers
to map elements.

Bug: 213617178
Change-Id: Ie62e3a299af964271ec24cd8fc2e794042b77ee6
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-10-18 16:34:12 -07:00
Treehugger Robot
9457a9ab72 Merge "init: Introduce Epoll::SetFirstCallback()" 2022-10-18 23:29:50 +00:00
Akilesh Kailash
63190d2e3a Merge changes I7681e9a4,If84ff730
* changes:
  libsnapshot: Refactor compress function
  libsnapshot: Refactor code
2022-10-18 21:58:16 +00:00
Treehugger Robot
6314ba7f76 Merge "init/epoll_test: Improve this test" 2022-10-18 21:08:00 +00:00
Treehugger Robot
7facdcca3d Merge "Remove an obsolete workaround." 2022-10-18 17:59:09 +00:00
Akilesh Kailash
1119e8e018 libsnapshot: Refactor compress function
Move compress() function to a dedicated file.
This is in preparation for variable block size
compression and async writes.

No change in functional logic.

Bug: 254188450
Test: Full OTA Pixel
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I7681e9a4d884eac1ccbf8adeb1fc6bd1a9fedfa6
2022-10-18 16:49:02 +00:00
Akilesh Kailash
e8f6a126fb libsnapshot: Refactor code
Move all files related to libsnapshot_cow library to
a seperate directory. Libsnapshot directory is getting
crowded and we will be adding more files to this library
with async writes.

No changes to any logic.

Bug: 254188450
Test: Full OTA on Pixel
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: If84ff730d477c85a8ef57864d2185f2f897cf8e0
2022-10-18 16:48:33 +00:00
Elliott Hughes
06a839fc77 Remove an obsolete workaround.
Bug: http://b/29412086
Test: treehugger
Change-Id: I3a61db8da234b4c150816af264d796da7dfe0af6
2022-10-18 16:31:04 +00:00
Bart Van Assche
a2c160449b init: Introduce Epoll::SetFirstCallback()
Prepare for optimizing Epoll::Wait() by moving the
ReapAnyOutstandingChildren() call into Epoll::Wait(). No functionality
is changed.

Bug: 213617178
Change-Id: I280ea0069ed29cf323e4177ec500b30b900f7c8d
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-10-18 09:17:55 -07:00
Bart Van Assche
20954a8e34 init/epoll_test: Improve this test
Add a move constructor in the CatchDtor class. Check the .emplace()
result. Simplify the destructor. Initialize handler_invoked. Explain the
purpose of this test.

Bug: 213617178
Change-Id: I4d6f97dbb2705a2f2dd78e449ae8de74e90b102f
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-10-18 09:17:55 -07:00
Treehugger Robot
3ea0f312f5 Merge "Use ro.product.vendor.device to determine if running on Cuttlefish" 2022-10-18 11:07:50 +00:00
Yi-yo Chiang
956a45485a Revert "fs_mgr_overlayfs: Revert to use /data only if VAB"
This reverts commit c540ab9bf8.

Reason for revert: root cause is fixed

Bug: 253207748
Test: TH run g3-app-compat-main
Change-Id: I44c2535508a5718a823cdd61ad1938bba739c2a0
2022-10-18 09:43:20 +00:00
Yi-yo Chiang
eb88e7b677 Use ro.product.vendor.device to determine if running on Cuttlefish
Similar reasoning as aosp/2255456. ro.product.device could be overridden
by GSI if system.img was replaced with GSI.
Use ro.product.vendor.device, which comes from the vendor.img, to
determine the "device" type.

Bug: 243116800
Test: adb-remount-test on cuttlefish
Change-Id: Ib4a956047ef46d8e4837b27334f8d58162d4fa2a
2022-10-18 07:34:45 +00:00