Commit Graph

52589 Commits

Author SHA1 Message Date
Josh Gao 27512c9e49 adb: add host tool to check for WinUSB descriptor.
Bug: http://b/68993980
Test: manual
Change-Id: I97395c9738a671dd136c6cf66f88fdb769ec7227
2019-09-05 15:56:54 -07:00
Yifan Hong f35687df6e libsnapshot: MapPartitionWithSnapshot cleanup itself if failed
When we run MapPartitionWithSnapshot, intermediate devices aren't
cleaned up if the call fails. Hence, record these intermediate devices
we have created along the way using the new AutoDevices class. Upon
failure, the AutoDevices object will be destroyed, and all the
intermediate devices will be deleted from device mapper or image
manager. Upon success, AutoDevices::Release() makes sure the
intermediate devices aren't deleted.

Test: libsnapshot_test

Change-Id: Iff4c1297528288a27765c0224b67254b68c89776
2019-09-05 15:14:34 -07:00
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
Colin Cross 6dfc460a41 Use installed paths of vndk libraries for ld.config.txt
The installed file name of modules may not match the module name.
Use module-installed-files to get the installed file name.

Bug: 117607748
Test: m checkbuild
Test: only libprotobuf-cpp-*-3.9.1.so changed in ld.config.R.txt
Change-Id: I83b7519f344b65b6cd98c4cabcf9bce0e753ba92
Merged-In: I83b7519f344b65b6cd98c4cabcf9bce0e753ba92
2019-09-05 14:46:16 -07:00
Colin Cross cfcc0b0337 Adapt to google::protobuf::int64 type change
Protobuf 3.9.1 redefines google::protobuf::int64 from long long to
int64_t, which is sometimes long and sometimes long long.  Use PRId64
to print it.

Bug: 117607748
Test: m checkbuild
Change-Id: I6699cfdb0f0424aa3e1c98b59d941beb9f133055
Merged-In: I6699cfdb0f0424aa3e1c98b59d941beb9f133055
2019-09-05 14:46:16 -07:00
Tom Cherry 1ab3dfcab4 Reland^2: "init: run property service in a thread"
It's been a long standing issue that init cannot respond to property
set messages when it is running a builtin command.  This is
particularly problematic when the commands involve IPC to vold or
other daemons, as it prevents them from being able to set properties.

This change has init run property service in a thread, which
eliminates the above issue.

This change may also serve as a starting block to running property
service in an entirely different process to better isolate init from
handling property requests.

Reland: during reboot, init stops processing property_changed messages
from property service, since it will not act on these anyway.  This
had an unexpected effect of causing future property_set calls to block
indefinitely, since the buffer between init and property_service was
filling up and the send() call from property_service would then
block.  This change has init tell property_service to stop sending it
property_changed messages once reboot begins.

Test: CF boots, walleye boots, properties are set appropriately
Change-Id: I26902708e8be788caa6dbcf4b6d2968d90962785
2019-09-05 14:42:58 -07:00
Steven Moreland a4eaf64de8 Remove libhwbinder/libhidltransport deps
Since these were combined into libhidlbase.

Bug: 135686713
Test: build only (libhwbinder/libhidltransport are empty)
Change-Id: I0bdffced6af52695c0ef98c9dd659348e56f7aa6
2019-09-05 14:17:42 -07:00
Mark Salyzyn 6ef0081fc6 fs_mgr: overlayfs: README merge in public document
A public facing document rewrite merged into the AOSP-facing README.

Test: none
Bug: 118781664
Change-Id: I6b9d3c4e274edc700dd587f2adc51147382d6b3f
2019-09-05 14:07:57 -07:00
Eric Biggers 7a5f6c5912 init/fscrypt_init_extensions: remove redundant log message
On every boot, there is a "duplicate" message logged at INFO level for
every system device-encrypted directory, e.g.:

    1     1 I init    : Setting policy on /data/app-private
    1     1 I init    : Encryption policy of /data/app-private set to 3a19970b1aa3abed modes 127/4

Or:

    1     1 I init    : Setting policy on /data/app-private
    1     1 I init    : Verified that /data/app-private has the encryption policy 3a19970b1aa3abed modes 127/4

(Before I51ee70706bc9ccb216ccefd7bdfbbfc57faae14d the second messages
were slightly different, but were similar and still at INFO level.)

The issue is that set_system_de_policy_on() prints its own log message,
then calls fscrypt_policy_ensure() which prints a message too; and the
second message is essentially a superset of the first.

Clean this up by removing the message from set_system_de_policy_on().

