Commit graph

24184 commits

Author SHA1 Message Date
Josh Gao
55259f320b Merge "DO NOT MERGE: debuggerd: verify that traced threads belong to the right process." into klp-dev am: 23effb07ee am: ac3fbb1a4a am: 7ed0995930 -s ours
am: 58dd6f7cba  -s ours

Change-Id: Ia416c2ddc18630671ab7e27d25792dd601f309df
2016-08-15 19:05:10 +00:00
Josh Gao
7fe65ab421 DO NOT MERGE: debuggerd: verify that traced threads belong to the right process. am: 8d6ca194ee am: 8f7cc0e387 -s ours am: be9d9fc379 -s ours
am: 2071bcfa75  -s ours

Change-Id: I491d40595bf23ea2a8b9db6df1c57b6e6e281604
2016-08-15 19:05:10 +00:00
Josh Gao
58dd6f7cba Merge "DO NOT MERGE: debuggerd: verify that traced threads belong to the right process." into klp-dev am: 23effb07ee am: ac3fbb1a4a
am: 7ed0995930  -s ours

Change-Id: I5e4be4eaca413d2f1a8027cf5fa69be9e1d9a644
2016-08-15 19:01:10 +00:00
Josh Gao
2071bcfa75 DO NOT MERGE: debuggerd: verify that traced threads belong to the right process. am: 8d6ca194ee am: 8f7cc0e387 -s ours
am: be9d9fc379  -s ours

Change-Id: I8c637fa765c4f6b79354855f245e78b82b87e3bf
2016-08-15 19:01:10 +00:00
Josh Gao
7ed0995930 Merge "DO NOT MERGE: debuggerd: verify that traced threads belong to the right process." into klp-dev am: 23effb07ee
am: ac3fbb1a4a

Change-Id: I6988483d7d461c1accdb27130517d11d0fdd7f0e
2016-08-15 18:57:27 +00:00
Josh Gao
be9d9fc379 DO NOT MERGE: debuggerd: verify that traced threads belong to the right process. am: 8d6ca194ee
am: 8f7cc0e387  -s ours

Change-Id: I073d06e3ee81c39bfaca866783de2113ac13cf72
2016-08-15 18:57:09 +00:00
Josh Gao
ac3fbb1a4a Merge "DO NOT MERGE: debuggerd: verify that traced threads belong to the right process." into klp-dev
am: 23effb07ee

Change-Id: If1aa441cf204ce5f3e56b9c1d2637acae72a83e1
2016-08-15 18:29:09 +00:00
Josh Gao
8f7cc0e387 DO NOT MERGE: debuggerd: verify that traced threads belong to the right process.
am: 8d6ca194ee

Change-Id: I1459607b655da6e01bd5d59e31bdb6d79d504431
2016-08-15 18:29:09 +00:00
Josh Gao
23effb07ee Merge "DO NOT MERGE: debuggerd: verify that traced threads belong to the right process." into klp-dev 2016-08-15 18:18:44 +00:00
Hans Boehm
23c857ebd6 Make RefBase more robust and debuggable
This prevents two different kinds of client errors from causing
undetected memory corruption, and helps with the detection of others:

1. We no longer deallocate objects when the weak count goes to zero
and there have been no strong references.  This otherwise causes
us to return a garbage object from a constructor if the constructor
allocates and deallocates a weak pointer to this. And we do know
that clients allocate such weak pointers in constructors and their
lifetime is hard to trace.

2. We abort if a RefBase object is explicitly destroyed while
the weak count is nonzero.  Otherwise a subsequent decrement
would cause a write to potentially reallocated memory.

3. We check counter values returned by atomic decrements for
plausibility, and fail immediately if they are not plausible.

We unconditionally log any cases in which 1 changes behavior
from before. We abort in cases in which 2 changes behavior, since
those reflect clear bugs.
In case 1, a log message now indicates a possible leak. We have
not seen such a message in practice.

