Commit graph

20439 commits

Author SHA1 Message Date
Yabin Cui
3082ca20a0 Merge "adb: close ep0 on disconnection."
am: 18013f2083

* commit '18013f2083d9372cc03d9c9281bc3a168e049da9':
  adb: close ep0 on disconnection.

Change-Id: I3d65b981a568ec606c09e35874474a5179f10e6c
2016-05-24 02:40:28 +00:00
Treehugger Robot
18013f2083 Merge "adb: close ep0 on disconnection." 2016-05-24 02:32:57 +00:00
Yabin Cui
638420ef31 adb: close ep0 on disconnection.
adbd on device kicks the usb connection when usb IO fails. But to notify
adb on host to reconnect it, adbd needs to close ep0 to reset the usb
connection. Otherwise, adb on host cann't connect the device unless the
usb cable is reconnected or adb host server is restarted.

This can be tested by using `adb reconnect device` command.

Bug: 25935458

Change-Id: I80979d6029e60b9cfd218f7b9b5201810238ec07
(cherry picked from commit 69e97e4bee)
2016-05-23 17:17:46 -07:00
Hans Boehm
1e081a8c5f Merge "Fix SharedBuffer. Remove aref."
am: 069517574e

* commit '069517574eede4fa8fd69a0e1bc4e5d70c18149c':
  Fix SharedBuffer. Remove aref.

Change-Id: I32fda0aee04aa890fa03b1e56fefbebab3d50531
2016-05-23 22:18:07 +00:00
Hans Boehm
069517574e Merge "Fix SharedBuffer. Remove aref." 2016-05-23 22:11:02 +00:00
Hans Boehm
3e4c076ef2 Fix SharedBuffer. Remove aref.
Add comment that SharedBuffer is deprecated.

Both aref and SharedBuffer had memory ordering bugs.  Aref has no
clients.

SharedBuffer had several bugs, which are fixed here:

mRefs was declared neither volatile, not atomic, allowing the
compiler to, for example, reuse a stale previously loaded value.

It used the default android_atomic release memory ordering, which
is insufficient for reference count decrements.

It used an ordinary memory read in onlyOwner() to check whether
an object is safe to deallocate, without any attempt to ensure
memory ordering.

Comments claimed that SharedBuffer was exactly 16 bytes, but
this was neither checked, nor correct on 64-bit platforms.

This turns mRef into a std::atomic and removes the android_atomic
dependency.

Bug: 28826227
Change-Id: I39fa0b4f70ac0471b14ad274806fc4e0c0802e78
2016-05-23 17:28:52 +00:00
Yabin Cui
1a78ec8f65 Merge "adb: check return value of register_socket_transport."
am: 3d981c87c9

* commit '3d981c87c929ec4946ce53d2aaa3503c86886eb1':
  adb: check return value of register_socket_transport.

Change-Id: I3b0983e1ccda4c0c29d1f971ba3402ec384ef2a8
2016-05-21 01:24:28 +00:00
Yabin Cui
3d981c87c9 Merge "adb: check return value of register_socket_transport." 2016-05-21 01:12:35 +00:00
Chih-Hung Hsieh
3252d11498 Merge "Fix misc-macro-parentheses warnings in lmkd."
am: 86ed22cf27

* commit '86ed22cf27193e5d64f617ec68c8016166c7e4f4':
  Fix misc-macro-parentheses warnings in lmkd.

Change-Id: Id5772ecec918e9ad3c8952ddfcd23e13dbf3122a
2016-05-19 22:55:44 +00:00
Treehugger Robot
86ed22cf27 Merge "Fix misc-macro-parentheses warnings in lmkd." 2016-05-19 22:42:26 +00:00
Hans Boehm
d657e639cf Merge "Fix memory order and race bugs in Refbase.h & RefBase.cpp"
am: 62212954ef

* commit '62212954efc9cd4ddfa91f100ec4ecec27315e42':
  Fix memory order and race bugs in Refbase.h & RefBase.cpp

