Commit graph

40020 commits

Author SHA1 Message Date
Josh Gao
abb634308f adb: bump the local socket backlog to the maximum.
The listen backlog seems to be more meaningful on Darwin than on Linux,
resulting in connections failing with ECONNRESET. Bump it up to the
maximum supported value to make this less likely. 128 pending
connections ought to be enough for anybody.

Bug: http://b/74616284
Test: python test_device.py
Change-Id: I5fe0205924188cf18ca1fc1204f923ab5523eeb2
(cherry picked from commit bf243a6128)
2018-03-28 23:36:34 -07:00
Josh Gao
cc9414eda4 adb: delete vestigial SHELL_EXIT_NOTIFY_FD.
There exists no path through which a value other than -1 can be written
to the SHELL_EXIT_NOTIFY_FD.

Bug: http://b/74616284
Test: adb_test
Test: adbd_test
Test: python test_device.py
Change-Id: I0630c302ba06bc76917f0445aea75d2dbe1dc865
(cherry picked from commit dcc055af64)
2018-03-28 23:36:32 -07:00
Josh Gao
7c87b0739a adb: don't immediately close a socket when write fails.
When we fail to write to a local socket peer, we might still have data
queued up to send to the other side. Defer closing the socket until
we've failed to both read and write.

Bug: http://b/74616284
Test: python test_device.py
Change-Id: Ifc4b8fe95369b4872e475c2ae4ee611dd2d8b9d7
(cherry picked from commit 184f480547)
2018-03-28 23:36:28 -07:00
Josh Gao
3b0146cc37 adb: make fdevent_run_on_main_thread's fd nonblocking.
If we get a ton of fdevent_run_on_main_thread calls while running one
of the handlers, the socket might become full, which will result in a
deadlock in fdevent_run_on_main_thread when a write to the fd blocks
with the mutex taken. Resolve this by making the fd nonblocking, which
is safe because we always write after appending to the list, and read
before emptying the list, which guarantees that if the byte we write is
consumed, the std::function we appended will be run.

Bug: http://b/74616284
Test: adb_test
Test: python test_device.py
Change-Id: I29319bda2ad7b5a5cdcd91d1d0ddf39f7ab7d115
(cherry picked from commit 1222abc75b)
2018-03-28 23:36:24 -07:00
Josh Gao
9edb94fb6b adb: skip IPv6 test if IPv6 isn't available.
Bug: http://b/69813298
Test: none
Change-Id: I0793e793bd52c5f1c639faedf09a513df263db78
(cherry picked from commit 4abb5074be)
2018-03-28 23:36:20 -07:00
Josh Gao
fd6ffb8ad5 adb: add adb shell exit 42 stress test.
Add a test to hammer on `adb shell exit $n` for flakiness.

Bug: http://b/74616284
Test: python test_device.py
Change-Id: I6a842960f5b55ff739044698f5c9683992fc42f1
(cherry picked from commit c970aefada)
2018-03-28 23:36:17 -07:00
Josh Gao
e523e4e54b adb: improve socket tests.
Make it so that the socket tests don't leak until your machine blows up
by switching an infinite loop into an assertion failure.

Bug: http://b/74616284
Test: adb_test
Change-Id: If618c26b224b660548454f542cab79bebe46f80e
(cherry picked from commit ecb96ac04d)
2018-03-28 23:36:14 -07:00
Josh Gao
28589bbe18 adb: implement std::make_unique, start using it.
Add an implementation of std::make_unique for Windows, where we're
currently stuck with C++11, and switch some uses of new over to it.

Bug: http://b/74616284
Test: treehugger
Change-Id: I99b85f07754adda7c525243480c3e0bce9a25ce7
(cherry picked from commit 31b5be69f4)
2018-03-28 23:36:12 -07:00
Josh Gao
1430d39be6 adb: add test for flushing socket data after a write failure.
Add a currently failing test that's a reduced case of the 'concurrent
adb shell' flakiness reported in b/74616284.