The third point introduces a small amount of overhead into the
reference count decrement path. But this should be negligible
compared to the actual decrement cost.

Add a test for promote/attemptIncStrong that tries to check for
both (1) above and concurrent operation of attemptIncStrong.

Add some additional warnings and explanations to the RefBase
documentation.

Bug: 30503444
Bug: 30292291
Bug: 30292538

Change-Id: Ida92b9a2e247f543a948a75d221fbc0038dea66c
2016-08-13 11:17:51 -07:00
Josh Gao
27259667ec Merge "debuggerd: remove unnecessary arguments." am: 7a746f3a68
am: 60083bed75

Change-Id: I6f575a9662319db0dffeb121e0400eaa8f8cee55
2016-08-13 00:41:56 +00:00
Josh Gao
60083bed75 Merge "debuggerd: remove unnecessary arguments."
am: 7a746f3a68

Change-Id: I0a01639dd3096372eb5bbbe28362cdbf1c1da4af
2016-08-13 00:38:54 +00:00
Josh Gao
7a746f3a68 Merge "debuggerd: remove unnecessary arguments." 2016-08-13 00:29:29 +00:00
Josh Gao
f648fb4539 Merge "Clean up key handling in adb." am: b859830450
am: 81a3f71e45

Change-Id: I7013113e72eefd68a9329d0da72a45946d860e14
2016-08-12 21:25:22 +00:00
Josh Gao
81a3f71e45 Merge "Clean up key handling in adb."
am: b859830450

Change-Id: I8d8ff82167a97e89eacbfcc97f3b704466927aa3
2016-08-12 21:21:57 +00:00
Josh Gao
b859830450 Merge "Clean up key handling in adb." 2016-08-12 21:11:26 +00:00
Josh Gao
4a984ced34 Merge "debuggerd: remove useless timeout from wait_for_signal." am: 5f2bc28ebf
am: 4c4a172ee9

Change-Id: Ibbf4ff52d9349e8ceee5a6550c997328b204f332
2016-08-12 20:17:41 +00:00
Josh Gao
4c4a172ee9 Merge "debuggerd: remove useless timeout from wait_for_signal."
am: 5f2bc28ebf

Change-Id: Iee4f22c04ad330c91f86ca03583f8e36b2816039
2016-08-12 20:02:10 +00:00
Josh Gao
5f2bc28ebf Merge "debuggerd: remove useless timeout from wait_for_signal." 2016-08-12 19:52:55 +00:00
Josh Gao
a04c80255c debuggerd: remove unnecessary arguments.
These were previously required when bionic used tgkill to reraise
signals, but now that we use rt_tgsigqueueinfo to reraise signals, they
are no longer necessary.

Change-Id: I46ba9f14039a727d0a2c4c3a9d93a3532ba8f263
2016-08-12 11:00:18 -07:00
Josh Gao
f5a960a187 debuggerd: remove useless timeout from wait_for_signal.
The watchdog already handles things for us, so the timeout logic in
wait_for_signal is pointless.

Change-Id: Id81ad5f294068216b73e04c4e2ceca072ae1bbc0
2016-08-12 11:00:18 -07:00
Greg Kaiser
3ab37d8844 Merge "fastboot: Don't leak file in error case" am: 3a197b3799
am: 0c8a67bbfd

Change-Id: I3939b2c4a64f2d9f6513850abf00e93a2b904648
2016-08-12 17:48:59 +00:00
Greg Kaiser
0c8a67bbfd Merge "fastboot: Don't leak file in error case"
am: 3a197b3799

Change-Id: Ieaab2ed5c1619f75fa4c334d61afaf858ad7d46c
2016-08-12 17:45:32 +00:00
Treehugger Robot
3a197b3799 Merge "fastboot: Don't leak file in error case" 2016-08-12 17:34:49 +00:00
Greg Kaiser
dc9b62ba74 fastboot: Don't leak file in error case
This is probably not very significant in this standalone tool,
but makes it easier for us to find leaks in our other system
code via static analysis.

