Commit graph

52676 commits

Author SHA1 Message Date
Christopher Ferris
11555f0961 Increase timeouts.
There is still some flakiness, so increase the timeout values.
Also remove the TEMP_FAILURE_RETRY macro usage in TIMEOUT calls.
That macro disables the ability of the alarm code to interrupt
the system call.

Bug: 141045754

Test: Unit tests pass.
Change-Id: Ia3c95dccc3076a3fd5ef6432097a57e4ccee4df3
2019-09-20 15:07:03 -07:00
Yifan Hong
e71efc3dc4 Merge changes from topic "libsnapshot_api_update_engine"
* changes:
  libsnapshot: Cancel/merge existing update before begin
  libsnapshot: operator<< for UpdateState
2019-09-20 20:56:50 +00:00
Steven Moreland
1cb99ea59b libutils: Trace.h for everything but windows
libcutils has trace implemented for host. In order to increase code
portability, opening that up for libutils Trace.h usage as well.

Bug: 124524556
Test: use Trace.h on host glinux
Change-Id: Ia873f88e7436a18f6c0f761000bf697c68ffea17
2019-09-20 11:28:00 -07:00
Martin Stjernholm
96f16688c9 Rename ANDROID_RUNTIME_ROOT to ANDROID_ART_ROOT following APEX module name change.
Test: Boot
Bug: 135753770
Change-Id: Ie9a8043ee350164c01a66f1a7ab1b3205076a5c4
2019-09-20 16:07:04 +01:00
Tom Cherry
03642ad8b8 Merge "init: create sockets before forking" 2019-09-20 14:59:58 +00:00
Tom Cherry
89562f11c8 Merge changes Iff879def,I79c72346
* changes:
  Simply reboot if the boringssl self test fails
  init: reboot immediately if /data isn't mounted
2019-09-20 14:59:42 +00:00
Martin Stjernholm
22784574fa Merge "Revert "Include com.android.runtime in the "runtime" linker namespace."" 2019-09-20 12:55:38 +00:00
Treehugger Robot
1b31d85b07 Merge "Remove unused libnativeloader-dummy-headers" 2019-09-20 11:09:30 +00:00
Bowgo Tsai
f016f256b5 Separate system_ext_sepolicy.cil out of system sepolicy
Currently system sepolicy can be extended via:
  - BOARD_PLAT_PUBLIC_SEPOLICY_DIR
  - BOARD_PLAT_PRIVATE_SEPOLICY_DIR

To support having a single shared core system sepolicy, those
customization should be moved to the newly added system_ext partition.

