Commit graph

48470 commits

Author SHA1 Message Date
Yifan Hong
5576f7cc13 libsnapshot: MapPartitionWithSnapshot: fix timeout
The MapPartitionWithSnapshot call doesn't respect params.timeout.
Fix it.

Test: libsnapshot_test
Change-Id: I2c5a2889e4687449319bb2018e39405682b458a6
2019-09-05 15:14:34 -07:00
Yifan Hong
caaf9a617a libsnapshot: require ex lock for {Create}{CowImage,Snapshot} / DeleteSnapshot
Create / Deleting the COW image / snapshot changes states, so it makes
sense to require an exclusive lock before doing so. If caller doesn't hold
an exclusive lock, parallel calls to MapCowImage / MapSnapshot / UnmapCowImage /
UnmapSnapshot may have weird results.

Test: libsnapshot_test

Change-Id: I4be660df1059ec24144f8baf43a1c8c05d9e372b
2019-09-05 15:14:34 -07:00
Yifan Hong
27fb95dedf libsnapshot: Refactor: add {Create,Map,Unmap}CowImage
Move operations on image manager in *Snapshot functions to their own
functions for finer granularity in control. *Snapshot functions only
changes snapshot state and snapshot devices, but not the supporting
devices.

Now, MapSnapshot can take a customized COW device path. We will have
a more complicated stack for the COW device in upcomming CLs.

Also, Change SnapshotManager::CreateSnapshot's signature to
accept a SnapshotStatus struct that includes all sizes, so that
cow_partition_size and cow_file_size can also be written to the snapshot
status file.

Test: libsnapshot_test

Change-Id: I388ecd4bcfbfcc3f379ecb6993615234f4fbcb4e
2019-09-05 15:14:34 -07:00
Yifan Hong
dccd6b3389 Merge "libsnapshot: Refactor CreateLogicalAndSnapshotPartitions" 2019-09-04 21:55:39 +00:00
Yifan Hong
d6c426c0f5 Merge "liblp: Indicate usable regions in ResizePartition" 2019-09-04 21:53:57 +00:00
Treehugger Robot
2dc25441e2 Merge "CreateSnapshot: reduce zero-filling for CoW images" 2019-09-04 21:19:44 +00:00
Christopher Ferris
c3163e7664 Merge "Add test mapping to run the libunwind tests." 2019-09-04 20:28:37 +00:00
Yifan Hong
48eb2ee176 Merge "libsnapshot: Don't accidentally delete snapshot when collapsing" 2019-09-04 18:53:23 +00:00
Yifan Hong
09a0c98506 Merge "libsnapshot: Allow multiple calls to FinishedSnapshotWrites" 2019-09-04 18:52:30 +00:00
Yifan Hong
a93ac6b9c8 libsnapshot: Allow multiple calls to FinishedSnapshotWrites
If update_engine crashes at certain point, it may
call FinishedSnapshotWrites multiple times. Allow
this to happen.

Test: apply OTA
Change-Id: Ib36cfe38328fd5d6ca408c97024c81569a4bd440
2019-09-03 21:07:30 -07:00
Yifan Hong
d65020d05e liblp: Indicate usable regions in ResizePartition
- Open up GetFreeRegions() API.
- Add a new argument, free_region_hint, to ResizePartitions(). It
  indicates the regions that extents can be allocated to.
- Expose Interval::Intersect functions. libsnapshot needs the algorithm
  to intersect extents to find out the free regions for COW partitions.

Test: liblp_test

Change-Id: I0c079c0e919aa7b0627eb76a071a7cc2a281d692
2019-09-03 20:08:28 -07:00
Yifan Hong
31fda7e476 libsnapshot: Refactor CreateLogicalAndSnapshotPartitions
Create SnapshotManager::MapPartitionWithSnapshot that deals
with one partition so that the code can be re-used later.

Test: libsnapshot_test