Change-Id: I4b17f76ec7162090deb84b5ec83b3e765dddb186
2016-05-19 22:09:14 +00:00
Hans Boehm
62212954ef Merge "Fix memory order and race bugs in Refbase.h & RefBase.cpp" 2016-05-19 22:01:41 +00:00
Dmitry Shmidt
7fd1c0750f Merge "HACK: libnetutils: Remove parameters from dhcpcd service call"
am: 97da9225d9

* commit '97da9225d911ffdabd4f77d9f6868f3860637b06':
  HACK: libnetutils: Remove parameters from dhcpcd service call

Change-Id: I7665738b70f70214c9a8b924ca3ff8af06b8f9a9
2016-05-19 01:05:10 +00:00
Treehugger Robot
97da9225d9 Merge "HACK: libnetutils: Remove parameters from dhcpcd service call" 2016-05-19 01:02:40 +00:00
Chih-Hung Hsieh
1cff850bb3 Merge "Fix misc-macro-parentheses warnings in liblog."
am: 2bd428e1f9

* commit '2bd428e1f9c2fb4459b37b3bda95143319d78728':
  Fix misc-macro-parentheses warnings in liblog.

Change-Id: I045e4f16264c39316456cd1e5c9b3df869c5701b
2016-05-19 00:59:57 +00:00
Chih-Hung Hsieh
e98251ed61 Merge "Fix misc-macro-parentheses warnings in libion, libsparse, libmem*"
am: 3e3741aa7f

* commit '3e3741aa7fd414272a3c9c244e56e663dfa7ad1c':
  Fix misc-macro-parentheses warnings in libion, libsparse, libmem*

Change-Id: I01af8be27569a2b8c1f85e468fdb1d6ebbb23e93
2016-05-19 00:59:56 +00:00
Chih-hung Hsieh
2bd428e1f9 Merge "Fix misc-macro-parentheses warnings in liblog." 2016-05-19 00:48:44 +00:00
Chih-hung Hsieh
3e3741aa7f Merge "Fix misc-macro-parentheses warnings in libion, libsparse, libmem*" 2016-05-19 00:48:32 +00:00
Josh Gao
43c058e51a Merge "adb: use asocket\'s close function when closing."
am: 684d543922

* commit '684d543922465538dd233c99c0cf492f1f24233c':
  adb: use asocket's close function when closing.

Change-Id: Icb05f95c2cb16800dd114f52e6f301dae72ad654
2016-05-19 00:13:12 +00:00
Treehugger Robot
684d543922 Merge "adb: use asocket's close function when closing." 2016-05-19 00:11:03 +00:00
Chih-Hung Hsieh
fa7569c921 Merge "Fix misc-macro-parentheses warnings in adb, debuggerd, libbacktrace."
am: dab7d9de03

* commit 'dab7d9de03369feeb099be6c8f7748df3f466bd3':
  Fix misc-macro-parentheses warnings in adb, debuggerd, libbacktrace.

Change-Id: I6fc423fc3eb08c6e44a3d7261ae0e1b87ce0e993
2016-05-19 00:02:55 +00:00
Treehugger Robot
dab7d9de03 Merge "Fix misc-macro-parentheses warnings in adb, debuggerd, libbacktrace." 2016-05-18 23:54:40 +00:00
Josh Gao
71c062f40a Merge changes I5e56f17f,Ie3748b6c,I4e1d56a8
am: cea14958d2

* commit 'cea14958d2903f136f8874238ccff4da1b0d38d9':
  adb: switch the socket list mutex to a recursive_mutex.
  adb: clang-format sockets.cpp.
  adb: add implementations of mutex, recursive_mutex.

Change-Id: I8ec365c99dbc1dc402d62a8401df937ae6ae3a6b
2016-05-18 23:19:42 +00:00
Treehugger Robot
cea14958d2 Merge changes I5e56f17f,Ie3748b6c,I4e1d56a8
* changes:
  adb: switch the socket list mutex to a recursive_mutex.
  adb: clang-format sockets.cpp.
  adb: add implementations of mutex, recursive_mutex.
2016-05-18 23:14:42 +00:00
Dmitry Shmidt
1288f65b3b HACK: libnetutils: Remove parameters from dhcpcd service call
init is not accepting parameters, therefore adding them
will cause to serivce failure. This is a temporary solution.

