Commit graph

34330 commits

Author SHA1 Message Date
TreeHugger Robot
ad692c9b29 Merge "AVB: allow no metadata in the generic system.img for project Treble" into oc-dr1-dev 2017-06-28 03:37:04 +00:00
Todd Poynor
4d88b49320 healthd: notify listeners using local copy of list, drop lock
am: fd68370074

Change-Id: I6ab2f3131139a553bf9e8eb927e266ab128a5f49
2017-06-27 21:52:28 +00:00
Todd Poynor
fd68370074 healthd: notify listeners using local copy of list, drop lock
Binder currently may service an incoming oneway transaction whenever
an outbound oneway call is made (if there is already a pending
incoming oneway call waiting).  The unexpected nested method call
blocks forever on a recursive mutex acquire because healthd is single-
threaded.  The binder behavior is considered a bug and may change in
the future.  For now, work around this in healthd.

Make a local copy of the listeners list, then drop the lock and
perform the outbound calls on the local copy of the list.

Bug: 38201220
Test: Marlin with modified client calling scheduleUpdate() repeatedly
Change-Id: If35c2847556245921e2aff808ff747bb60356811
2017-06-27 11:58:17 -07:00
Bowgo Tsai
1773266f95 AVB: allow no metadata in the generic system.img for project Treble
The generic system.img released from project Treble can't contain any verity
metadata (e.g., vboot 1.0, AVB, or any other implementation) because it's
*generic*. To make any device can boot with it, `avbctl disable-verification`
is introduced to set a new flag AVB_VBMETA_IMAGE_FLAGS_VERIFICATION_DISABLED
in the top-level vbmeta to disable the entire AVB verification process. This
should be done prior to flash the generic system.img. See the following link
for details:

    https://android-review.googlesource.com/#/c/418399/

This CL checks whether AVB_VBMETA_IMAGE_FLAGS_VERIFICATION_DISABLED is
set in the top-level vbmeta. When set, skip verifying the vbmeta structs
against androidboot.vbmeta.{hash_alg, size, digest} because it will be
absent in kernel cmdline. Also, only top-level vbmeta struct is read then
returned by libavb in this case.

Note that another flag AVB_VBMETA_IMAGE_FLAGS_HASHTREE_DISABLED, usually
set by `adb disable-verity`, is used to signal fs_mgr to skip setting up
dm-verity, but libavb still verifies all vbmeta structs. fs_mgr will
also verify all vbmeta structs against androidboot.vbmeta.{hash_alg,
size, digest} from kernel cmdline as well.

Also rename SetUpAvb() to SetUpAvbHashtree() to better fit its usage.
This function will return kDisabled when any of the above two flags is set.

Finally, regardless of which flag is set or not set, we still only allow two
return values from avb_slot_verify():

   - AVB_SLOT_VERIFY_RESULT_OK: it's still possible to get this value
     when any of these flags are set in build time. e.g.,
     BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS=--flags 2

   - AVB_SLOT_VERIFY_RESULT_ERROR_VERIFICATION: in most cases we should
     get this value, because the flags are likely set at run time.

Bug: 62523303
Test: boot device with 'avbctl disable-verification'.
Test: boot device with 'avbctl enable-verification'.
Test: boot device with 'adb disable-verity'.
Test: boot device with 'adb enable-verity'.

Test: build image with BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS=--flags 2, then boot device.
      repeat the above steps to boot device again.

Merged-In: Ie8436f3e0e82c78490208f3b85eac5238a9fdfdb
Change-Id: Ie8436f3e0e82c78490208f3b85eac5238a9fdfdb
(cherry picked from commit 60f19a0792)
2017-06-24 10:01:32 +08:00
TreeHugger Robot
75a32dead5 Merge "Revert "crash_dump: during early boot, output to kmsg on userdebug."" into oc-dr1-dev 2017-06-23 22:45:48 +00:00
Jeff Vander Stoep
5fdc4cc746 Revert "crash_dump: during early boot, output to kmsg on userdebug."
This reverts commit bf2dd48241.

Addresses:
avc: denied { relabelto } for name="kmsg_debug" dev="tmpfs" ino=10642
scontext=u:r:init:s0 tcontext=u:object_r:device:s0 tclass=chr_file