Change-Id: Iba36e6c05f8541397323361f7ceb62a6472d2e1c
2019-09-03 19:45:22 -07:00
Yifan Hong
27139799ff libsnapshot: Don't accidentally delete snapshot when collapsing
Test: libsnapshot_test
Change-Id: Ie84546f90f7f186bda88f19f7d29ad437ce97aa8
2019-09-03 16:07:31 -07:00
Christopher Ferris
7aba5142e9 Add test mapping to run the libunwind tests.
Created a special target, libunwindstack_unit_test, that doesn't
include the test that dlopen's a shared library. It appears atest
doesn't understand how to handle the require keyword.

Also, move the shared library into the libunwindstack_test directory
itself.

Test: Ran atest libunwindstack_unit_test.
Change-Id: I967919b1d74a08669b61d0363d80861685725609
2019-09-03 13:32:51 -07:00
Yifan Hong
a9ffef27e1 Merge "libsnapshot: Record COW size(s) in snapshot status file" 2019-09-03 16:43:49 +00:00
Christopher Ferris
0ac9b9a894 Merge "Add test of undefined return address." 2019-09-03 16:41:02 +00:00
Tom Cherry
0589aa4265 Merge "init: Always reap processes before handling properties" 2019-09-03 16:35:27 +00:00
Alessio Balsini
396a4f279e CreateSnapshot: reduce zero-filling for CoW images
Instead of zero-filling the whole image, only clean the dm-snapshot
metadata header of the CoW file.

Zero-filling a large image may take a long time, and this is a safe, but
not necessary operation if the operation is intended to prepare an
initial CoW file that will be used with a dm-snapshot device.
According to the Linux kernel code, only the first 32 bits of the CoW
file is used to detect if the dm-snapshot device under creation will be
at an initial state or the continuation of a previous dm-snapshot.
CREATE_IMAGE_RESET_SNAP is a flag that reduces the zeroing of the image
file to the first file chunk.

Change-Id: Ibc9fb3b6d19666a92125c988687ff8dacfad47be
Depends-On: I242e57a9a622fbb738bf82f8a260af1b13810069
Bug: 139378014
Test: manual, snapshot_test
Signed-off-by: Alessio Balsini <balsini@google.com>
2019-09-02 11:24:33 +00:00
Martin Stjernholm
0c100685dc Merge changes from topic "art-without-bionic"
* changes:
  Include com.android.runtime in the "runtime" linker namespace.
  Update logic for detecting pre-apexd services to check that the ART APEX is mounted.
  Update paths and names for the new ART APEX.
2019-09-02 10:28:30 +00:00
Treehugger Robot
dec467f271 Merge "Fix typo" 2019-08-31 13:39:37 +00:00
Christopher Ferris
7138232f57 Add test of undefined return address.
Add a specific test that __libc_init is the last frame in a stack
when run on device. In addition, it verifies that the return address
register is marked as undefined given the unwind.

Bug: 140008396

Test: New unit test passes on arm/arm64 (taimen device).
Test: New unit test passes on x86 (cuttlefish).
Test: New unit test passes on x86_64 (modified bionic/tests/run-on-host.sh)
Change-Id: Iefc151a7dbf52ab083c2bb78bad3d38b4e9e1254
2019-08-30 23:29:34 -07:00
Treehugger Robot
c9cddde018 Merge "Revert "Reland "libutils: Introduce StaticString16"""" 2019-08-31 04:00:15 +00:00
Kevin Han
1270e4fbf1 Revert "Reland "libutils: Introduce StaticString16"""
This reverts commit c55ac92bd6.

Reason for revert: Breaks down-stream branches. See b/140315617

Change-Id: I4937fdf4bdcc7a44d5f10700ecf2d5e96aef7d27
Merged-In: I8da93f2c9b95183e32d4a2ea895f90c449abbe4d
2019-08-30 23:50:38 +00:00
Tom Cherry
905a5df83d init: Always reap processes before handling properties
There is a race that manifests like this:

1) A service dies (not processed by init yet).
2) service_manager processes death notification.
3) service_manager gets checkService and calls init to start service.
4) init gets the ctl.start / ctl.interface_start for the service
   but the service already appears started, so it does nothing.
5) init gets sigchld, but doesn't do anything else to restart the
   service

We can avoid all of this if we already reap pending processes before
handling properties in the main loop of init.  Since reaping the
services calls waitid(), there's no race even if the signalfd for
sigchld hasn't triggered yet.  It also won't cost us much efficiency,
since it's only a single system call.

Test: CF boots, init unit tests pass
Change-Id: Ie24ef406055b283797b41b1821c8ebcccead4db4
2019-08-30 14:20:05 -07:00
Treehugger Robot
d3fa47bb05 Merge "Reland "libutils: Introduce StaticString16""" 2019-08-30 20:42:14 +00:00
Paul Lawrence
b2c2d6907f Fix typo
Test: builds
Change-Id: I4b48e8b3d457382579216482249e734f74768c71
2019-08-30 11:15:58 -07:00
Vic Yang
c55ac92bd6 Reland "libutils: Introduce StaticString16""
This time with old branches excluded.

Bug: 138856262
Test: Run unit tests.
Change-Id: Id0bb1d54b71e38244d64f1b684db1fda81de854c
Merged-In: I8da93f2c9b95183e32d4a2ea895f90c449abbe4d
2019-08-30 11:01:27 -07:00
Martin Stjernholm
391332d276 Include com.android.runtime in the "runtime" linker namespace.
This is a temporary fix to keep the Bionic-associated libraries accessible
in the runtime namespace, pending a proper namespace split.

Test: Build & boot with taimen_hwasan-userdebug
Bug: 139408016
Bug: 139916951
Exempt-From-Owner-Approval: Approved internally
Change-Id: I27069b20f7c7068b931340f548b284ce1676466c
Merged-In: I27069b20f7c7068b931340f548b284ce1676466c
2019-08-30 17:47:31 +01:00
Martin Stjernholm
cacf04351f Update logic for detecting pre-apexd services to check that the ART APEX is
mounted.

Necessary to make e.g. bootanimation work, which depends on (at least)
libandroidicu.so in the ART APEX.

Test: Build & boot
Bug: 135753770
Exempt-From-Owner-Approval: Approved internally
Change-Id: Ibab4f5f7a243d0815b9c70a537bae8d77dee2fbb
Merged-In: Ibab4f5f7a243d0815b9c70a537bae8d77dee2fbb
2019-08-30 17:47:31 +01:00
Martin Stjernholm
df96e1f25c Update paths and names for the new ART APEX.
Test: Build & boot
Test: atest CtsJniTestCases
Bug: 135753770
Exempt-From-Owner-Approval: Approved internally
Change-Id: Ic59b7bc8aae7ce521cf3ec9df4ab72aa611d0b75
Merged-In: Ic59b7bc8aae7ce521cf3ec9df4ab72aa611d0b75
2019-08-30 17:47:31 +01:00
Treehugger Robot
cc746b5193 Merge "libsnapshot: GetSnapshotExtraDeviceName" 2019-08-29 23:48:18 +00:00
Treehugger Robot
2fa089be00 Merge "liblp: convert more functions to use string_view (#3)" 2019-08-29 23:31:48 +00:00
Vic Yang
d0e02d58d9 Merge "Revert "libutils: Introduce StaticString16"" 2019-08-29 22:52:41 +00:00
Vic Yang
86eaa8de78 Revert "libutils: Introduce StaticString16"
This reverts commit d4cb489434.

Reason for revert: Breaking aosp_bonito-userdebug

Change-Id: Iea72f39d40f476002ce0ad6b5ce3b4e1ca570de7
2019-08-29 22:47:07 +00:00
Yifan Hong
65db930d5a libsnapshot: Record COW size(s) in snapshot status file
The COW device consist of two parts: empty space in
super and the loop device. Record it in the snapshot
status file so that MapSnapshot can determine which
devices needs to be mapped.

Test: builds
Change-Id: I08fb051c080802842d2f5b43c2adeed4f04b7c5f
2019-08-29 14:53:50 -07:00
Yifan Hong
9fca50f356 libsnapshot: GetSnapshotExtraDeviceName
Return the name with -inner suffix.

Test: builds
Test: libsnashot_test
Change-Id: Idd66d0c3f1a625af3d73b7a8bdff32b69e501737
2019-08-29 14:49:11 -07:00
Yifan Hong
c205f585e7 liblp: convert more functions to use string_view (#3)
Test: builds

Change-Id: Ia448993ff61d46ae2280e3d3c02b5e84dd51f37c
2019-08-29 14:48:40 -07:00
Mark Salyzyn
7f17baa158 Merge "fs_mgr: overlayfs: test: noatime on rw mounts only" 2019-08-29 21:40:46 +00:00
Mark Salyzyn
6f07a8af11 fs_mgr: overlayfs: test: noatime on rw mounts only
Regression from commit 808763e825
("fs_mgr: overlayfs: noatime").  Test fails on some targets
that do not follow our advise to mount noatime for all partitions.
blueline mounts the system partitions relatime.  In the grand
scheme this is not a problem because we never remount these
partitions read-write because of the overlayfs integration.

Filter out read-only mounts from those enumerated for noatime,
those failures do not concern us in the context of this test.

This test expected to fail if CtsOsTestCases EnvironmentTest fails.

Test: adb-remount-test.sh
Bug: 140253722
Bug: 140014856
Change-Id: I778e7f539ac3f3d6495867e264767f2af25e11c7
2019-08-29 14:12:39 -07:00
Vic Yang
b38616bc70 Merge "libutils: Introduce StaticString16" 2019-08-29 20:57:16 +00:00
Tom Cherry
390b48bad2 Merge "fastboot: preserve partition_type if wants_wipe=true" 2019-08-29 20:24:52 +00:00
Treehugger Robot
b5440039ac Merge "fastboot: Initialize UploadInner dsize value to 0" 2019-08-29 18:39:31 +00:00
Wei Wang
2b73b60c66 Merge "Let blkio cgroup follow sched_policy" 2019-08-29 18:13:02 +00:00
Treehugger Robot
b4eedd9ccd Merge "init: -1 log for control message error paths." 2019-08-29 17:53:47 +00:00
Treehugger Robot
a133690fc4 Merge "fs_mgr: overlayfs: noatime" 2019-08-29 16:49:04 +00:00
Treehugger Robot
059b8dacfd Merge "ld.config.txt: remove link from rs to vndk" 2019-08-29 16:18:27 +00:00
Steven Moreland
9800ad839a init: -1 log for control message error paths.
Fixes: 140136969
Test: check logs
Change-Id: Id80f59927b44d1026c6e3389c80ca96baf0733c4
2019-08-29 16:08:36 +00:00
Tom Cherry
c70fc1cbfd Merge "Start serial console at the 'init' trigger" 2019-08-29 15:53:46 +00:00
qiwu chen
325ba6ffa8 fastboot: Initialize UploadInner dsize value to 0
We must initialize UploadInner dsize value to 0, in case
stuck in ReadBuffer when receive DATA packet which dsize
is 0 or non DATA type packet. This will lead to fastboot
hang up unless USB unplugged.

Change-Id: I1e9752585c3d1013b1b1da38ead9ba4c532c2d34
Signed-off-by: qiwu chen <qiwuchen55@gmail.com>
2019-08-29 14:56:19 +08:00
cfig
f60613b4e8
fastboot: preserve partition_type if wants_wipe=true
originally if wants_wipe=true, program will erase and format partitions,
but after fb->Erase(), partition type should be raw(all 0xFFs),
then following fb_perform_format() will miss its original partition_type
Now we call fb_perform_format() with original fs type to keep the
partition consistent after wiping.

Change-Id: Ic778850588d5dd6fee23169d20c26bcbaa510627
2019-08-29 13:19:29 +08:00