System-ext-specific sepolicy files will be installed into
/system_ext/etc/selinux/*. system_ext_sepolicy.cil is merged into
precompiled_sepolicy at build-time. In case precompiled_sepolicy can't
be used (e.g. system-only-ota), the init will merge this file with
the rest of the sepolicy at runtime.

Bug: 137712473
Test: boot aosp_crosshatch with system_ext_sepolicy.cil
Test: boot aosp_crosshatch without system_ext_sepolicy.cil
Change-Id: Ib37622271b559d65462de99ff424be831004508a
2019-09-20 18:20:21 +08:00
nelsonli
2e9edcb042 [vts-core] Add vts_core_liblp_test to vts-core
Add vts_core_liblp_test to vts-core suite and skip the test if the
first-api-level < 29.

Bug: 132702215
Test: atest vts_core_liblp_test
Change-Id: I09ea8ff923b5300bae513146f6d07dc029d36661
2019-09-20 16:06:18 +08:00
Inseob Kim
c8f80ffe0d Remove static vndk dep from vendor modules
Shared VNDK should be used instead for vendor modules.

Bug: 137178339
Test: m
Test: run property_info_checker on host
Change-Id: I40672d0f6251148915f9ae2e2a14f291d9c2b6c5
2019-09-20 15:31:39 +09:00
Howard Chen
1b094939e5 Mount multiple DSU partitions when present.
There might be partitions like product or system_ext in addition
to the system partition. Those partitions can contain dependencies
required by the system so we need to make the init to recognize
these partitions and mount them accordingly.

Bug: 140092208
Test: gsi_tool install & reboot
Change-Id: Ie5ef063292c3656e79cce9f887f23a8faa1ba2be
2019-09-20 14:10:52 +08:00
Treehugger Robot
c00229c34a Merge "Use Android systemTime implementation for host linux." 2019-09-20 01:28:28 +00:00
Tom Cherry
5241d10049 init: create sockets before forking
There is a race condition with Service::Start and socket creation.
Since socket creation currently happens after the fork(), it's
possible that init can continue executing other commands before the
socket is created.  If init starts another service that relies on that
socket, it isn't guaranteed to be available.

Particularly, we've seen this with hwservicemanager starting after
logd, but hwservicemanager's logs sometimes not showing up.

Bug: 140810300
Test: boot and logging functions correctly

Change-Id: Ib2932e836d345830cd38f3b556598508fd953058
2019-09-19 16:10:30 -07:00
Brett Chabot
1af6acc4d3 Use Android systemTime implementation for host linux.
The Android framework, notably android.view.Choreographer, assumes
that System.nanoTime and SystemClock.uptimeMills return consistent
values. This was true on device, but not on host.

This commit makes those values consistent on host linux. The necessary
support should be in place in kernels 2.6.39 and newer, which have been
available since 2012.

Test: m -j libutils
Change-Id: I833a89a810ae9fb3e8c01f6095ee2aca893c284f
2019-09-19 15:32:33 -07:00
Tom Cherry
a76bfb2d97 Simply reboot if the boringssl self test fails
If this check fails and an OTA or mainline module update has recently
happened, we want to rollback the recent change.  The easiest way to
handle this is to reboot, which will trigger the fallback mechanisms
that are already in place.

Bug: 141082587
Test: device reboots if self test fails
Test: device rolls back a recently applied OTA with failing self test
Test: device rolls back a recently applied conscrypt apex update with
      failing self test
Change-Id: Iff879deff09d347262dc7a2acadb9164a5029d4a
2019-09-19 14:59:07 -07:00
Elliott Hughes
c21c0ac740 Merge "Remove unused big-endian cruft." 2019-09-19 21:26:11 +00:00
Tom Cherry
2436e6b15a init: reboot immediately if /data isn't mounted
All of the logic in reboot.cpp is meant to safely shutdown services,
safely unmount emulated RW file systems, then finally unmount the
remaining RW file systems, particularly /data.  If /data hasn't been
mounted, then none of this logic is required.

Running this logic caused a lock up when shutting down blueline from
early-init.  Vold, or potentially a related HAL, locked up during the
ShutdownVold() calls.  debuggerd separately locked up in the watchdog
thread.

Therefore, this change immediately reboots if /data is not mounted.
It also removes the lines to call into debuggerd.  debuggerd will not
run due to SELinux in any case, so it can only be used when hands-on
debugging a device.

Bug: 141082587
Test: shutdown with /data mounted continues as normal
Test: shutdown from early-init immediately shuts the device down
Change-Id: I79c72346b17c7dfe57e955d9739bcaf559badc14
2019-09-19 14:05:56 -07:00
Treehugger Robot
bac7609c48 Merge "Add deps to files used by backwards compatibility checker" 2019-09-19 20:33:35 +00:00
Martin Stjernholm
59b54f42bb Revert "Include com.android.runtime in the "runtime" linker namespace."
No longer required for hwasan builds, since b/140790209 is fixed.

This reverts change-id I27069b20f7c7068b931340f548b284ce1676466c.

This also reverts the identified change for the memory regression in
b/140648539.

Test: Build & boot on taimen_hwasan-userdebug
Test: Build & boot on crosshatch_hwasan-userdebug
Bug: 140790209
Bug: 139408016
Bug: 140648539
Change-Id: Ib61c53571a4de0970a86ebc391a2ce780247943a
2019-09-19 19:11:47 +01:00
Dan Willemsen
20de6c909f Add deps to files used by backwards compatibility checker
Any used files need to be in the dependencies list for rules. In this
case, this is more than what's actually read in the script, but the
older ones shouldn't change as much, and replicating the logic is
non-trivial.

Bug: 130111713
Test: run with RBE, no longer see error about file not found
Change-Id: I88baf541ce6250a5dbf7b8a7d6b8005ed7cf5cc6
2019-09-19 17:49:44 +00:00
Tom Cherry
0b4f560f87 Merge "init: degeneralize subcontext init into only vendor_init" 2019-09-19 15:39:40 +00:00
Alistair Delva
40ffdc681c Merge "libutils: increase test TIMING_TOLERANCE_MS" 2019-09-19 15:00:12 +00:00
Christopher Ferris
88bef19e64 Merge "Add support for scudo native allocator." 2019-09-19 14:42:23 +00:00
Christopher Ferris
3a8974d0b2 Merge "Add TEMP_FAILURE_RETRY where appropriate." 2019-09-19 14:42:20 +00:00
Treehugger Robot
da6525c2db Merge "Construct the super_vbmeta image" 2019-09-19 10:21:53 +00:00
Kaiwen Szu
6dd098cb1e Construct the super_vbmeta image
This commit constructs the super_vbmeta image to eliminate the
need of adding /vbmeta_system and/or /vbmeta_vendor when AVB
chain partition is used with Android Dynamic Partition.

See BOARD_AVB_VBMETA_SYSTEM under the link:
https://android.googlesource.com/platform/external/avb/#build-system-integration

The structure of super_vbmeta :

|     VBMeta Table    | (fixed-length 2KiB)
| Backup VBMeta Table | (fixed-length 2KiB)
|     VBMeta Images   | (fixed-length 64KiB each)

The structure of VBMeta Table :

| Super VBMeta Header | (fixed-length 128B)
|  VBMeta Descriptors | (variable-length)

The VBMeta Table records the slot number of each
vbmeta image within the /super_vbmeta partition.

Bug: 137054296
Test: m libvbmeta_test
Test: ./out/host/linux-x86/nativetest/libvbmeta_test/libvbmeta_test
Change-Id: I01aeadd850750ae87d9125484c1b1f570bb84756
2019-09-19 12:05:09 +08:00
Treehugger Robot
08c4133c91 Merge "Lengthen ScopedDisableMallocTimeout timeout to 10 seconds" 2019-09-19 02:14:19 +00:00
Christopher Ferris
172b0a0834 Add TEMP_FAILURE_RETRY where appropriate.
Bug: 141045754

Test: Ran unit tests in a loop on walleye and cuttlefish.
Change-Id: I87b912e76889ed207ab17b862e4786ee44a382ba
2019-09-18 19:05:25 -07:00
Treehugger Robot
ea378530d6 Merge "<android-base/endian.h>: fix interoperability issue" 2019-09-19 00:17:22 +00:00
Colin Cross
4e3387cb5f Lengthen ScopedDisableMallocTimeout timeout to 10 seconds
memunreachable_unit_test is flaking sometimes with timeouts in
ScopedDisableMallocTimeout.  They can't be real deadlocks, which
is what this timeout is designed to detect, the Enable() called
from the signal handler wasn't doing anything because disabled_
hadn't been set yet.

Lengthen the timeout to 10 seconds, and set disabled_ before
starting to take the malloc locks in malloc_disable.  If this
really deadlocked then calling malloc_enable inside malloc_disable
would make a mess of the locks, but it would at least unlock
whatever lock was deadlocked and give the test a chance to
report the error.

Bug: 141229513
Test: atest memunreachable_unit_test
Change-Id: I3578964577025aaa4bbba09027afd22997d4adbd
2019-09-18 17:07:22 -07:00
Christopher Ferris
5db009286d Add support for scudo native allocator.
Bug: 137795072

Test: All unit tests pass when using scudo or jemalloc.
Change-Id: I20c71811d9e43663c495a1e51988acfef9fc8584
2019-09-18 16:41:25 -07:00
Tom Cherry
14c2472734 init: degeneralize subcontext init into only vendor_init
This code is more generic than it needs to be and one of the side
effects is that an extra init process is forked for odm_init, despite
it having the same context as vendor_init.  I don't think anything is
going to change regarding that soon, so this change stops forking that
extra process to save its memory and simplifies the code overall.

Bug: 141164879
Test: init still uses vendor_init for vendor_scripts
Test: init unit tests
Test: init only has one subcontext process
Change-Id: I0d224455604a681711e32f89fb20132378f69060
2019-09-18 14:02:14 -07:00
Steven Moreland
c1e04d8ac5 libutils: increase test TIMING_TOLERANCE_MS
25 -> 100, because we are seeing larger values sometimes on cuttlefish.

Fixes: 141212746
Test: libutils_test
Change-Id: I371416473b97f46891104ff9d893ec38c25728aa
2019-09-18 20:35:49 +00:00
Treehugger Robot
948e4fa316 Merge "adb: fix adb remount -R" 2019-09-18 18:48:58 +00:00
Colin Cross
f117f34aed Use libcrypto_static instead of libcrypto
Replace libcrypto with libcrypto_static, which can be protected through
visibility to ensure only modules that don't affect FIPS certification
can use it.

Bug: 141248879
Test: m checkbuild
Change-Id: I5f0b9acfb57f68570f6f58f2395f2bb1bc015365
2019-09-18 11:04:35 -07:00
Mark Salyzyn
6f908cefe7 adb: fix adb remount -R
A regression from commit 8c2198c809
("adb: use shell for remount to forward return codes.") where the
optional argv[1] got missed for the remount command.  This change
hands off _all_ the arguments if to a shell and activates some of
the extra features in the remount command.

$ adb remount --help
remount [-h] [-R] [-T fstab_file] [partition]...
	-h --help	this help
	-R --reboot	disable verity & reboot to facilitate remount
	-T --fstab	custom fstab file location
	partition	specific partition(s) (empty does all)

Remount specified partition(s) read-write, by name or mount point.
-R notwithstanding, verity must be disabled on partition(s).
$

SideEffects: adb remount [-h] [-R] [-T fstab_file] [partition]...
Test: adb-remount-test.sh
Bug: 138577868
Bug: 139283818
Bug: 139226412
Change-Id: I8223d4000ab20857e9b634e4d4a326eed530d7be
2019-09-18 09:40:50 -07:00
Elliott Hughes
b6e7de2221 Remove unused big-endian cruft.
Test: builds
Change-Id: I19fef65d311923e4e6dac7307914f5fbb92b7bde
2019-09-18 08:02:10 -07:00
Tom Cherry
b0321c1de1 Merge "fastboot: don't use sparse_file_import_auto() in load_buf_fd()" 2019-09-18 14:44:42 +00:00
Bowgo Tsai
41d8a576ec <android-base/endian.h>: fix interoperability issue
<winsock2.h> has defined htonl(), ntohl(), htons() and ntohs() with
different return type that cannot be replaced by those macro definitions
in <android-base/endian.h>.

Includes <winsock2.h> first to prevent them from being replaced.
Then defines the macro later so we don't need to call into DLL
when using those functions.

Bug: 139639521
Test: m libbase_test && wine out/host/windows-x86/nativetest64/libbase_test/libbase_test64.exe
Test: m checkbuild
Change-Id: I672f23a31c6800df10e04d36695d446bca4c91e9
2019-09-18 13:06:45 +08:00
Treehugger Robot
7922a44637 Merge "Using the correct feature name for abb_exec." 2019-09-18 02:51:28 +00:00
Christopher Ferris
5da9906af0 Merge "Allow getrlimit/ugetrlimit syscalls in tests." 2019-09-18 00:59:20 +00:00
David Anderson
0e70ce26b8 Merge "init: Make sure /dev/block/by-name/userdata is created in snapshot mode." 2019-09-18 00:35:55 +00:00
Yifan Hong
6aa77dd271 libsnapshot: Cancel/merge existing update before begin
Attempt to cancel or merge an existing update before starting
a new one.

Test: libsnapshot_test

Change-Id: Ic534db846f1fe97bd7ca1f176a9494fbc6a0f8d5
2019-09-17 16:58:34 -07:00
Yifan Hong
0b32b199ac libsnapshot: operator<< for UpdateState
Test: pass
Change-Id: Ifc88666d0b7c76f3ea9b7ec662398084d631c4e6
2019-09-17 16:58:34 -07:00
Yifan Hong
7509fca99a Merge changes from topic "libsnapshot_api_update_engine"
* changes:
  libsnapshot: CreateUpdateSnapshot accepts DeltaArchiveManifest
  libsnapshot: Add snapshot metadata updater.
2019-09-17 23:52:19 +00:00
Christopher Ferris
ab60668ef4 Allow getrlimit/ugetrlimit syscalls in tests.
The fdsan code uses getrlimit/ugetrlimit so need to allow that when
running the debuggerd unit tests.

Bug: 141045754

Test: Ran the offending tests hundreds of times without failure.
Change-Id: Iece94f03e7895d61ca8a8f3ab17dce7e54ddf9cd
2019-09-17 15:31:47 -07:00
Tom Cherry
fbb9535aae fastboot: don't use sparse_file_import_auto() in load_buf_fd()
load_buf_fd() attempts to find the size of the file that it is about
to load by first calling sparse_file_import_auto() then using
sparse_file_len() upon success or falling back to the file size on the
filesystem on failure.

This is problematic however as sparse_file_import_auto() creates a
sparse_file out of the normal file, but does not resparse it, so an
assertion fails during the sparse_file_len() call.

This is fixed by using sparse_file_import() instead.  This will fail
in the case that the file is not sparse and the call to
sparse_file_len() will be properly skipped.

Bug: 140538105
Test: flash blueline factory image with assertions enabled in
      libsparse/sparse.cpp

Change-Id: I0283be33563a3301ce5b09bde41105a20f91086c
2019-09-17 13:43:56 -07:00
Elliott Hughes
f3a5ab8b1d Merge "Remove the global seccomp option." 2019-09-17 20:21:09 +00:00
David Anderson
1cfcee0e4d init: Make sure /dev/block/by-name/userdata is created in snapshot mode.
When userdata is used to store COW devices, we need to ensure we've
generated uevents for it.

This patch also refactors FirstStageMount to pass required devices
through arguments rather than a member variable.

Bug: 140761481
Test: manual test
Change-Id: Ie5e1c9699f084da5467a758eea41c7907fecc5ca
2019-09-17 13:19:22 -07:00