Bug: 62101480, 35197529
Test: build and boot device. Verify selinux denial no longer occurs.
Change-Id: I28ce16f50eec20ef15c1721f41b66f22a84e7cca
2017-06-23 13:37:54 -07:00
TreeHugger Robot
394c1ad959 Merge "Debuggerd: Fix debuggerd_test" into oc-dr1-dev 2017-06-23 20:28:30 +00:00
Andreas Gampe
0ecc88bb28 Debuggerd: Fix debuggerd_test
Follow-up to commit 695713e931f0436aca56be9c0dacf2a5dd4e56e7 in
bionic. Change expectations of the abort callstack.

(cherry picked from commit 26cbafb892)

Bug: 62810360
Merged-In: I350a29ee1713a7ebdd50f2b9bdc2078c671e22c7
Test: mmma system/core/debuggerd
Test: adb shell /data/nativetest/debuggerd_test/debuggerd_test32
Test: adb shell /data/nativetest64/debuggerd_test/debuggerd_test64
Change-Id: I350a29ee1713a7ebdd50f2b9bdc2078c671e22c7
2017-06-23 10:49:19 -07:00
Daichi Hirono
d9cda90ad4 Add volatile to temporary variable.
FuseBuffer::HandleNotImpl save the value of |request.header.unique| to the
temporary variable, clear the buffer which is a union of |request| and
|response|, then write back the unique value to response.header.unique.

Before the CL, the temporary variable was wrongly removed by the compiler
optimization, and response.header.unique was always 0. The CL adds
volatile modifier as workaround to prevent the compiler optimization
from removing the temporary value.

Bug: 62429763
Test: libappfuse_tests
Change-Id: Ia853f805633f646f316f585a35c7b018000b6eb3
(cherry picked from commit a6dee5e279)
2017-06-23 07:15:27 +00:00
Andreas Gampe
1d873b3512 Debuggerd: Extend crash_dump timeout to 5 seconds
am: 4f5f558d38

Change-Id: I25274053b0b45b00cefbc8d65d5ef271050269b2
2017-06-23 06:22:08 +00:00
Andreas Gampe
4f5f558d38 Debuggerd: Extend crash_dump timeout to 5 seconds
Some processes have lots of threads and minidebug-info. Unwinding
these can take more than the original two seconds.

Bug: 62828735
Test: m
Test: debuggerd_test
Test: adb shell kill -s 6 `pid system_server`
Merged-In: I0041bd01753135ef9d86783a3c6a5cbca1c5bbad
Change-Id: I0041bd01753135ef9d86783a3c6a5cbca1c5bbad
(cherry picked from commit b02851a984)
2017-06-22 23:02:52 -07:00
Logan Chien
7c61689d5a ld-config: Export android.hidl.memory@1.0-impl
am: fb2a4f0874  -s ours

Change-Id: Ife655ab99a716adce10243e903ccd20192679614
2017-06-23 05:12:14 +00:00
Logan Chien
fb2a4f0874 ld-config: Export android.hidl.memory@1.0-impl
This commit exports android.hidl.memory@1.0-impl.so from default linker
namespace to vndk (VNDK-SP) linker namespace.  This fixes
libhidlmemory.so failure.

Note: Exposing android.hidl.memory@1.0-impl.so from default linker
namespace to vndk (VNDK-SP) linker namespace shall be fine because its
APIs are frozen and won't be changed in the future.

Note: android.hidl.memory@1.0-impl.so is NOT exported to sphal linker
namespace.

Bug: 35107583
Bug: 62778280
Test: Write a test SP-HAL lib which links libhidlmemory.so, load that
SP-HAL lib into system executable, and make sure mapMemory() works.
Test: sailfish boots w/o problems.

Merged-In: Ia36350dcf1f8c8dc6d7bf2c7a6ae65e0ebaef578
Merged-In: Iddb723558c3a814a905cd42797594a707bc651da
Change-Id: I69034595b2cd355e786ce7943fed7dddf1b12525
(cherry picked from commit bd7503dae7)
(cherry picked from commit 3251e582f2)
2017-06-22 20:13:01 +08:00
Logan Chien
bd7503dae7 ld-config: Export android.hidl.memory@1.0-impl
This commit exports android.hidl.memory@1.0-impl.so from default linker
namespace to vndk (VNDK-SP) linker namespace.  This fixes
libhidlmemory.so failure.

