Commit graph

23466 commits

Author SHA1 Message Date
Hans Boehm
b3254bbec7 Merge "Fix SharedBuffer. Remove aref." am: 069517574e am: 1e081a8c5f
am: 12f788e763

* commit '12f788e763f6528af29199074e52e6bef39d414a':
  Fix SharedBuffer. Remove aref.

Change-Id: I554ddc9f12f1652c8122790f12efca41aad6b5b4
2016-05-23 22:26:30 +00:00
Hans Boehm
12f788e763 Merge "Fix SharedBuffer. Remove aref." am: 069517574e
am: 1e081a8c5f

* commit '1e081a8c5f2d6e6cb55658bb289db1f0b4f5774a':
  Fix SharedBuffer. Remove aref.

Change-Id: I5849137bb49d727d1c1d245f0f61d11c4ee10859
2016-05-23 22:22:18 +00: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
bf955d7a4b Merge "adb: check return value of register_socket_transport." am: 3d981c87c9 am: 1a78ec8f65
am: bb89e7e6b5

* commit 'bb89e7e6b5403297689f62b8f86d7a3cbab4037e':
  adb: check return value of register_socket_transport.

Change-Id: I7394d2fc85fd49f846ae96affc78a83601db9bc0
2016-05-21 01:29:37 +00:00
Yabin Cui
bb89e7e6b5 Merge "adb: check return value of register_socket_transport." am: 3d981c87c9
am: 1a78ec8f65

* commit '1a78ec8f6525e7101cb8f7d75f42955bbdbbd98e':
  adb: check return value of register_socket_transport.

Change-Id: I94be64825d5908d52d930125808f431fd6b96503
2016-05-21 01:27:05 +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
Android Build Merger (Role)
1bb691ca3f Merge "Fix memory order and race bugs in Refbase.h & RefBase.cpp am: 70a46d674a am: bc2a2284e4" into nyc-mr1-dev-plus-aosp 2016-05-20 00:57:23 +00:00
Hans Boehm
91c912f2cf Fix memory order and race bugs in Refbase.h & RefBase.cpp am: 70a46d674a
am: bc2a2284e4

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

Change-Id: I42653ab81302a03e5de20434591ca4f13b0940a9
2016-05-20 00:57:15 +00:00
Hans Boehm
def5fd4dfc Fix memory order and race bugs in Refbase.h & RefBase.cpp am: 70a46d674a
am: bf3c130cde

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

Change-Id: I645fc1a87703283a7c6ce7c64c2e368edcee02b4
2016-05-20 00:57:07 +00:00
Hans Boehm
bf3c130cde Fix memory order and race bugs in Refbase.h & RefBase.cpp
am: 70a46d674a

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

Change-Id: Ida5d6d99774a1909cbf05e69d35306cd03e6c0eb
2016-05-20 00:54:28 +00:00
Hans Boehm
bc2a2284e4 Fix memory order and race bugs in Refbase.h & RefBase.cpp
am: 70a46d674a

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

Change-Id: I3562b8b9d12d2f26d80a389292eef760ad0919f3
2016-05-20 00:54:27 +00:00
Hans Boehm
70a46d674a 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
(cherry picked from commit e263e6c633)
2016-05-19 16:18:26 -07:00
Chih-Hung Hsieh
a343667388 resolve merge conflicts of 3252d11 to nyc-dev-plus-aosp
am: daa13eaa92

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

Change-Id: I4488f937aac2a3bdd8e52f667f30b4dc5836f3ab
2016-05-19 23:08:56 +00:00
Chih-Hung Hsieh
daa13eaa92 resolve merge conflicts of 3252d11 to nyc-dev-plus-aosp
Change-Id: I2973439a194a3048d009159d75572a5366021f21
2016-05-19 16:02:22 -07: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
3f9b589982 Merge "Fix memory order and race bugs in Refbase.h & RefBase.cpp" am: 62212954ef am: d657e639cf
am: fdad5af164

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

