Commit graph

23936 commits

Author SHA1 Message Date
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
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
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
Hans Boehm
9ba7192c1f Improve RefBase documentation, especially for clients.
Add basic interface documentation to RefBase.h.

Much, but not all, of this is cut-and-pasted from an email message
from Mathias Agopian. The rest is reconstructed from the code.

Delete some, now redundant, text from Refbase.cpp, and add a bit
more about the implementation strategy.

Some minor fixes to internal comments.

Bug: 30292291
Change-Id: I56518ae5553bc6de0cc2331778e7fcf2e6c4fd87
2016-08-09 15:12:19 -07:00
Robert Sesek
9eb02c973f Define TARGET_IS_64_BIT when building libdebuggerd_client for android64.
This is needed to connect to the right debuggerd server for the crashing
process. Without this change, the following errors are observed, because a
32-bit process is trying to connect to the 64-bit debuggerd (as opposed to
debuggerd32):

  Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 14153 (static_crasher)
  debuggerd: handling request: pid=14153 uid=0 gid=0 tid=14153
  debuggerd: Not allowed to redirect action 0 to 32 bit debuggerd

Bug: 24414818
Change-Id: I2f275fbc804b0abc6e876a743e51dd8494817103
2016-08-09 14:04:05 -04:00
Mark Salyzyn
5118d8f633 Merge "logd: klogd crash"
am: e23e0914ff

Change-Id: I8c99431fe8687365e5af615ce7c231ac7029558a
2016-08-09 14:44:29 +00:00
Mark Salyzyn
e23e0914ff Merge "logd: klogd crash" 2016-08-09 14:36:12 +00:00
Elliott Hughes
f2f4e784a4 Merge "std::unqiue_ptr<..., decltype(&fn)> seems to be the preferred idiom."
am: 2f21b7cecd

Change-Id: I9fa6d99a61053dae4ad60c0b73ddac755b29cf61
2016-08-08 21:17:54 +00:00
Treehugger Robot
2f21b7cecd Merge "std::unqiue_ptr<..., decltype(&fn)> seems to be the preferred idiom." 2016-08-08 21:10:17 +00:00
Mark Salyzyn
cdaa5e2d64 Merge changes I628d590a,I1c13b94e,Iecf61bb2,I5b1c929d,I895749ca, ...
am: 1d3e13dcfc

Change-Id: I0d5bd2a52bd74b658f9fc3183599968948e2948c
2016-08-08 19:52:49 +00:00
Elliott Hughes
aea1683c12 std::unqiue_ptr<..., decltype(&fn)> seems to be the preferred idiom.
This is the only decltype(fn)* outside aapt2 in the whole tree.

Change-Id: I2e19d2031b56fdb808c62c2c07ca6080c9ec6fe3
2016-08-08 12:52:37 -07:00
Treehugger Robot
1d3e13dcfc Merge changes I628d590a,I1c13b94e,Iecf61bb2,I5b1c929d,I895749ca, ...
* changes:
  logcat: -d, -t or -L, along with -f, do not background
  logcat: lastLogTime only two most recent files
  logcatd: Add --id=${ro.build.id}
  logcatd: fix up logpersist.cat to filter out signature file
  logcat: add --id=<id> for -f option
  logcat: switch to android::base::StringPrintf
2016-08-08 19:49:19 +00:00
Josh Gao
87ef590bc1 Merge "libcrypto_utils: convert to Soong."
am: c1a9a21ffe

Change-Id: I9cf76646d4537750c4d4080234d3384fb307e610
2016-08-08 18:33:49 +00:00
Mark Salyzyn
2c1322f751 Merge "logcatd: logpersist.start more descriptive warning"
am: dad158f3a1

Change-Id: I6a7e1ef337dd7c8ae4b6b49b70dffa07968d0253
2016-08-08 18:30:49 +00:00
Josh Gao
c1a9a21ffe Merge "libcrypto_utils: convert to Soong." 2016-08-08 18:29:10 +00:00
Treehugger Robot
dad158f3a1 Merge "logcatd: logpersist.start more descriptive warning" 2016-08-08 18:26:35 +00:00
Greg Kaiser
f068856284 Merge "SharedBuffer: Fix bug in return value of release()"
am: c064db48f1