Note: Exposing android.hidl.memory@1.0-impl.so from default linker
namespace to vndk (VNDK-SP) linker namespace shall be fine because its
APIs are frozen and won't be changed in the future.

Note: android.hidl.memory@1.0-impl.so is NOT exported to sphal linker
namespace.

Bug: 35107583
Bug: 62778280
Test: Write a test SP-HAL lib which links libhidlmemory.so, load that
SP-HAL lib into system executable, and make sure mapMemory() works.
Test: sailfish boots w/o problems.

Change-Id: Ia36350dcf1f8c8dc6d7bf2c7a6ae65e0ebaef578
2017-06-22 20:12:21 +08:00
TreeHugger Robot
46163119d5 Merge changes Ic9c27552,Ie3980cd5,I42bf2bdc into oc-dr1-dev
* changes:
  Revert "Revert "init: poll in first stage mount if required devices are not found""
  Revert "Revert "ueventd: remove PlatformDeviceList""
  fs_mgr: differentiate if fs_mgr_set_verity() was skipped or disabled
2017-06-22 09:43:54 +00:00
Logan Chien
2b7e892b7c Merge "ld-config: Add HIDL memory libs to VNDK-SP" into oc-dev
am: 86530fac97  -s ours

Change-Id: I8321a6e632d3a9a2476570b04877e538f250b271
2017-06-22 05:14:00 +00:00
Logan Chien
ba2b4bb9dd ld-config: Add HIDL memory libs to VNDK-SP
am: ea2719f9f1  -s ours

Change-Id: I2fd70479f08eae658fad2a48ae678a300f710f10
2017-06-22 05:11:55 +00:00
TreeHugger Robot
86530fac97 Merge "ld-config: Add HIDL memory libs to VNDK-SP" into oc-dev 2017-06-22 05:07:14 +00:00
Sandeep Patil
1266930e8a Revert "Revert "init: poll in first stage mount if required devices are not found""
This reverts commit d6fccea093.

Bug: 62681642
Bug: 62682821
Bug: 62864413

Merged-In: Ic9c27552acbd2ae312e44ea2cdf060dcf493bfe6
Change-Id: Ic9c27552acbd2ae312e44ea2cdf060dcf493bfe6
Signed-off-by: Sandeep Patil <sspatil@google.com>
(cherry picked from commit 4cbedee541)
2017-06-21 17:02:12 -07:00
Sandeep Patil
5d0299906e Revert "Revert "ueventd: remove PlatformDeviceList""
This reverts commit 516ff99711.

Bug: 62864413
Bug: 62864413

Merged-In: Ie3980cd536c2c83adace063f0950128f68561105
Change-Id: Ie3980cd536c2c83adace063f0950128f68561105
Signed-off-by: Sandeep Patil <sspatil@google.com>
(cherry picked from commit cd2ba0d184)
2017-06-21 17:02:03 -07:00
Sandeep Patil
fa59bba6af fs_mgr: differentiate if fs_mgr_set_verity() was skipped or disabled
In case of non-secure builds (eng variant) fs_mgr_setup_verity() skips
verity checks regardless of fstab options. This is slightly different
than 'adb disable-verity' where it would first read the verity metadata
to check if verity is disabled.

So, this change adds a new return value of FS_MGR_SETUP_VERITY_SKIPPED
instead of piggy backing on the FS_MGR_SETUP_VERITY_DISABLED.

Bug: 62864413
Test: Boot sailfish

Merged-In: I42bf2bdce0ecb18b4c3b568e2bc96bf1590dfb35
Change-Id: I42bf2bdce0ecb18b4c3b568e2bc96bf1590dfb35
Signed-off-by: Sandeep Patil <sspatil@google.com>
(cherry picked from commit 95366e97dd)
2017-06-21 17:01:48 -07:00
TreeHugger Robot
b7806433bf Merge "adb: increase the shell command length limit." into oc-dr1-dev 2017-06-21 20:18:32 +00:00
Tom Cherry
e1519ba27c Merge "Revert "ueventd: remove PlatformDeviceList"" into oc-dev
am: fef83abd89  -s ours