Change-Id: I3f02135be975b2dcbf4155832cbb9c0c78438a19
2016-05-19 22:17:54 +00:00
Hans Boehm
fdad5af164 Merge "Fix memory order and race bugs in Refbase.h & RefBase.cpp" am: 62212954ef
am: d657e639cf

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

Change-Id: I79106bb0399e7699d51d526235843504ab52708b
2016-05-19 22:12:01 +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
Josh Gao
3c1af3c431 Merge changes I40a11748,I5e56f17f,Ie3748b6c,I4e1d56a8 into nyc-dev am: d4af0d64de
am: dc3d0b7175

* commit 'dc3d0b717524d358ed1a651a2f226f1eef01c6a4':

Change-Id: I305a782f2b163718ec913fd1c8424595778ea362
2016-05-19 19:59:32 +00:00
Josh Gao
2c0f553cd6 Merge changes I40a11748,I5e56f17f,Ie3748b6c,I4e1d56a8 into nyc-dev am: d4af0d64de
am: 11082d3a6e

* commit '11082d3a6e7b4b0c848bcea70e8abf16885f3e08':
  adb: use asocket's close function when closing.
  adb: switch the socket list mutex to a recursive_mutex.
  adb: clang-format sockets.cpp.
  adb: add implementations of mutex, recursive_mutex.

Change-Id: I76ee3a8d2de618c57b3696e78261fdbb917edab8
2016-05-19 19:54:23 +00:00
Josh Gao
dc3d0b7175 Merge changes I40a11748,I5e56f17f,Ie3748b6c,I4e1d56a8 into nyc-dev
am: d4af0d64de

* commit 'd4af0d64de042b0425bbae1f91d1720eebcf95a3':
  adb: use asocket's close function when closing.
  adb: switch the socket list mutex to a recursive_mutex.
  adb: clang-format sockets.cpp.
  adb: add implementations of mutex, recursive_mutex.

Change-Id: Ibb251966874a73e7ad745531ebad7b56c9c82e0d
2016-05-19 19:50:30 +00:00
Josh Gao
11082d3a6e Merge changes I40a11748,I5e56f17f,Ie3748b6c,I4e1d56a8 into nyc-dev
am: d4af0d64de

* commit 'd4af0d64de042b0425bbae1f91d1720eebcf95a3':
  adb: use asocket's close function when closing.
  adb: switch the socket list mutex to a recursive_mutex.
  adb: clang-format sockets.cpp.
  adb: add implementations of mutex, recursive_mutex.

Change-Id: Ida004443ba8cc7d41a2b81d77c7abb9917e08ff9
2016-05-19 19:50:19 +00:00
Josh Gao
d4af0d64de Merge changes I40a11748,I5e56f17f,Ie3748b6c,I4e1d56a8 into nyc-dev
* changes:
  adb: use asocket's close function when closing.
  adb: switch the socket list mutex to a recursive_mutex.
  adb: clang-format sockets.cpp.
  adb: add implementations of mutex, recursive_mutex.
2016-05-19 19:36:36 +00:00
Elliott Hughes
d093d40b8b resolve merge conflicts of 847d963 to nyc-dev-plus-aosp
am: 9110eaab41

* commit '9110eaab4116c7edb38045b21a01226eccd5eb0a':

Change-Id: Idb0f7df71e6796e056532f3b1923fd98bb9a2c5e
2016-05-19 04:30:08 +00:00
Elliott Hughes
8c8321c7ab resolve merge conflicts of 3e2f31f to nyc-mr1-dev-plus-aosp
Change-Id: I68dc30c1a008803762ed9a1023a43bdc0770f44c
2016-05-18 21:28:17 -07:00
Elliott Hughes
9110eaab41 resolve merge conflicts of 847d963 to nyc-dev-plus-aosp
Change-Id: Ib97f56112bff71e2997116f969fd6d3e30e72f26
2016-05-18 21:26:35 -07:00
Elliott Hughes
3e2f31f1e6 Remove a dead header (<netutils/dhcp.h>).
am: 847d963598

* commit '847d9635980d2343a47bf31519055fb2bbdddc32':
  Remove a dead header (<netutils/dhcp.h>).