Change-Id: I401318575ced17a94d19b47b2821ed4c310d9a03
2016-08-08 18:15:44 +00:00
Greg Kaiser
c064db48f1 Merge "SharedBuffer: Fix bug in return value of release()" 2016-08-08 18:11:26 +00:00
Mark Salyzyn
ad5e411608 logcat: -d, -t or -L, along with -f, do not background
Specifically logcatd with exec logcat -L needs to be foreground
process cgroup as it is spawned and can block init progress. Makes
sense generally to only set background cgroup when we are taking
continuous content, and we are pushing that content to a set of
logrotate files.

Rename setupOutput to setupOutputAndSchedulingPolicy to more
clearly indicate its purpose.

Bug: 30630936
Bug: 30612424
Bug: 28788401
Change-Id: I628d590a42a53a6b448ecd0af53d6d1edf7bbb0e
2016-08-08 10:20:22 -07:00
Mark Salyzyn
31961061d5 logcat: lastLogTime only two most recent files
Scaling issues if -f logrotation is specified and there are a lot of
log files to process in lastLogTime, focus on only the last two log
files. This will cover the situation where we have recently rotated
the logs and the last file is missing or empty.

This also alters monotonic processing as well as it used to focus on
only the last file; the danger being doubled now if the pair covers
more than one reboot when filling in missing content with logcat -L.
Problem was always there with one log file, but now we handle if
rotation happened recently. A fair tradeoff for KISS.

Bug: 30630936
Bug: 30612424
Bug: 28788401
Change-Id: I1c13b94e88f5edc08ecef52d407e296874ca5807
2016-08-08 10:20:22 -07:00
Mark Salyzyn
9b35df6517 logcatd: Add --id=${ro.build.id}
If a new build lands, this will automatically clear out old
logs in /data/misc/logd/ that may no longer be relevant.

Bug: 30591615
Change-Id: Iecf61bb2a4928ce4b2e8cc6a3b122b7ae598d268
2016-08-08 10:20:22 -07:00
Mark Salyzyn
2e5b71873c logcatd: fix up logpersist.cat to filter out signature file
Simple filter for no suffix, or a numerical suffix. toybox
grep did not handle a more robust regex, so we opted for
kiss in order to remove the .id suffix from consideration.

Bug: 30591615
Change-Id: I5b1c929d3e69c1ae39af95ae44a69f7b55e969ed
2016-08-08 10:20:22 -07:00
Mark Salyzyn
02687e75b0 logcat: add --id=<id> for -f option
Clear file rotate content if id signature changes. This allows
logcatd to detect change of property ro.build.id to reset the
recorded data. The id is stored in the the -f filespec as
<filespec>.id.

If the id file is missing or unreadable, do not clear. Allow an
API where chmod 0 to the id file blocks this feature. Does not
work for root.

Add logcat.logrotate_id gTest.

Bug: 30591615
Change-Id: I895749ca7c6d4af57ec57f058a29d8e3af2f8b27
2016-08-08 10:19:48 -07:00
Mark Salyzyn
5b1a538fc8 logcat: switch to android::base::StringPrintf
asprintf should be replaced with StringPrintf, solves
a memory leak issue because of exiting scope.

Bug: 30591615
Change-Id: I88644cc27946ba4f25d4539420199c6f40df1bfa
2016-08-08 10:03:14 -07:00
Mark Salyzyn
452eaf7d5b logcatd: logpersist.start more descriptive warning
"killing Settings" is meaningless without context, we are killing the
Settings application to pull in new values, so make this clearer!

Change-Id: Ice0b950040bd05dcd49b7315def4dac3dd93eb27
2016-08-08 10:03:05 -07:00
Mark Salyzyn
a146a779e2 logd: klogd crash
dmesg parser could wrap taglen limit resulting in out of bound
accesses. Can lead to crash or data corruption.

Fixed an issue with two-word tag parsing. Switched to case
insensitive tag content matching. Added a few extra limit
checks that could also wrap, simplified the parsing, then added
means to stop using hard coded constants.

Bug: 30688716
Bug: 30050636
Bug: 30614675
Bug: 25620123
Change-Id: Iae4f664f63ef7b842d82eaa1638b6d7a0d28fd18
2016-08-08 09:58:28 -07:00
Greg Kaiser
c9b23cbb54 SharedBuffer: Fix bug in return value of release()
Since the equality operator '==' has higher precedence than the
assignment operator '=', we were assigning 'prev' to the result of
our comparison and not the result of mRefs.fetch_sub().

This means that 'prev' would only receive the values 0 or 1.  In
the cases where fetch_sub() returned 0 or 1, we were happening to
get the correct value.  But if fetch_sub() was greator than 1,
we would return to the user 0, instead of the previous reference
count.