Test: Booted and checked the log.
Change-Id: I2786ba7e2dbb355f159ac9d8fe5ad1f0a4cdbfea
2019-09-05 13:20:25 -07:00
Vic Yang 9fb93edd5b Reland "libutils: Introduce StaticString16""
This reverts commit 1270e4fbf1.

Bug: 138856262
Test: Run unit tests.
Change-Id: I37be01d7d4f98a83078870cb0917275336fa2bbd
Merged-In: I8da93f2c9b95183e32d4a2ea895f90c449abbe4d
2019-09-05 13:19:14 -07:00
Treehugger Robot 50e408db2d Merge "Limit the compat symlinks to ART binaries." 2019-09-05 19:33:38 +00:00
Tobias Thierer 8bea425845 Merge "init: add exec_reboot_on_failure builtin" 2019-09-05 18:04:14 +00:00
Xin Li d0a45dbc9a Merge "DO NOT MERGE - Merge Android 10 into master" 2019-09-05 16:53:23 +00:00
Steven Moreland 915521c7d8 Merge "libcutils: Implement ashmem_valid on host." 2019-09-05 15:57:46 +00:00
Xin Li d4ef92d866 DO NOT MERGE - Merge Android 10 into master
Bug: 139893257
Change-Id: Id5c7c0c40d29884640b649db217be1eb86ee9147
2019-09-04 22:08:17 -07:00
Elliott Hughes 4e6bf2510f Remove the global seccomp option.
Added in af1a9bfb8f, but it's never been
used in practice because of the performance impact, and it's incompatible
with our ability to add new system calls via a bionic module update
because it defaults to disabling all unknown syscalls, and init will
still be using the non-updated bootstrap libc from when it first shipped.

Test: treehugger
Change-Id: I8e396675fcfaf0218a92f464d15e613f43319305
2019-09-04 21:16:26 -07:00
Tom Cherry 4375597f95 Merge "liblog: run liblog#enoent only as root"
am: 8412deda51

Change-Id: I5b179babe5324bcd63a5303f65a72e9e4bb6e9c2
2019-09-04 19:30:02 -07:00
Treehugger Robot 8412deda51 Merge "liblog: run liblog#enoent only as root" 2019-09-05 02:04:33 +00:00
Steven Moreland c0660668e7 libcutils: Implement ashmem_valid on host.
Was missing.

Bug: 124524556
Test: build host code with dependency on this
Change-Id: I0074923e9ec53e42f9479fff47df0a24c8750164
2019-09-05 01:26:19 +00:00
Daniel Colascione 2378575dac Merge "Improve codegen slightly when doing FD validity checks"
am: 9ad079ba58

Change-Id: I4262f086b9041bb28536cf2c7598817fac63b8cc
2019-09-04 18:20:24 -07:00
Daniel Colascione 9ad079ba58 Merge "Improve codegen slightly when doing FD validity checks" 2019-09-05 00:56:38 +00:00
Tobias Thierer 1136f1592a Init: Run boringssl self test via separate binaries.
Instead of init.cpp knowning about the boringssl self
test, use init.rc to exec dedicated self test executables.

Advantages:
 - The self test is run not only both the copy of libcrypto
   in /system but also /apex/com.android.conscrypt.
 - The self test is run not only for the primary (e.g. 64bit)
   ABI but also for a secondarry (e.g. 32bit) ABI.
 - The dependency on libcrypto is kept to the self test binary.
 - The self test binary abstracts the exact native API for
   running the self test (this will change soon because the
   self test will be run when the library is loaded).

Bug: 137267623
Test: Check that logcat shows both binaries being started as root,
      and finishing with exit code 0.

Change-Id: I1e716749ee2133993f0f7b2836483391fd1a62f0
2019-09-05 01:41:08 +01:00
Tom Cherry 7896e7adcc init: add exec_reboot_on_failure builtin
Add exec_reboot_on_failure builtin and refactor the VDC commands that
had similar functionality.  These will now also reboot in the case
that the program cannot be found or run for any reason.

Test: boots normally, reboots if command is not found or if command
      returns status '1'

Change-Id: I1c99498c2b741512a50188e1a325c25e9ec8fba0
2019-09-04 16:23:15 -07:00
Jaegeuk Kim 5327d931ac logcatd: fallocate and fadvise to logcat files
1. Pinning and fallocating blocks can avoid filesystem fragmentation.
2. Dropping caches can avoid memory pressure.
3. Use 2MB files

Bug: 136483670
Bug: 137180754
Change-Id: I0827bd903a677cbcbf3688983e847301cd541cdd
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2019-09-04 22:45:48 +00:00
Yifan Hong 362853af1a Merge "libsnapshot: Refactor CreateLogicalAndSnapshotPartitions"
am: dccd6b3389