Bug: http://b/74616284
Test: changed #if 0 to #if 1, test fails
Change-Id: Id170a185f7c5d2ff44f772f7849a73227f9df441
(cherry picked from commit df3bae9f06)
2018-03-28 23:36:09 -07:00
TreeHugger Robot
6c4ed57065 Merge "Adding odm.img for fastboot flashall" into pi-dev 2018-03-29 04:07:32 +00:00
Bowgo Tsai
de2472d63e Adding odm.img for fastboot flashall
Bug: 64195575
Test: fastboot flashall
Change-Id: Ie6c20a1004867e7c9cfa1894abab9252316a9154
Merged-In: Ie6c20a1004867e7c9cfa1894abab9252316a9154
(cherry picked from commit 017217ec57)
2018-03-29 08:18:37 +08:00
Jaekyun Seok
fce960cdf4 Allow vendor-init-actionable for ro.debuggable
Some partners are using ro.debuggable as action trigger to config a
product differently according to its value.

Bug: 75987246
Test: succeeded building and tested taimen
Change-Id: I4cc57e7b52e17fc89e585afa0a8a10925e47fac8
Merged-In: I4cc57e7b52e17fc89e585afa0a8a10925e47fac8
(cherry picked from commit 4f214c5179)
2018-03-29 04:21:22 +09:00
Tom Cherry
36a716dc1f Merge "Revert "fs_config: Move hostapd to /vendor/bin/hw"" into pi-dev 2018-03-28 18:30:49 +00:00
Tom Cherry
666464a180 Revert "fs_config: Move hostapd to /vendor/bin/hw"
This reverts commit 656b75c77c.

Capability bits are moving from fs_config.cpp to the associated init
scripts for daemons on /vendor.

Bug: 74554159
Test: wifi tethering works on walleye
2018-03-28 18:29:02 +00:00
TreeHugger Robot
136f765fb3 Merge "lmkd: Protect against buffer overflow" into pi-dev 2018-03-28 01:44:33 +00:00
Greg Kaiser
d6d847142b lmkd: Protect against buffer overflow
We're passing a 'line' whose backing buffer is PAGE_MAX in size
into memory_stat_parse_line().  We protect overflowing the smaller
LINE_MAX 'key' buffer via some C preprocessing macros to assure
we limit the size.

Test: Local build with LMKD_LOG_STATS set for this file.
Bug: 76220622
Merged-In: I9e50d4270f7099e37a9bfc7fb9b9b95cc7adb086
Change-Id: I9e50d4270f7099e37a9bfc7fb9b9b95cc7adb086
2018-03-27 21:59:31 +00:00
Christopher Ferris
af16967ec8 Method to avoid skipping frames for local unwinds.
In cases where there might be a crash in the unwind library itself,
we need a method to avoid skipping these frames or we won't be able
to see the actual crash.

Added unit test for this behavior.

Bug: 74121887

Test: Ran unit tests on host and target.
Change-Id: I45825020c174016af39dd8ffdc67acb72a24ad4d
(cherry picked from commit 458f4e725d)
2018-03-27 11:12:41 -07:00
Tom Cherry
677bed578e Merge "Verify the SELabels used in property_contexts" into pi-dev 2018-03-27 16:45:39 +00:00
TreeHugger Robot
88993acd95 Merge "Adding product.img for fastboot flashall" into pi-dev 2018-03-27 04:30:40 +00:00
Jerry Zhang
ca47ae3513 Merge "Remove sys.usb.ffs.mtp.ready property" into pi-dev 2018-03-27 02:49:02 +00:00
TreeHugger Robot
64250b5abe Merge "Allow android::base::ScopeGuard in STL containers" into pi-dev 2018-03-27 02:29:20 +00:00
Bowgo Tsai
7e50de4449 Adding product.img for fastboot flashall
Bug: 64195575
Test: fastboot flashall