(cherry-pick of 407a2195391685627e6be947491041ae3c8cbe61.)

Change-Id: I4e14cadc1e53bac0848e0e0c7f531f920e43cb0a
2016-08-12 08:57:22 -07:00
Mark Salyzyn
6d2e1c73a3 Merge "logd: klogd crash (part deux)" am: 96c36d35ce
am: e36dbdda43

Change-Id: I3a798ee2f11163d52047659dab5cf14745f9891a
2016-08-12 14:34:47 +00:00
Mark Salyzyn
e36dbdda43 Merge "logd: klogd crash (part deux)"
am: 96c36d35ce

Change-Id: I95166c1a629007acf2da6d39a05a6586ce38177f
2016-08-12 14:30:50 +00:00
Mark Salyzyn
96c36d35ce Merge "logd: klogd crash (part deux)" 2016-08-12 14:22:00 +00:00
Mark Salyzyn
83b247891c logd: klogd crash (part deux)
LogBuffer::pidToUid(pid_t pid) { return stats.pidToUid(pid); }
needs to have LogBuffer::lock()/unlock() to prevent unordered_map
data corruption. This can lead to multiple symptoms, crashes and
continuous spins on corrupted iterators.

Bug: 30688716
Bug: 30050636
Bug: 30614675
Bug: 25620123
Bug: 30792935
Change-Id: I1d8fec8e5fda98c6a08645e7456b081507696b3c
2016-08-11 16:13:01 -07:00
Elliott Hughes
0aeb50500c Clean up key handling in adb.
This includes the locking we need to be able to re-load the keys at runtime.

We should rename "adb_auth_client.cpp" to "adb_auth_adbd.cpp" or
"adbd_auth.cpp" in a later change.

Change-Id: I9e1d5b6b7d0497d6f6e5d9c4fb660118cdff05a8
Test: "adb devices" works against a non-AOSP device with $ADB_VENDOR_KEYS set, says "unauthorized" without.
Bug: http://b/29273531
2016-08-11 13:53:18 -07:00
Josh Gao
de37556d65 Merge "DO NOT MERGE: adb: reenable (and fix) Windows build." into mnc-dev am: 73c59ad77c am: 015d662cb8 am: 00d389f392 am: 8dad649c6d -s ours
am: cfb8b6aea6

Change-Id: Id4fb3005257d169b504d81717ecd09a2e176939d
2016-08-11 20:32:49 +00:00
Josh Gao
b5edff33e3 DO NOT MERGE: adb: reenable (and fix) Windows build. am: 804de7a29e am: 5c4bf3d66f am: 5cee87ea25 am: 09b5b49e9b -s ours
am: 8b2a975e12

Change-Id: I0158c4012f3ebf835289b31e902ad7e7e504e60a
2016-08-11 20:32:48 +00:00
Josh Gao
cfb8b6aea6 Merge "DO NOT MERGE: adb: reenable (and fix) Windows build." into mnc-dev am: 73c59ad77c am: 015d662cb8 am: 00d389f392
am: 8dad649c6d  -s ours

Change-Id: Ic0c3050f457e3ccdd7ec101b74e61aae7a49f1b1
2016-08-11 20:29:12 +00:00
Josh Gao
8b2a975e12 DO NOT MERGE: adb: reenable (and fix) Windows build. am: 804de7a29e am: 5c4bf3d66f am: 5cee87ea25
am: 09b5b49e9b  -s ours

Change-Id: I51de5bec7e0927a180b127271addb06bb0ff9e7b
2016-08-11 20:29:11 +00:00
Josh Gao
8dad649c6d Merge "DO NOT MERGE: adb: reenable (and fix) Windows build." into mnc-dev am: 73c59ad77c am: 015d662cb8
am: 00d389f392

Change-Id: I37bd5978fd4ca52eda6960116103d321eef432fb
2016-08-11 20:26:11 +00:00
Josh Gao
09b5b49e9b DO NOT MERGE: adb: reenable (and fix) Windows build. am: 804de7a29e am: 5c4bf3d66f
am: 5cee87ea25

