Commit graph

20622 commits

Author SHA1 Message Date
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
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
0f39fe22ae Merge "Improve RefBase documentation, especially for clients." 2016-08-10 16:16:22 +00: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
e23e0914ff Merge "logd: klogd crash" 2016-08-09 14:36:12 +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
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
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
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
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
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
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
Treehugger Robot
5b7e3b9a2a Merge "Fix google-explicit-constructor warnings in utils." 2016-08-04 20:56:47 +00:00
Treehugger Robot
5f851752d3 Merge "libcutils: add sched_policy test" 2016-08-04 16:24:30 +00:00
Treehugger Robot
b3654fa086 Merge "Remove the prctl PR_SET_TIMERSLACK_PID call." 2016-08-04 02:29:16 +00:00
Hans Boehm
077135b18c Merge "Fix race bug in attemptIncStrong" 2016-08-04 01:27:04 +00:00
Greg Hackmann
ed0614c80b libcutils: add sched_policy test
Bug: 30597190

Change-Id: I51950e82235fa19bc92b3f7e8d190766d71af7df
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-08-03 23:31:50 +00:00
Elliott Hughes
d7967c1347 Remove the prctl PR_SET_TIMERSLACK_PID call.
This is broken on all devices other than N9, and has no real path to fixing
it because there are so many different values already in use (41, 43, 47,
127), with no way to tell which you should use on any given device.

Bug: http://b/30597190
Change-Id: I07eeaaf6f5dc03c5532ffbfbb85ef2ad750206a0
2016-08-03 15:11:01 -07:00
Treehugger Robot
ed3596aadf Merge "Switch libprocessgroup to libbase logging." 2016-08-03 17:04:36 +00:00
Treehugger Robot
33bf662195 Merge "Fix google-explicit-constructor warnings in logd." 2016-08-03 16:29:17 +00:00
Elliott Hughes
171df0a092 Switch libprocessgroup to libbase logging.
This lets us see what's going on in init.

Bug: http://b/29751426
Merged-In: I73432dc7608ca0dc8e421a2f3a750b37c6743f62
Change-Id: I73432dc7608ca0dc8e421a2f3a750b37c6743f62
2016-08-03 09:11:04 -07:00
Treehugger Robot
9a5300fcb8 Merge "Have init kill the process group." 2016-08-02 23:01:54 +00:00
Elliott Hughes
1e73024653 Have init kill the process group.
killProcessGroup actually works on cgroups. Kill the POSIX process
group ourselves.

Bug: http://b/29751426
Change-Id: I1a2808488510f4262811b6407bcd0948ad23bc60
2016-08-02 14:20:40 -07:00
Dan Willemsen
11708e0236 Merge "Remove Brillo-specific LOCAL_MODULE_TAGS" 2016-08-02 20:30:06 +00:00
Chih-Hung Hsieh
2a929968e1 Fix google-explicit-constructor warnings in utils.
* Declare explicit conversion constructors.
* Use NOLINT(implicit) for implicit conversion constructors.

Bug: 28341362
Change-Id: I4fb58fa32aafc520b2ed862a05a8bdbfabbc6c35
Test: build with WITH_TIDY=1
2016-08-02 12:20:06 -07:00
Chih-Hung Hsieh
9e70ba6352 Fix google-explicit-constructor warnings in logd.
Bug: 28341362
Change-Id: I5b419c40593982925034e9b7217b0eb53c51adcb
Test: build with WITH_TIDY=1
2016-08-02 11:31:44 -07:00
Treehugger Robot
c97b73aa83 Merge changes I1d398d19,I8f20b3cd
* changes:
  adb: fix stat on Windows.
  adb: extract Windows bits out of directory_exists test.
2016-08-01 21:54:00 +00:00
Treehugger Robot
4efbce14b5 Merge "Fix clang-tidy performance warnings in syste/core." 2016-08-01 20:13:54 +00:00
Josh Gao
f551ea0f63 adb: fix stat on Windows.
stat on Windows fails with ENOENT when passed a path with a trailing
slash or backslash, regardless of whether the target is actually a
directory. Emulate the correct POSIX behavior by stripping trailing
path separators and then checking if the target is a directory if
successful.

Bug: http://b/30481559
Bug: https://code.google.com/p/android/issues/detail?id=214633
Change-Id: I1d398d19a9bce1ecb3fdc4aabc31aa98c82c3f93
Test: Relevant adb_tests pass on Linux and Windows 10.
2016-08-01 12:36:04 -07:00
Chih-Hung Hsieh
8f7b9e3d39 Fix clang-tidy performance warnings in syste/core.
* Use const reference type for parameters to avoid unnecessary copy.
* Suppress warning of not using faster overloaded string find function.

Bug: 30407689
Bug: 30411878
Change-Id: I6cfdbbd50cf5e8f3db6e5263076d3a17a9a791ee
Test: build with WITH_TIDY=1
Merged-In: Ie79dbe21899867bc62031f8618bb1322b8071525
2016-08-01 11:55:42 -07:00
Dan Willemsen
4e09dd8cce Remove Brillo-specific LOCAL_MODULE_TAGS
Replaced with PRODUCT_PACKAGES_ENG in brillo_base.mk

Change-Id: I66f467d95745aa6b1f3c81aa87a3f139a33dbebf
2016-07-31 18:45:14 -07:00