Change-Id: I0faa482f76b5af5f91723b0d4ef348aafd5694df
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2016-05-18 16:01:15 -07:00
Chih-Hung Hsieh
67867dbd79 Fix misc-macro-parentheses warnings in adb, debuggerd, libbacktrace.
Bug: 28705665
Change-Id: I469b2a882f6d1f399bfc22c75a26da245991fc33
2016-05-18 15:53:15 -07:00
Chih-Hung Hsieh
f0f94fe49b Fix misc-macro-parentheses warnings in liblog.
Bug: 28705665
Change-Id: Ib272a83cb93b09d986c19a40e23a2679b9e17558
2016-05-18 15:48:50 -07:00
Chih-Hung Hsieh
eabd5108b3 Fix misc-macro-parentheses warnings in libion, libsparse, libmem*
Bug: 28705665
Change-Id: I3dd5c086787f5e48ab100a71a42109ea0e417bf9
2016-05-18 15:41:16 -07:00
Chih-Hung Hsieh
2b82e918d8 Fix misc-macro-parentheses warnings in lmkd.
Bug: 28705665
Change-Id: I43388c0f9fdc8c2a0c0f4495f96bbc27e3de8a1d
2016-05-18 15:37:20 -07:00
Josh Gao
53eb31d87c adb: use asocket's close function when closing.
close_all_sockets was assuming that all registered local sockets used
local_socket_close as their close function. However, this is not true
for JDWP sockets.

Bug: http://b/28347842
Change-Id: I40a1174845cd33f15f30ce70828a7081cd5a087e
2016-05-18 14:21:53 -07:00
Josh Gao
9b587dec6d adb: switch the socket list mutex to a recursive_mutex.
sockets.cpp was branching on whether a socket close function was
local_socket_close in order to avoid a potential deadlock if the socket
list lock was held while closing a peer socket.

Bug: http://b/28347842
Change-Id: I5e56f17fa54275284787f0f1dc150d1960256ab3
2016-05-18 14:21:53 -07:00
Josh Gao
52bd8526aa adb: clang-format sockets.cpp.
Bug: http://b/28347842
Change-Id: Ie3748b6c803d4e8056e9d7abd065a8b99d945a5b
2016-05-18 14:21:53 -07:00
Josh Gao
903b749f78 adb: add implementations of mutex, recursive_mutex.
Our version of mingw doesn't support std::mutex or
std::recursive_mutex, so implement our own using the Windows primitives.

Bug: http://b/28347842
Change-Id: I4e1d56a89bc5fcb5f859bf5014343697a4a85b77
2016-05-18 14:21:53 -07:00
Mark Salyzyn
0a7dec432c Merge "liblog: log reader validate headers"
am: 0321476fe2

* commit '0321476fe2aedf9a0b960508b52681ee5f1d555e':
  liblog: log reader validate headers

Change-Id: I21832a3908161e489a04a127508e2339e7f29bce
2016-05-18 14:25:26 +00:00
Mark Salyzyn
0321476fe2 Merge "liblog: log reader validate headers" 2016-05-18 14:19:04 +00:00
Hans Boehm
e263e6c633 Fix memory order and race bugs in Refbase.h & RefBase.cpp
Convert to use std::atomic directly.

Consistently use relaxed ordering for increments, release ordering
for decrements, and an added acquire fence when the count goes to
zero.

Fix what looks like another race in attemptIncStrong:
It seems entirely possible that the final adjustment for
INITIAL_STRONG_VALUE would see e.g. INITIAL_STRONG_VALUE + 1,
since we could be running in the middle of another initial
increment.

Attempt to somewhat document what this actually does, and
what's expected from the client. Hide the documentation in
the .cpp file for now.

Remove a confusing redundant test in decWeak. OBJECT_LIFETIME_STRONG
and OBJECT_LIFETIME_WEAK are the only options, in spite of some
of the original comments.

It's conceivable that either of these issues has resulted in
actual crashes, though I would guess the probability is small.
It's hard enough to reason about this code without the bugs.

Bug: 28705989
Change-Id: I4107a56c3fc0fdb7ee17fc8a8f0dd7fb128af9d8
2016-05-17 16:11:11 -07:00
Dimitry Ivanov
3457aba394 Merge "Set parent namespace for linker-namespaces"
am: ac50d0cc57