Change-Id: Ifd119650dd3316508870df0dfc770099e95ae1d1
Merged-In: Ifd119650dd3316508870df0dfc770099e95ae1d1
(cherry picked from commit 0afc6b07f1)
2018-03-27 09:40:35 +08:00
Luis Hector Chavez
f6965c793a Allow android::base::ScopeGuard in STL containers
This change lets android::base::ScopeGuard be useful in STL containers
(e.g. std::vector<android::base::ScopeGuard<std::function<void()>>>). It
also provides perfect forwarding for android::base::make_scope_guard.

Bug: 34764308
Test: libbase_test

Change-Id: I7d1e5494b0f0695763cff0700efdb9ec18ae85c8
Merged-In: I7d1e5494b0f0695763cff0700efdb9ec18ae85c8
(cherry picked from commit b77035b89a)
2018-03-27 00:38:06 +00:00
Tom Cherry
daaf3aa226 Verify the SELabels used in property_contexts
Verify that the SELabels used in property_contexts correspond to a
real type in the SEPolicy and that this type has the property_type attribute.

Bug: 74078792
Test: Build property_contexts on bullhead successfully
Test: See failure when using a faulty SELabel in property_contexts
Change-Id: If1618c2c3dae4c0cd3efa5f88056478a6db6bd0b
(cherry picked from commit 882faa6448)
2018-03-26 16:32:05 -07:00
TreeHugger Robot
42c17c8ee5 Merge "Use usel_mkd_stats_log build variable while compiling lmkd with stats logging feature." into pi-dev 2018-03-26 23:14:23 +00:00
Rajeev Kumar
1c669f764d Fix compilation issue when LMKD_LOG_STATS is defined.
Note: The breakage was caused by http://ag/3621623

Test: mmma system/core/lmkd/
Change-Id: I17033aeedb3183d4777dacb89ec84430ff061b3c
Bug: 74443701
(cherry picked from commit fb25ddd9c9)
2018-03-26 18:15:25 +00:00
Martijn Coenen
ffeb7ecc3f Merge "Add new trace tag for AIDL." into pi-dev 2018-03-24 05:58:25 +00:00
Rajeev Kumar
b7273785a2 Use usel_mkd_stats_log build variable while compiling lmkd with stats logging feature.
Bug: 74443701
Test: Tested manually
Merged-In: Ifa13cc7d1c3ff3ac71a16cf55be5a48ce808ef59
Change-Id: Ifa13cc7d1c3ff3ac71a16cf55be5a48ce808ef59
(cherry picked from commit 083be30783)
2018-03-23 20:33:57 +00:00
Jerry Zhang
6e9a327504 adb: Retry io in case of interrupt
io_submit sleeps waiting for the gadget
to be enabled. Currently if that sleep
is interrupted it will shut down adb,
causing it to have to start back up again.

Rather than return EINTR if interrupted,
io_submit actually completes and the EINTR
is found later when looking through events.
Since an io that is interrupted will be
small anyway, add a loop to retry small ios.

Also upgrade aio logs in accordance with
their importance.

Fixes: 75981904
Test: adb works, logs show successful interrupt handling
Change-Id: I35973fce130ee849ce59fef80d15b65afb816ba4
2018-03-23 00:11:05 +00:00
Jerry Zhang
50108b3f49 Remove sys.usb.ffs.mtp.ready property
With the usb control fd changes, there
is no longer a need to wait for this
property to trigger before starting the
connection.

Bug: 72877174
Test: switch config to mtp/ptp
Change-Id: Ib29419e7948025be3f3295106cad18943d314f0b
2018-03-22 11:35:20 -07:00
Benedict Wong
1f70d1cac5 Merge "Set SPI Allocation Timeout to One Hour" into pi-dev 2018-03-21 17:03:39 +00:00
Martijn Coenen
07b98d9b97 Add new trace tag for AIDL.
So we can auto-generate tracing code for AIDL interfaces.

