Commit graph

34309 commits

Author SHA1 Message Date
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
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
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
TreeHugger Robot
fe11ca5421 Merge "Add a helpful error message if GetUnreachableMemory fails" into oc-dr1-dev 2017-06-16 04:11:50 +00:00
Colin Cross
952adf44bf Add a helpful error message if GetUnreachableMemory fails
The primary reason for GetUnreachableMemory failing is selinux
blocking system apps from ptracing themselves.  Add a helpful
error message suggesting setenforce 0.

Bug: 27945735
Test: dumpsys meminfo --unreachable com.android.systemui
Change-Id: Ibfa9507860be36dffd514f82027f7a2f8a72ac48
Merged-In: Ibfa9507860be36dffd514f82027f7a2f8a72ac48
(cherry picked from commit 72d3881412)
2017-06-15 13:15:09 -07:00
Tom Cherry
6f45ffc961 init: move killing of process groups to libprocessgroup
libprocessgroup kills the cgroup associated with a given pid and uid,
but not the POSIX process group associated with it.  This means that
to kill both, two of the same signals must be sent, which may cause
some issues.

This change kills all POSIX process groups whose group leaders are
found within a cgroup.  It only then kills processes in the cgroup
that are not part of the POSIX process groups that have been killed.

Bug: 37853905
Bug: 62418791
Test: Boot, kill zygote, reboot
Change-Id: Id1d96935745899b4c454c36c351ec16a0b1d3827
(cherry picked from commit 70a5ed49ef)
2017-06-15 10:21:05 -07:00
TreeHugger Robot
3c7cde0cd4 Merge "Add more logs for writing failures." into oc-dr1-dev 2017-06-15 00:32:40 +00:00
Hung-ying Tyan
6bb4667f47 Merge changes from topic 'move-default-prop-v2' into oc-dev
am: c6b07ec095  -s ours

Change-Id: I4e24182b8e7f3955d359b38d5ff62af1c44ce423
2017-06-14 02:29:29 +00:00
Hung-ying Tyan
c6b07ec095 Merge changes from topic 'move-default-prop-v2' into oc-dev
* changes:
  Load /prop.default in recovery mode
  Revert "Revert "Load default prop from /system/etc/prop.default""
2017-06-14 02:13:50 +00:00
TreeHugger Robot
058aab30b8 Merge "tombstoned: log where we're writing the tombstone." into oc-dr1-dev 2017-06-13 16:37:48 +00:00
Hung-ying Tyan
75801ab5e3 Load /prop.default in recovery mode
Bug: 37815285
Bug: 62525809
Test: Tested with ag/2398663 and ag/2400523. Booted pixel phones,
      checked the location of prop.default, verified the symlink,
      checked a few properties via adb shell and manually tested
      a few apps.
      Booted to recovery and ran 'adb sideload' successfully.
Change-Id: I034b700fcd60b0104873131e94864b16ef4bd9f6
2017-06-13 21:22:50 +08:00
Hung-ying Tyan
12ea2d12ef Revert "Revert "Load default prop from /system/etc/prop.default""
This reverts commit 98a73a2ce1.

Bug: 37815285
Bug: 62525809
Test: Tested with ag/2398663 and ag/2400524. Booted pixel phones,
      checked the location of pro.default, verified the symlink
      at /default.prop, checked a few properties via adb shell and
      manually tested a few apps.
      Booted to recovery mode and ran 'adb sideload' successfully.
Change-Id: I407412a7002b898ffb352cb5f331cab9c15be39a
2017-06-13 21:22:06 +08:00
Josh Gao
55213b6b23 Merge "tombstoned: log where we're writing the tombstone." into oc-dev
am: 855333f346  -s ours

Change-Id: I6b28215be9b3b7586d7fe93f942e43af1067ec9e
2017-06-13 06:45:49 +00:00
Josh Gao
cc25d86de9 tombstoned: log where we're writing the tombstone.
Make it easy to find out where a specific crash's tombstone was written
to by adding a log.

Bug: http://b/62268830
Test: crasher
Merged-In: I1961dfb19f76a42a8448ebafd4be153b73cb6800
Change-Id: I7da49a96bf76dbaa3558ba64539f33283f916d8f
(cherry picked from commit cb68a0317d)
2017-06-12 23:41:45 -07:00
TreeHugger Robot
855333f346 Merge "tombstoned: log where we're writing the tombstone." into oc-dev 2017-06-13 05:35:09 +00:00
Josh Gao
3272000382 tombstoned: log where we're writing the tombstone.
Make it easy to find out where a specific crash's tombstone was written
to by adding a log.

Bug: http://b/62268830
Test: crasher
Merged-In: I1961dfb19f76a42a8448ebafd4be153b73cb6800
Change-Id: I1961dfb19f76a42a8448ebafd4be153b73cb6800
(cherry picked from commit cb68a0317d)
2017-06-12 21:02:02 +00:00
Tao Bao
869f48a256 Merge "Revert "Load default prop from /system/etc/prop.default"" into oc-dev
am: 642ca632f6  -s ours

Change-Id: Ice9637c768c0ef1bf60e603e31be3f5403c81aa3
2017-06-12 19:57:06 +00:00
Tao Bao
642ca632f6 Merge "Revert "Load default prop from /system/etc/prop.default"" into oc-dev 2017-06-12 19:39:53 +00:00
Tao Bao
98a73a2ce1 Revert "Load default prop from /system/etc/prop.default"
This reverts commit 810d71b005.

init fails to read default.prop under recovery:
init: Couldn't load properties from /default.prop: Too many symbolic links encountered

Bug: 62525809
Change-Id: I1f84a18e545e1307dcb230be51606cca731667f9
2017-06-12 17:07:11 +00:00
TreeHugger Robot
1a7a5419d0 Merge "Don't allow libui.so to RS drivers." into oc-dr1-dev 2017-06-12 02:04:21 +00:00
Daichi Hirono
e5a1556d40 Add more logs for writing failures.
Bug: 62429763
Test: libappfuse_test
Change-Id: Ie0eabd09ae9ad3f8ba8c4f38f871dad16b5c58ff
2017-06-12 10:37:08 +09:00
TreeHugger Robot
998e3b28ba Merge "first stage mount: removing the restriction of mount points" into oc-dr1-dev 2017-06-10 11:41:29 +00:00
Jiyong Park
9242f68c0d Don't allow libui.so to RS drivers.
libui.so is not VNDK-SP, so it must not be allowed to RS drivers.

Bug: 37550338
Test: camerascript app works well in 2017 pixel devices
Change-Id: I34971baebdc91f11935d1eb4ddd07d89d4c38958
2017-06-09 17:38:28 +09:00
Hung-ying Tyan
8d87ae4794 Merge "Load default prop from /system/etc/prop.default" into oc-dev
am: 0af496af01  -s ours

Change-Id: Iba712935e81f5a11d524c889f9f7b0ba405f5283
2017-06-09 08:12:20 +00:00