Commit graph

29890 commits

Author SHA1 Message Date
Tom Cherry
ccf0d39316 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
Change-Id: I4a6ff043eb7115b729ca4954ebc6c9e000132993
2017-06-20 21:23:42 +00:00
Tom Cherry
137ee511bd Merge "ueventd: remove PlatformDeviceList" 2017-06-20 21:23:17 +00:00
Tom Cherry
c94ce7b130 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
Change-Id: I21636355d8e434f30e0cba568598a6cf139e67f9
2017-06-20 21:21:14 +00:00
Christopher Ferris
9d239ec6a5 Merge "Fix some memory leaks, potential errors." 2017-06-20 18:29:24 +00:00
Treehugger Robot
643b4776b5 Merge "libcutils: Clarify schedboost_enabled()" 2017-06-20 18:10:15 +00:00
Narayan Kamath
d1e9e7bc06 Merge "zip_archive_test: compare error codes directly." 2017-06-20 10:50:27 +00:00
Tom Cherry
2787894768 Merge "Move restorecon() of /sys from init to ueventd." 2017-06-20 01:13:37 +00:00
Tom Cherry
d2fd54e0ff Move restorecon() of /sys from init to ueventd.
ueventd already does restorecon() for /sys/{block,class,devices}, so
instead of duplicating this effort with init, move the restorecon()
that init does for all of /sys to ueventd.

Bug: 62420036
Change-Id: I6125f8ff5316a0cf45872d1100d089d71802958f
Merged-In: I6125f8ff5316a0cf45872d1100d089d71802958f
Test: Boot sailfish, bullhead
2017-06-20 00:02:05 +00:00
Christopher Ferris
051792fed4 Fix some memory leaks, potential errors.
Fix a couple of memory leaks in tests.

Fix a potential case that length could be zero.

Bug: 23762183

Test: Ran unit tests, then ran valgrind on unit tests and verified no leaks.
Change-Id: I5f7602aa0204db0488a8e305250658cdb6e977d0
2017-06-19 16:20:33 -07:00
Christopher Ferris
27fea2c295 Merge "Add EH frame and debug frame support." 2017-06-19 21:37:26 +00:00
Treehugger Robot
ad4aa9e169 Merge "init: Run restorecon_recursive asynchronously" 2017-06-19 17:52:02 +00:00
Neil Fuller
acb6473793 Merge "Move system/core/tzdatacheck to system/timezone" 2017-06-19 13:54:38 +00:00
Narayan Kamath
1ef9d2dfbe zip_archive_test: compare error codes directly.
Make them available to tests so that they can compare values
directly instead of comparing error code strings.

Test: zip_archive_test
Change-Id: I1c78c24651ff7549b5125a49a4e67bbd8295c617
2017-06-19 13:03:41 +01:00
Treehugger Robot
dd622c5c34 Merge "Mark libdemangle as vendor_available" 2017-06-19 03:24:09 +00:00
Jaesung Chung
fae8ec2556 Merge "debuggerd_test: find backtrace frame in all lines in CrasherTest" 2017-06-19 00:11:51 +00:00
Jaesung Chung
31f2c81755 Merge "logd-unit-tests: make sure use unsigned types when reading le" 2017-06-19 00:10:52 +00:00
Treehugger Robot
9d2e688b9a Merge "adb: increase the shell command length limit." 2017-06-17 21:57:12 +00:00
Josh Gao
a019f78141 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
Change-Id: I0737fd2244530ef8080f300cd3a3549a1ab93465
2017-06-16 18:01:11 -07:00
Tom Marshall
62696908ff init: Run restorecon_recursive asynchronously
restorecon_recursive may take a long time if there are a lot of files on
the volume.  This can trigger a watchdog timeout in any process that
tries to set a property while it is running.  Fix this by running
restorecon_recursive in its own process.

See https://jira.lineageos.org/browse/BUGBASH-555

Change-Id: I2ce26ff2b5bfc9a133ea42f4dbac50a3ac289c04
2017-06-16 18:00:08 -07:00
Treehugger Robot
23bcbf040d Merge "Add building and installing of grep for vendor." 2017-06-16 23:24:32 +00:00
Alex Naidis
2d998ea99b libcutils: Clarify schedboost_enabled()
Commit 795267d4c7 ("Removed cpusets/schedboost build time dependency.")
turned the cpusets and schedtune options into runtime
decisions.