Change-Id: I6222327558d2fc9f0bad1056ef4d53e4e8a5fa48
2019-09-04 15:11:48 -07:00
Yifan Hong fb0386f76c Merge "liblp: Indicate usable regions in ResizePartition"
am: d6c426c0f5

Change-Id: Ia555bc10e05cd60fec50f7974581ff9a1269c67d
2019-09-04 15:10:54 -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
Alessio Balsini ab92aeb61b Merge "CreateSnapshot: reduce zero-filling for CoW images"
am: 2dc25441e2

Change-Id: Ia97c9c1888bcb751de5b2fccde30e036c2618591
2019-09-04 14:35:35 -07:00
Christopher Ferris f0edee5933 Merge "Add test mapping to run the libunwind tests."
am: c3163e7664

Change-Id: Ib82965bef7d9e9a983cbc7d282fa59abab083ece
2019-09-04 14:21:22 -07:00
Treehugger Robot 2dc25441e2 Merge "CreateSnapshot: reduce zero-filling for CoW images" 2019-09-04 21:19:44 +00:00
Daniel Colascione 7c706baedb Improve codegen slightly when doing FD validity checks
See https://gcc.godbolt.org/z/hGUZIk

Test: inspection
Bug: 140506797
Change-Id: I6fe87b16e18c93b7fc3ca28edbbc68c245e7e5e5
2019-09-04 13:46:50 -07:00
Tom Cherry 0bf41672e9 liblog: run liblog#enoent only as root
Previously this test would rely on ro.debuggable being true, but there
are now some circumstances where ro.debuggable is true, yet `su` does
not exist.  Therefore we only run this test when it is root.

Also simplify some of the test macros.

Bug: 140446213
Test: passes as root, skips as non-root
Change-Id: I0651963d5c7d4f5308989ab6b04aab1042094e5a
2019-09-04 13:39:06 -07:00
Christopher Ferris c3163e7664 Merge "Add test mapping to run the libunwind tests." 2019-09-04 20:28:37 +00:00
Yifan Hong 44d025d928 Merge "libsnapshot: Don't accidentally delete snapshot when collapsing"
am: 48eb2ee176

Change-Id: Ibe795625cd858e7cf72dc0a7ac4d08bf2f081d7b
2019-09-04 13:08:13 -07:00
Yifan Hong ab13ed350e Merge "libsnapshot: Allow multiple calls to FinishedSnapshotWrites"
am: 09a0c98506

Change-Id: If259e2d4a9663575198aa1b14e13a4c9a50cf1e7
2019-09-04 13:05:48 -07: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
Bowgo Tsai 79f875f240 Moving skip_mount.cfg to system_ext partition
We're now adding a core CSI system.img that is common across different
targets. So GSI-specific files should be moved to system_ext partition.

Note that GSI is a system.img that includes the contents of product and
system_ext partitions, under /system/product and /system/system_ext,
respectively. That's why it's under /system/system_ext instead of
/system or /system_ext.

Bug: 137711197
Test: boot GSI on crosshatch
Change-Id: I1ee54c1a434f2d7cf34b4ea2cbda9c732ec932a1
2019-09-04 22:28:47 +08: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
Steven Moreland c732c03482 compare android::Vector and std::vector
Have been wondering for a while.

Test: libutils_benchmark
--------------------------------------------------------------------
Benchmark                          Time             CPU   Iterations
--------------------------------------------------------------------
BM_fill_android_vector          24.6 ns         24.5 ns     28207074
BM_fill_std_vector              5.24 ns         5.21 ns    130675479
BM_prepend_android_vector       5783 ns         5770 ns       100000
BM_prepend_std_vector           5731 ns         5717 ns       100000

Change-Id: Ie296ce2c4395121b6a456d57421f820909418afe
2019-09-03 18:11:43 -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 6777935a94 Merge "libsnapshot: Record COW size(s) in snapshot status file"
am: a9ffef27e1

Change-Id: Iea27711e0c366a9136b3a1fa4940df5d4eff4e7b
2019-09-03 09:57:39 -07:00
Christopher Ferris 0a0ea79724 Merge "Add test of undefined return address."
am: 0ac9b9a894

Change-Id: I60812c461523eccb8b272fcfd8173542f537d3c2
2019-09-03 09:57:09 -07:00
Tom Cherry 3f5cc2dd84 Merge "init: Always reap processes before handling properties"
am: 0589aa4265

Change-Id: I825598315caa2a6fe592f293815adf8242f0a644
2019-09-03 09:56:38 -07:00