Change-Id: I9d6d034bac825590e276327c27e61686beec51b1
2017-06-21 18:33:51 +00:00
Tom Cherry
165b58b64f Revert "init: poll in first stage mount if required devices are not found"
am: 0e63e61eb5  -s ours

Change-Id: Ie7e538917949762e4932c6c386c003b720408d8b
2017-06-21 18:31:19 +00:00
Tom Cherry
eb9edefdc8 Merge "Revert "ueventd: remove PlatformDeviceList"" into oc-dr1-dev 2017-06-21 18:19:03 +00:00
Tom Cherry
b829811587 Merge "Revert "init: poll in first stage mount if required devices are not found"" into oc-dr1-dev 2017-06-21 18:18:38 +00:00
Tom Cherry
fef83abd89 Merge "Revert "ueventd: remove PlatformDeviceList"" into oc-dev 2017-06-21 18:18:24 +00:00
Tom Cherry
3fa8396f3b Revert "ueventd: remove PlatformDeviceList"
Bug: 62864413

This reverts commit f51657ccef.

Change-Id: I1397ca2de716395782139688542c69848a31d62f
2017-06-21 18:11:03 +00:00
Tom Cherry
5bd4704db2 Revert "init: poll in first stage mount if required devices are not found"
Bug: 62864413

This reverts commit bea663d04c.

Change-Id: Ief069cae9de4393a59d1a499bc4861efb65e8250
2017-06-21 18:10:58 +00:00
Tom Cherry
f520e44c4c Revert "ueventd: remove PlatformDeviceList"
Bug: 62864413

This reverts commit d43b615216.

Change-Id: If3d9060e723d6040d3f32f253b492131a56edb9f
2017-06-21 18:10:53 +00:00
Tom Cherry
0e63e61eb5 Revert "init: poll in first stage mount if required devices are not found"
Bug: 62864413

This reverts commit 5f4e8eac8a.

Change-Id: I6f35b920bb52875c8ef430d3e20b205fda5165e8
2017-06-21 18:10:47 +00:00
Logan Chien
d7a6fb9383 ld-config: Add HIDL memory libs to VNDK-SP
This commit adds libhidlmemory.so and android.hidl.memory@1.0.so to the
exported libs of the `vndk` linker namespace (aka. VNDK-SP).  This is
necessary because some vendors' GLES implementation uses
libhidlmemory.so.  Check http://b/35107583#comment15 for the context.

Bug: 35107583
Test: sailfish boots
Change-Id: Idb5ba4ed4a89795e0e6105d55a84e7f6bbffff51
2017-06-21 20:13:08 +08:00
Logan Chien
ea2719f9f1 ld-config: Add HIDL memory libs to VNDK-SP
This commit adds libhidlmemory.so and android.hidl.memory@1.0.so to the
exported libs of the `vndk` linker namespace (aka. VNDK-SP).  This is
necessary because some vendors' GLES implementation uses
libhidlmemory.so.  Check http://b/35107583#comment15 for the context.

Bug: 35107583
Test: sailfish boots

Merged-In: Idb5ba4ed4a89795e0e6105d55a84e7f6bbffff51
Merged-In: I1556b7499bd981af995f000519b7a314c70567d1
Change-Id: I5af7c954d432a2e8de6c6b744cedbada836bbd98
2017-06-21 20:10:56 +08:00
Tom Cherry
07a1b34b69 init: poll in first stage mount if required devices are not found
am: 5f4e8eac8a  -s ours

Change-Id: I68ce2bceef8c0ec50610a5f69bce5b83bc407810
2017-06-21 04:22:39 +00:00
Tom Cherry
9c0d2e124a ueventd: remove PlatformDeviceList
am: d43b615216  -s ours