* commit 'ac50d0cc5789d8462fcd2d9f6cb225e0edf9a12f':
  Set parent namespace for linker-namespaces

Change-Id: I832b3f228873e93a8b9a00e365af561f10b41eb2
2016-05-17 22:58:45 +00:00
Josh Gao
4e1149bb15 Merge "adb: replace failing exits in adbd with abort()."
am: eb62619ff9

* commit 'eb62619ff9211ecee2a5c6ce4475b7d6baf9cb0e':
  adb: replace failing exits in adbd with abort().

Change-Id: I6b5b5b61c18b6afb2e1e96cab6ba8704d9115bcc
2016-05-17 22:58:38 +00:00
Josh Gao
32045567be Merge "adb: add track-jdwp and track-devices commands."
am: f8f40a1e2e

* commit 'f8f40a1e2e6162b7f334f83a10f6a5d9ef44f75f':
  adb: add track-jdwp and track-devices commands.

Change-Id: I96e185b1235aaa2c82371a53415fa44c57444dac
2016-05-17 22:58:34 +00:00
Treehugger Robot
ac50d0cc57 Merge "Set parent namespace for linker-namespaces" 2016-05-17 22:43:01 +00:00
Josh Gao
eb62619ff9 Merge "adb: replace failing exits in adbd with abort()." 2016-05-17 22:33:44 +00:00
Josh Gao
f8f40a1e2e Merge "adb: add track-jdwp and track-devices commands." 2016-05-17 22:33:30 +00:00
Yabin Cui
01401823fb adb: check return value of register_socket_transport.
Change-Id: I45e30861cf292323e3264a815e4ffd23d6610c52
2016-05-17 15:15:43 -07:00
Mark Salyzyn
8fd1faa596 liblog: log reader validate headers
Ensure len and hdr_size fields are valid and match the return value.
Truncate or zero content as necessary, but do not drop the message.

Bug: 28610769
Change-Id: I10785fa5b03aa3da7d07b368188e3f7c36a84b4f
2016-05-17 13:54:42 -07:00
Elliott Hughes
e2c741ce0f Merge "Don\'t include <machine/cpu-features.h>."
am: 9b0eb7cdf4

* commit '9b0eb7cdf4ac4650fc3f476c2f5a91c50a18e524':
  Don't include <machine/cpu-features.h>.

Change-Id: Ie2b744b8dc414b7dc8568dae77eeb3babf7df3a8
2016-05-17 03:13:07 +00:00
Elliott Hughes
9b0eb7cdf4 Merge "Don't include <machine/cpu-features.h>." 2016-05-17 03:10:05 +00:00
Dimitry Ivanov
24db75c1ce Set parent namespace for linker-namespaces
This change allows applications to share RTLD_GLOBAL
native libraries between namespaces associated with
different classloaders.

The rule is - if a library is GLOBAL within namespace
associated with parent classloader, it is shared
with namespace associated with this classloader

Note that the sharing happens on create_namespace
event, which is tied to createClassloader in case of
application classloaders created by the framework, for
custom application classloaders it is tied to first
loadLibrary() event.

Bug: http://b/28560538
Bug: https://code.google.com/p/android/issues/detail?id=208458
Change-Id: I7ee701166f8ec5eff033b7acc0f80c7aa4ec5bda
2016-05-16 18:13:49 -07:00
Dimitry Ivanov
f7d2b8276a Merge "Pass permitted_path to the linker as is."
am: a214a769f9

* commit 'a214a769f9a98b0962e62bd716575a05cf6f9f59':
  Pass permitted_path to the linker as is.

Change-Id: Ic4d8e6a67ca069319d872e6f3dcb76e857162093
2016-05-17 01:13:29 +00:00
Treehugger Robot
a214a769f9 Merge "Pass permitted_path to the linker as is." 2016-05-17 01:05:01 +00:00
Elliott Hughes
a1b9bd901f Don't include <machine/cpu-features.h>.
We're not using it.

Change-Id: Ic128cf9297e1627c839c48f1954c19d7070654d7
2016-05-16 17:55:27 -07:00