Change-Id: I76cecf9ef71ce9f631130868d402125b1e6ba9e3
2016-08-11 20:26:11 +00:00
Josh Gao
00d389f392 Merge "DO NOT MERGE: adb: reenable (and fix) Windows build." into mnc-dev am: 73c59ad77c
am: 015d662cb8

Change-Id: I3cb4380aeb347bf255c4fb6f4430db62e4a83407
2016-08-11 20:22:40 +00:00
Josh Gao
5cee87ea25 DO NOT MERGE: adb: reenable (and fix) Windows build. am: 804de7a29e
am: 5c4bf3d66f

Change-Id: I4977bc17d446cc2b8959058e3e13ccf17e10857b
2016-08-11 20:22:40 +00:00
Josh Gao
015d662cb8 Merge "DO NOT MERGE: adb: reenable (and fix) Windows build." into mnc-dev
am: 73c59ad77c

Change-Id: I04df96934b6ea82865f94fcff0daf1bbd9ba63d2
2016-08-11 20:19:09 +00:00
Josh Gao
5c4bf3d66f DO NOT MERGE: adb: reenable (and fix) Windows build.
am: 804de7a29e

Change-Id: I4dc4d5cb64c4757894fbdff1b3e12426aa965aa7
2016-08-11 20:19:09 +00:00
TreeHugger Robot
73c59ad77c Merge "DO NOT MERGE: adb: reenable (and fix) Windows build." into mnc-dev 2016-08-11 20:09:30 +00:00
Josh Gao
804de7a29e DO NOT MERGE: adb: reenable (and fix) Windows build.
This branch is still getting used to build some SDK targets.

Bug: http://b/30767018
Change-Id: I85b03a80d69ceef5e5333505f0832129387ed2da
2016-08-11 11:29:43 -07:00
Josh Gao
98c4d5c4fe Merge "Define TARGET_IS_64_BIT when building libdebuggerd_client for android64." am: 07f14c9cdd
am: 40efc4c664

Change-Id: If6889e54994c39280a39cc700f46470b6b760dda
2016-08-10 22:25:57 +00:00
Josh Gao
40efc4c664 Merge "Define TARGET_IS_64_BIT when building libdebuggerd_client for android64."
am: 07f14c9cdd

Change-Id: Ieac230f7a5cd0107420f0f5dfc84d1d9a19e70e0
2016-08-10 22:23:06 +00:00
Josh Gao
07f14c9cdd Merge "Define TARGET_IS_64_BIT when building libdebuggerd_client for android64." 2016-08-10 22:17:01 +00:00
Hans Boehm
f997434b06 Merge "Improve RefBase documentation, especially for clients." am: 0f39fe22ae
am: df6c464e9a

Change-Id: I8fa12835ff648d78c68265facb5b63ca7b1eab6a
2016-08-10 16:26:59 +00:00
Hans Boehm
df6c464e9a Merge "Improve RefBase documentation, especially for clients."
am: 0f39fe22ae

Change-Id: I804989b192142dc9d69ca36f0122079822625e7e
2016-08-10 16:24:01 +00:00
Hans Boehm
0f39fe22ae Merge "Improve RefBase documentation, especially for clients." 2016-08-10 16:16:22 +00:00
Narayan Kamath
d5d7abe3d1 zip_archive: Improve error message on fallocate failure.
Noticed on b/30765660.

Change-Id: I1a98f83fef02a7368bdc2e1f8f24a0771eebe468
2016-08-10 12:24:05 +01:00
Josh Gao
a200a4d592 debuggerd: fix missed use of ptrace(PTRACE_ATTACH). am: 8b6b654a5f am: fe59793375 am: 073f731836 am: 647ec18a9d -s ours
am: 364188b9d8

Change-Id: Idaf75a1369acba424c5280bcf29bedebed48f5bf
2016-08-09 23:55:08 +00:00