Change-Id: Ice290d027143458598995da53d612fa3e2ede3f3
2017-06-21 02:23:18 +00:00
Tom Cherry
baec926f40 Merge "init: poll in first stage mount if required devices are not found" into oc-dr1-dev 2017-06-21 02:02:02 +00:00
TreeHugger Robot
eca91f0a43 Merge "Mark libdemangle as vendor_available." into oc-dr1-dev 2017-06-21 00:05:39 +00:00
TreeHugger Robot
eb9ef24d42 Merge "ueventd: remove PlatformDeviceList" into oc-dr1-dev 2017-06-20 23:41:31 +00:00
Tom Cherry
5f4e8eac8a init: poll in first stage mount if required devices are not found
First stage mount in init currently attempts to regenerate uevents for
specific devices to create the corresponding dev nodes.  However, this
is racy as first stage mount happens early in the boot process and
it's possible that some of these devices have not yet been created by
the kernel.

To fix this issue, init will poll on the uevent socket for up to 10
seconds waiting for the kernel to create the required device.  It will
return false and panic if this 10 second timeout passes.

Note that the same uevent socket is used in the uevent regeneration
and the polling code, so there is no race if the device is created
after the uevent regeneration and before polling starts; the first
poll will pick up the device.

Bug: 62681642
Bug: 62682821
Test: Boot bullhead
Test: Boot sailfish
Test: Boot hikey + hotplug/unplug sdcard
Merged-In: I4a6ff043eb7115b729ca4954ebc6c9e000132993
Change-Id: I4a6ff043eb7115b729ca4954ebc6c9e000132993
2017-06-20 21:29:51 +00:00
Tom Cherry
bea663d04c init: poll in first stage mount if required devices are not found
First stage mount in init currently attempts to regenerate uevents for
specific devices to create the corresponding dev nodes.  However, this
is racy as first stage mount happens early in the boot process and
it's possible that some of these devices have not yet been created by
the kernel.

To fix this issue, init will poll on the uevent socket for up to 10
seconds waiting for the kernel to create the required device.  It will
return false and panic if this 10 second timeout passes.

Note that the same uevent socket is used in the uevent regeneration
and the polling code, so there is no race if the device is created
after the uevent regeneration and before polling starts; the first
poll will pick up the device.

Bug: 62681642
Bug: 62682821
Test: Boot bullhead
Test: Boot sailfish
Test: Boot hikey + hotplug/unplug sdcard
Merged-In: I4a6ff043eb7115b729ca4954ebc6c9e000132993
Change-Id: I4a6ff043eb7115b729ca4954ebc6c9e000132993
(cherry picked from commit c4ff5e803917f04574fe98f846875db77d0fd8f5)
2017-06-20 14:26:44 -07:00
Tom Cherry
f51657ccef ueventd: remove PlatformDeviceList
In order to create symlinks for USB and block devices, the path for
their parent platform device must be known.

Previously, ueventd would save each platform device that it encounters
to a list and query this list when creating the symlinks.  That,
however, is racy because the uevent socket does not differentiate
uevents from RegenerateUevents() and uevents sent by the kernel when
probing a device first the first time.  The below scenario is the
faulty  case:

1) Kernel probes parent platform device for a block device
2) ueventd calls RegenerateUevents() and starts processing uevents
3) Kernel probes block device and sends its uevents
4) ueventd picks up the block device uevent during its uevent processing,
   without yet regenerating the platform device uevent, causing improper
   symlinks to be created.

This change stops storing the platform devices in a list, and instead
traverses up the directory structure for each USB or block device
until it reaches a platform device, defined as one whose subsystem is
the platform bus.  This fixes the race and simplifies the ueventd
code.

Bug: 62436493
Bug: 62681642
Test: Boot bullhead
Test: Boot sailfish
Test: Init unit tests
Test: Boot hikey + hotplug/unplug sdcard
Merged-In: I21636355d8e434f30e0cba568598a6cf139e67f9
Change-Id: I21636355d8e434f30e0cba568598a6cf139e67f9
(cherry picked from commit c94ce7b130)
2017-06-20 14:26:15 -07:00
Tom Cherry
d43b615216 ueventd: remove PlatformDeviceList
In order to create symlinks for USB and block devices, the path for
their parent platform device must be known.

Previously, ueventd would save each platform device that it encounters
to a list and query this list when creating the symlinks.  That,
however, is racy because the uevent socket does not differentiate
uevents from device_init() and uevents sent by the kernel when
probing a device first the first time.  The below scenario is the
faulty case:

1) Kernel probes parent platform device for a block device
2) ueventd calls device_init() and starts processing uevents
3) Kernel probes block device and sends its uevents
4) ueventd picks up the block device uevent during its uevent processing,
   without yet regenerating the platform device uevent, causing improper
   symlinks to be created.

This change stops storing the platform devices in a list, and instead
traverses up the directory structure for each USB or block device
until it reaches a platform device, defined as one whose subsystem is
the platform bus.  This fixes the race and simplifies the ueventd
code.

Bug: 62436493
Bug: 62681642
Test: Boot bullhead
Test: Boot sailfish
Test: Boot hikey + hotplug/unplug sdcard
Merged-In: I21636355d8e434f30e0cba568598a6cf139e67f9
Change-Id: I21636355d8e434f30e0cba568598a6cf139e67f9
2017-06-20 21:22:00 +00:00
Martijn Coenen
dfcbcfdcdc Mark libdemangle as vendor_available.
This means the library may be installed in both the
/system and /vendor partitions, if they are used by
system and vendor code respectively.

Test: mm -j64
Bug: 38244611
Change-Id: I5874529d410a226c028a248b0d22ea5e80639445
Merged-In: I978f8e34d354e4fe03a3c19dd0dbc6899f26a793
2017-06-20 20:29:57 +00:00
Martijn Coenen
a7fa7e3ea5 Remove libmemunreachable from the VNDK.
It depends on functionality in the bionic
allocator, which may get updated independently
of the vendor partition (as libc is in the LL-NDK).

Bug: 33241851
Test: builds
Change-Id: I435679843229d0d4d2e2be7bfe8c27f558a016dd
Merged-In: I435679843229d0d4d2e2be7bfe8c27f558a016dd
2017-06-20 10:14:39 -07:00
Josh Gao
34abac7d36 adb: increase the shell command length limit.
Relax the shell command length limits when talking to an adbd with the
shell protocol.

shell is pretty much the only service that takes an arbitrarily long
string, so this is somewhat safe.

Bug: http://b/37716055
Test: `adb shell $(python -c 'print "echo " + "f" * (32*1024)') | wc` on L and master

Merged-In: I0737fd2244530ef8080f300cd3a3549a1ab93465
Change-Id: I0737fd2244530ef8080f300cd3a3549a1ab93465
2017-06-20 16:55:12 +00:00
Erik Staats
56876ad518 Merge "Add building and installing of grep for vendor." into oc-dr1-dev 2017-06-19 22:27:10 +00:00
TreeHugger Robot
38eb25e157 Merge "adb: fix deadlock between transport_unref and usb_close." into oc-dr1-dev 2017-06-19 20:58:22 +00:00
Tom Cherry
9cf4000f92 Merge "init: move killing of process groups to libprocessgroup" into oc-dr1-dev 2017-06-19 20:38:37 +00:00
Erik Staats
76d8d36ed8 Add building and installing of grep for vendor.
Merged from
0c3b1bd2a5 .

Bug: 38240024
Test: Verified that grep is installed in /vendor/bin.  See details in testing
done comment in https://googleplex-android-review.git.corp.google.com/2428550 .
Change-Id: I15e1f9994af90fc7edccf35adbbcef349aca6929
2017-06-19 13:12:37 -07:00
Josh Gao
d1f7fef69b adb: fix deadlock between transport_unref and usb_close.
Fix a deadlock that happened when a reader/writer thread released a
transport while the hotplug thread attempted  to handle a device
disconnection. Decrementing a transport refcount to zero would hold the
global transport mutex and attempt to take the usb handles mutex, while
the hotplug thread would hold the usb handles mutex and try to call
unregister_usb_transport, which would attempt to take the global
transport mutex.

Resolve this by making transport_unref not take the global transport
mutex.

Bug: http://b/62423753
Test: python test_device.py
Merged-In: Ib48b80a2091a254527f3a7d945b6a11fae61f937
Change-Id: Ib48b80a2091a254527f3a7d945b6a11fae61f937
(cherry picked from commit 7e197ef833)
2017-06-19 11:17:44 -07:00