Bug: 74416314
Test: inspect atrace output
Change-Id: I91b14b3b16d8d7a29f531101b14ddf10dbc61a5a
2018-03-21 13:59:34 +01:00
TreeHugger Robot
be3cd3c0d8 Merge "/postinstall/* does not search for a lib in /vendor or /odm" into pi-dev 2018-03-20 18:56:40 +00:00
Tom Cherry
16e2e9d4da Merge "Revert "init: Reboot after timeout passes during reboot"" into pi-dev 2018-03-20 18:42:43 +00:00
Benedict Wong
89c9c9b18b Set SPI Allocation Timeout to One Hour
This change increases the default expiration length of an SA to 1h. The
IPsec API expects that SPIs are allocated indefinitely, but potential
for instability requires that these get cleaned up automatically. As
such, the duration was chosen as a sane, but long timeout value.

Bug: 72316671
Test: Added CTS tests to enforce this behavior
Merged-In: I47aef9cea4a09da253b2ec048a8797af5fa25529
Change-Id: I47aef9cea4a09da253b2ec048a8797af5fa25529
(cherry picked from commit 00308f8554)
2018-03-20 11:32:40 -07:00
Jiyong Park
955029aa1b /postinstall/* does not search for a lib in /vendor or /odm
There has been no section in the linker config file for the binaries
under /postinstall. As a result, the binaries were run with the legacy
default config where /vendor/lib and /odm/lib are added to the search
paths. This is causing selinux denials as the binaries for OTA are not
allowed to access /vendor/lib or /odm/lib, but the dynamic linker calls
realpath(3) on the paths to canonicalize them.

Fixing the issue by letting /postinstall/* binaries to run with a
dedicated linker namespace config, where /vendor/lib and /odm/lib are
not added to the search paths. Not having the paths is okay because
he OTA binaries should not have dependency to the libs there.

Bug: 75287236
Test: do the OTA, selinux denials on postinstall_file is not shown
Test: above test should pass on  wahoo, marlin and pre-treble devices
Merged-In: I49c11a0929002adfef667890c0a375c2b41054f4
Change-Id: I49c11a0929002adfef667890c0a375c2b41054f4
(cherry picked from commit d7e6cb27b6)
2018-03-21 01:25:55 +09:00
Tom Cherry
ea31ac2514 Revert "init: Reboot after timeout passes during reboot"
This reverts commit c9fec9d2be.

Looks like ext4 can't handle a system reboot happening in the middle
of an unmount.  We'll have to find another way to handle this.

Bug: 74817735
Bug: 75310371
Test: reboot device
Merged-In: Ib4f7f7fd29988a31a99f146c40f6d987c1fef15e
Change-Id: I7c097ba5734e2e4ff320c8b02fb58324d9380513
2018-03-20 13:39:00 +00:00
TreeHugger Robot
bfb490e3e8 Merge "Allow vendor_init_actionable to persist.sys.usb.usbradio.config" into pi-dev 2018-03-20 03:46:42 +00:00
Jaekyun Seok
56f832e561 Allow vendor_init_actionable to persist.sys.usb.usbradio.config
persist.sys.usb.usbradio.config can be used as an action trigger in
vendor init scripts.

Bug: 75202311
Bug: 74266614
Test: succeeded building and tested on pixels
Change-Id: I123b5ebce4bbf33f41222c2e11137d52e38ff9f8
2018-03-20 07:40:16 +09:00
Yabin Cui
414df3e583 Always set the sp reg to the cfa for DWARF.
There are a few places where it is assumed that this register is
set to the cfa value when interpreting DWARF information.

Add a testcase for unwinding art_quick_osr_stub on ARM.

Bug: 73954823

Test: Ran libunwindstack/libbacktrace unit tests.
Test: Random debuggerd -b of process on a hikey.
Test: Ran the 137 art test on host.
Change-Id: Ida6ccdc38c3cfeea6b57fe861a0cc127b150b790
(cherry picked from commit 11e96fe48a)
2018-03-19 11:11:19 -07:00
TreeHugger Robot
8dca85f0c8 Merge "adb: checks device state when using adb disable-verity for AVB" into pi-dev 2018-03-17 08:03:18 +00:00
TreeHugger Robot
6665d991e1 Merge "Support /odm partition" into pi-dev 2018-03-16 07:07:39 +00:00
Bowgo Tsai
45a00fdcce adb: checks device state when using adb disable-verity for AVB
adb disable-verity will toggle a flag in /vbmeta and introduce AVB
verification error on next boot. If the device is LOCKED, it will make
the device unbootable because verification error isn't allowed when the
device is locked.

Also indicating 'adb root' when failed to get verity state.

Bug: 70969453
Test: adb disable-verity should pop-up warning if the device is locked.

Change-Id: I1ed705e34334ea2231c96b16ddb8d225067af2f0
Merged-In: I1ed705e34334ea2231c96b16ddb8d225067af2f0
(cherry picked from commit 8cc9c3835a)
2018-03-16 15:06:23 +08:00
Bowgo Tsai
6795ef7bb2 Support /odm partition
Bug: 64195575
Test: boot a device

Change-Id: I52c0da32aef80c060f6efa47ddf62577fb543ad8
Merged-In: I52c0da32aef80c060f6efa47ddf62577fb543ad8
(cherry picked from commit 39476ffd8a)
2018-03-16 15:02:00 +08:00
TreeHugger Robot
8c907c65e6 Merge "Handle ARM thumb function symbols." into pi-dev 2018-03-16 04:56:25 +00:00
TreeHugger Robot
4031e1a46e Merge "Stop using SO_SNDBUFFORCE" into pi-dev 2018-03-16 03:00:44 +00:00
Christopher Ferris
b70b4a5bcd Handle ARM thumb function symbols.
ARM thumb functions will have the zero bit set to one, which can cause
function name lookups to fail.

Add an ARM special GetFunctionName that handles this condition.

Fix a couple of the function offsets in unit tests.

Bug: 74844137

Test: Ran unit tests.
Test: Ran debuggerd -b on processes on a bullhead device.
Change-Id: Ibd407db34eaaa641f91fdb4f589c44a0dcc0216a
(cherry picked from commit 704ec9adba)
2018-03-15 19:28:23 -07:00
Ryo Hashimoto
3d95d88b14 Stop using SO_SNDBUFFORCE
Use SO_SNDBUF which doesn't require CAP_NET_ADMIN instead.
Change the value of kFuseMaxWrite to 128KB.

In the kernel code, there is a constant FUSE_MAX_PAGES_PER_REQ which
limits the size of requests to 128KB.

Bug: 74725300
Test: atest android.os.storage.cts.StorageManagerTest

Change-Id: Ic3a8f1a7378d027a6c0ee054cedc2c9f4b7509ad
2018-03-15 14:22:27 +09:00
TreeHugger Robot
5f96d51507 Merge "Revert "libutilscallstack is private VNDK-SP"" into pi-dev 2018-03-15 04:17:05 +00:00
Jiyong Park
78df555af3 Revert "libutilscallstack is private VNDK-SP"
CallStack.cpp was part of libutils, but has been separated into a new
library libutilscallstack [1] and then made invisible to vendors [2].
However, this is causing problem to the vendors who have been using
the CallStack class from libutils, because the class is no longer
available to them.

In order to support them, marking libutilscallstack as
'vendor_available: true'.

This reverts commit a32678df55.

[1] https://android-review.googlesource.com/c/platform/system/core/+/591954
[2] https://android-review.googlesource.com/c/platform/system/core/+/599754
Bug: 74600214
Test: m -j
Test: 2016/2017 pixel devices boots to the UI and Photo Editing works

Merged-In: Iaa232ed978378b566a4710e2320ee6ed04572e14
Change-Id: Iaa232ed978378b566a4710e2320ee6ed04572e14
(cherry picked from commit 130fea3478)
2018-03-15 10:46:30 +09:00