We fix this by properly adding parentheses.  We also adjust the
whitespace a little to hopefully make the groupings of the logic
easier to see.

Change-Id: Ib129798a7076854b9ca4f6385c42edbf4fb75e57
2016-08-08 06:55:10 -07:00
Josh Gao
47763c3a09 libcrypto_utils: convert to Soong.
Bug: http://b/30708454
Change-Id: Iaad64272ced766f87e67f2877e990afccc558065
2016-08-05 18:07:36 -07:00
Greg Hackmann
70f9a1018c Merge changes from topic 'minui_sync_wait'
am: 9cd828b858

Change-Id: Ib4d2c4dc6d6f2d78a99fccf57fc055f8934a8312
2016-08-05 23:47:59 +00:00
Treehugger Robot
9cd828b858 Merge changes from topic 'minui_sync_wait'
* changes:
  libsync: add static library for recovery
  libsync: remove unused liblog dependency
2016-08-05 23:25:43 +00:00
Greg Hackmann
d86dd3b838 libsync: add static library for recovery
Change-Id: If43188c3b4b16c698c077338ea0ef1dfd16b9c56
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-08-05 15:03:58 -07:00
Greg Hackmann
a90aa13b5b libsync: remove unused liblog dependency
Change-Id: I69840ece3f13809b2440edbe6cfa412a56aee4aa
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-08-05 14:50:39 -07:00
Josh Gao
1286c1f878 adb: correctly fix merge conflict.
Change-Id: Ic637c0ef5499e2893cd0adfcc41dd5d3481524c2
2016-08-05 00:39:16 -07:00
Josh Gao
4ff7f9f62a resolve merge conflicts of e012de5 to stage-aosp-master
Change-Id: I3d9f8b4421fa6122261dbd821561a2236f810a47
2016-08-04 22:04:05 -07:00
Treehugger Robot
e012de5718 Merge changes If2f3008f,Id3411479,I90df5fc1
* changes:
  adb: improve display of transfer rate.
  adb: add missing newline when printing transfer rate.
  adb: fix output of `sync -l`
2016-08-05 02:21:41 +00:00
Josh Gao
fb0c5cb28c adb: improve display of transfer rate.
Show transfer rate for individual files, and for the overall transfer.

Bug: http://b/30411535
Change-Id: If2f3008f1287b1d1add4a23c3430b39885b6c904
Test: inspected output manually
2016-08-04 18:03:09 -07:00
Elliott Hughes
d7c6ac024c Merge "Move init's kernel logging into libbase."
am: bfb89d32f5

Change-Id: I3a81765f9ec3d28f763bd5f8ff05556881b3d34b
2016-08-05 00:30:02 +00:00
Elliott Hughes
e2a7eb17b5 Move init's kernel logging into libbase.
am: 7bc87a5a78

Change-Id: Ie5e359e8bd7dee4c0549072c7e955eeefe57d785
2016-08-05 00:30:00 +00:00
Treehugger Robot
bfb89d32f5 Merge "Move init's kernel logging into libbase." 2016-08-05 00:25:45 +00:00
Elliott Hughes
7bc87a5a78 Move init's kernel logging into libbase.
This will let other stuff (such as adbd and recovery) use it too.

Bug: http://b/28467098
Change-Id: Idab51f438ed3edd6fe65a56c4b396eaff5f3833e
2016-08-04 16:09:39 -07:00
Josh Gao
1a9979ec1e adb: add missing newline when printing transfer rate.
Previously, we weren't printing a newline when reporting transfer
rates, so only the last transfer rate printed would be visible.

Bug: http://b/30667841
Change-Id: Id341147912d057673de4ad26a8f618f04a8c02f3
Test: inspected output manually
2016-08-04 14:56:53 -07:00
Josh Gao
baa215ea59 adb: fix output of sync -l
sync with list-only was using SyncConnection::Error to print its output
persistently, which would prepend "adb: error: " to messages.

Change-Id: I90df5fc1123b8c613c811cf66c37aef05663b1e4
2016-08-04 14:56:53 -07:00
Chih-Hung Hsieh
4d031d6358 Merge "Fix google-explicit-constructor warnings in utils."
am: 5b7e3b9a2a

Change-Id: I88b7d5f20f26a028c90efdb837730e5b8631ce80
2016-08-04 21:48:20 +00:00
Treehugger Robot
5b7e3b9a2a Merge "Fix google-explicit-constructor warnings in utils." 2016-08-04 20:56:47 +00:00