Change-Id: I3f452861c4e379b7a7f750d4e2b8107ee0abdcb1
2016-05-19 04:23:29 +00:00
Dmitry Shmidt
95a2b1dfe9 Merge "HACK: libnetutils: Remove parameters from dhcpcd service call" am: 97da9225d9 am: 7fd1c0750f -s ours
am: 6cf91d1c4d

* commit '6cf91d1c4dafbdbd14330d61fbeb28a21607f03a':
  HACK: libnetutils: Remove parameters from dhcpcd service call

Change-Id: I3b35bfdccd24bdf23d3cf3687ae06786ce6fe276
2016-05-19 01:23:19 +00:00
Dmitry Shmidt
6cf91d1c4d Merge "HACK: libnetutils: Remove parameters from dhcpcd service call" am: 97da9225d9
am: 7fd1c0750f  -s ours

* commit '7fd1c0750f5082bab57b5ddaac4fb5c7986e2323':
  HACK: libnetutils: Remove parameters from dhcpcd service call

Change-Id: Icb6b21e909dbb75323330459415f4a40dbebd8b6
2016-05-19 01:20:03 +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
Chih-Hung Hsieh
27342f1e04 Merge "Fix misc-macro-parentheses warnings in liblog." am: 2bd428e1f9 am: 1cff850bb3
am: d581f2c47d

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

Change-Id: I41b3101e77fc5810eaf0197137d3252b64a6dd2b
2016-05-19 01:05:08 +00:00
Chih-Hung Hsieh
74a75e2038 Merge "Fix misc-macro-parentheses warnings in libion, libsparse, libmem*" am: 3e3741aa7f am: e98251ed61
am: 446dcb4625

* commit '446dcb46251f1bdd417c15e424d76874c22c8957':
  Fix misc-macro-parentheses warnings in libion, libsparse, libmem*

Change-Id: I546e9e9f9e1bb58908e7d3ae5def3b69ce123043
2016-05-19 01:05:08 +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
d581f2c47d Merge "Fix misc-macro-parentheses warnings in liblog." am: 2bd428e1f9
am: 1cff850bb3

* commit '1cff850bb383d75c395d4627086b6baa63639a18':
  Fix misc-macro-parentheses warnings in liblog.

Change-Id: I318ab4909ba59e7181b9ec9c3e73f58ea8b0c0d8
2016-05-19 01:02:34 +00:00
Chih-hung Hsieh
446dcb4625 Merge "Fix misc-macro-parentheses warnings in libion, libsparse, libmem*" am: 3e3741aa7f
am: e98251ed61

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

Change-Id: If2f2b291e493d4e5bcde017d88499adac27ad38f
2016-05-19 01:02:33 +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
e328cc5194 Merge "adb: use asocket\'s close function when closing." am: 684d543922 am: 43c058e51a
am: a41a0c2acc

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

Change-Id: Id18d3b3671d777dd8c8415c8d540aa189157f64a
2016-05-19 00:20:41 +00:00
Josh Gao
014b01706c 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
(cherry picked from commit 53eb31d87c)
2016-05-18 17:20:30 -07:00
Josh Gao
268068f256 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
(cherry picked from commit 9b587dec6d)
2016-05-18 17:20:30 -07:00
Josh Gao
63760409ad adb: clang-format sockets.cpp.
Bug: http://b/28347842
Change-Id: Ie3748b6c803d4e8056e9d7abd065a8b99d945a5b
(cherry picked from commit 52bd8526aa)
2016-05-18 17:20:30 -07:00
Josh Gao
6e106990cf 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
(cherry picked from commit 903b749f78)
2016-05-18 17:20:30 -07:00
Josh Gao
a41a0c2acc Merge "adb: use asocket\'s close function when closing." am: 684d543922
am: 43c058e51a

* commit '43c058e51a652874cfdf0c687ba1dee18f13f993':
  adb: use asocket's close function when closing.

Change-Id: I0681ff8c31c2f221e246a86857fbff779d2b7dcf
2016-05-19 00:16:11 +00:00