However the kernel option which is mentioned in the
code comment (CONFIG_SCHEDTUNE) is very misleading
as it doesn't exist (CONFIG_SCHED_TUNE does exist)
and it doesn't describe the real functionality of
the method. schedboost_enabled() will still return
false if CONFIG_SCHED_TUNE is set in the kernel but
CONFIG_CGROUP_SCHEDTUNE is not.

So to clarify this, we need to change the comment
to reflect that CONFIG_CGROUP_SCHEDTUNE, which depends
on CONFIG_SCHED_TUNE, is required.

Signed-off-by: Alex Naidis <alex.naidis@linux.com>
2017-06-16 21:30:49 +00:00
Christopher Ferris
61d4097737 Add EH frame and debug frame support.
Bug: 23762183

Test: Pass new unit tests.
Change-Id: I1bfe900e068017ff31998f359bf98d4c5c9af2a5
2017-06-16 14:25:29 -07:00
Neil Fuller
c6835b49e7 Move system/core/tzdatacheck to system/timezone
Move system/core/tzdatacheck to system/timezone.

Test: make droid
Bug: 31008728
Change-Id: I193767715956cb6076b7ec4a5240d4883a171fbf
2017-06-16 15:39:03 +01:00
Neil Fuller
6794bc7d37 Merge "Track movement of some libcore/tzdata files" 2017-06-16 14:37:18 +00:00
Neil Fuller
d38c848049 Track movement of some libcore/tzdata files
Some files in libcore/tzdata are moving to system/timezone
under the package com.android.timezone.distro.

Bug: 31008728
Test: run cts -m CtsHostTzDataTests
Merged-In: I2600dd4bee22a571b9eb7303733591b60d1a8b2a
Change-Id: I2600dd4bee22a571b9eb7303733591b60d1a8b2a
2017-06-16 11:55:41 +00:00
Jaesung Chung
58778e138e debuggerd_test: find backtrace frame in all lines in CrasherTest
Kernel can use vsyscall for system calls. The vsyscall implementation in
the kernel gives one more depth in the backtrace. It leads to failures
on CrasherTest. This CL makes tests find a system call frame not only in
the first line but also in all lines on the backtrace.

Bug: 62600694
Test: passes all CrasherTests.
Change-Id: Ice383bb94db097e7e9a9e4f74d8fa5ecc528122a
2017-06-16 19:16:50 +09:00
Jaesung Chung
23f1d09b74 logd-unit-tests: make sure use unsigned types when reading le
The get4LE method needs to use unsigned types since the sign char values
can lead to producing wrong values.

Bug: 62599757
Test: passes all test cases of logd-unit-tests.
Change-Id: Ifaf83533d847ea4fbe0cd46a978f4dabbfa7df8d
2017-06-16 17:45:37 +09:00
Colin Cross
72ca50359e Merge "Add a helpful error message if GetUnreachableMemory fails" 2017-06-15 23:10:16 +00:00
Erik Staats
0c3b1bd2a5 Add building and installing of grep for vendor.
Bug: 38240024
Test: Verified that grep is installed in /vendor/bin. See details in
testing done comment in https://android-review.googlesource.com/412061 .
Change-Id: I06007014779310bc24c65f7343111c5217ba6ff0
2017-06-15 15:04:41 -07:00
Elliott Hughes
3e67944d2e Merge "Add libziparchive-based unzip." 2017-06-15 21:30:56 +00:00
Treehugger Robot
243ab9cc7e Merge "Revert workaround of clang-tidy segmentation fault." 2017-06-15 18:57:51 +00:00
Colin Cross
72d3881412 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
2017-06-15 10:57:37 -07:00
Tom Cherry
fbbb3bd49a Merge "init: move killing of process groups to libprocessgroup" 2017-06-15 17:17:22 +00:00
Chih-Hung Hsieh
47bd75701b Revert workaround of clang-tidy segmentation fault.
Problem was fixed in new rebased clang-tidy.
Bug: 38002385
Test: build with WITH_TIDY=1
Change-Id: Ic22d016fb2d402c3eee16226be507f5d4cfa2818
2017-06-15 10:05:04 -07:00
Narayan Kamath
b001cc5b1c Merge "zip_archive: validate data descriptor contents." 2017-06-15 10:52:33 +00:00
Treehugger Robot
7bdbe0010c Merge "Remove <sys/mtio.h> workaround." 2017-06-15 02:40:35 +00:00
Elliott Hughes
c286f47dd1 Remove <sys/mtio.h> workaround.
Bug: N/A
Test: builds
Change-Id: I4f2f615720639cb6ec4ac8a6b08c5907008f98ee
2017-06-14 17:17:16 -07:00
Treehugger Robot
5f4808382e Merge "Va_end should be used with va_start" 2017-06-14 23:00:42 +00:00
Treehugger Robot
04c4f40a82 Merge "libziparchive: verify that gpb flags match" 2017-06-14 15:20:56 +00:00
Narayan Kamath
162b705801 zip_archive: validate data descriptor contents.
- Ensure that the compressed and uncompressed lengths in the data
  descriptor match those in the central directory.

- Calculate CRCs for compressed entries and ensure that those CRCs
  match the information in the central directory / data descriptor.
  This is currently guarded by a flag and will be turned on at a
  later stage.

- Finally, always trust the LFH when it comes to indicating the
  existence of a data descriptor. We no longer require this info to
  match the central directory to bring this in line with other zip
  processing tools. (see NOTE in the included change).

Bug: 62047801
Test: zip_archive_test
Change-Id: Icceea66a8b1937c08a4af9aee97bc77ad7218c0f
2017-06-14 14:29:53 +01:00
Adam Lesinski
1d105aa597 libziparchive: verify that gpb flags match
The Central File Header and Local File Header should
have the same general purpose bit flags set for
consistency.

Bug: 36686974
Test: existing tests pass (ziparchive-tests)

(cherry picked from commit 73b3aa541f)

Change-Id: Ia672a28732154a564ea2f2e3520238bb77924a56
2017-06-14 14:25:55 +01:00
Jiyong Park
8944432589 Mark libdemangle as vendor_available
The lib is used by libc_malloc_debug_backtrace which is
vendor_available. libc_malloc_debug_backtrace is marked as such because
it is again used by libmemunreachable which is vendor_available.

Bug: 33241851
Test: BOARD_VNDK_VERSION=current m -j libmemunreachable.vendor
Change-Id: I978f8e34d354e4fe03a3c19dd0dbc6899f26a793
2017-06-14 18:58:22 +09:00
Josh Gao
550f3bf328 Merge "Revert "crash_dump: defer pausing threads until we're ready."" 2017-06-13 18:22:01 +00:00
Josh Gao
3407d7c80f Revert "crash_dump: defer pausing threads until we're ready."
This reverts commit 8a2a2d182a.

Bug: http://b/62572585
Change-Id: Ia4278bca52178eb7b7b28b30d0930b292d97f353
2017-06-13 17:21:12 +00:00
Treehugger Robot
87f5432f52 Merge "tombstoned: log where we're writing the tombstone." 2017-06-13 02:47:34 +00:00
Treehugger Robot
66e1a1e3e2 Merge changes Id7ab0464,Ic2a212be
* changes:
  crash_dump: defer pausing threads until we're ready.
  crash_dump: add tracing.
2017-06-12 23:08:24 +00:00
Treehugger Robot
6f61a6d9c4 Merge "adb: fix deadlock between transport_unref and usb_close." 2017-06-12 23:03:55 +00:00
Treehugger Robot
b3c363f32c Merge "adbd: optionally use qemud pipe without ro.kernel.qemu" 2017-06-12 21:33:00 +00:00
Josh Gao
cb68a0317d 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
Change-Id: I1961dfb19f76a42a8448ebafd4be153b73cb6800
2017-06-12 21:00:59 +00:00
Elliott Hughes
6cc5927e0d Merge "Fix prctl argument type" 2017-06-12 19:48:23 +00:00