Commit graph

17259 commits

Author SHA1 Message Date
Steve Fung
568336613f crash_reporter: Use os-release.d to store the crash server url
Since all of the other configs use os-release.d rather than
system properties, switch the crash server url as well.  This also
makes the product configuration more straightforward.

Bug: 24989289
Change-Id: Ia4b423e59937a917c882e74b110b5ea520ca6016
2015-10-16 02:25:56 -07:00
Sami Tolvanen
b8cc70a94b Merge "Error correction: Use libfec in fs_mgr" 2015-10-16 05:48:39 +00:00
David Pursell
ca0d66d597 Merge "adb: non-interactive shell stdin." 2015-10-15 21:37:02 +00:00
David Pursell
1ed57f0dc3 adb: non-interactive shell stdin.
Non-interactive `adb shell` previously only read from the remote shell,
but we want it to write as well so interactive and non-interactive
shells can both send data. With this CL, we can now do:
  $ echo foo | adb shell cat
  foo

This is primarily usable with newer devices that support the shell_v2
features. Older devices will receive stdin but the shell will still
hang after all input has been sent, requiring user Ctrl+C. This seems
better than closing communication altogether which could potentially
miss an unpredictable amount of return data by closing too early.

Known issue: non-interactive stdin to a PTY shell isn't reliable.
However I don't think this is a common case as ssh doesn't seem to
handle it properly either. Examples:
  * echo 'echo foo' | adb shell
  * echo 'foo' | adb shell -t cat

Bug: http://b/24565284
Change-Id: I5b017fd12d8478765bb6e8400ea76d535c24ce42
2015-10-15 09:44:54 -07:00
Steve Fung
51bdc5bf1a Merge "Update crash_reporter and metrics rc files to trigger on post-fs-data" 2015-10-15 03:59:33 +00:00
Steve Fung
0d6cdfb7f0 Update crash_reporter and metrics rc files to trigger on post-fs-data
The /data directory isn't guaranteed to be mounted during the
"on boot" trigger, so switch them to using "on post-fs-data".

Bug: 24941965
Change-Id: Iee84ca0e934967cff7bc4d968d9939d398c73980
2015-10-14 18:22:32 -07:00
Bertrand Simonnet
defbd39ceb Merge "metricsd: Read build time values from etc/os-release.d." 2015-10-15 00:33:01 +00:00
Bertrand SIMONNET
eb697abf5e metricsd: Read build time values from etc/os-release.d.
This stops relying on system properties to provide build time
configuration.
Product version and id will be stored in /etc/os-release.d.
Channel will be pulled from update engine.

BUG: 24947119
Change-Id: I0972d03cd83ef622846de3cce3dec1992fcc46cd
2015-10-14 15:58:06 -07:00
Steve Fung
fcc93587a1 Merge "crash_reporter: Update to use the os-release.d configs" 2015-10-14 22:48:25 +00:00
Sami Tolvanen
99e3a927e8 Error correction: Use libfec in fs_mgr
Use libfec to read and parse verity metadata to protect against data
corruption.

Bug: 21893453
Change-Id: I3a3543e0d999316707302b3be8735a7133d22946
2015-10-14 22:12:04 +01:00
Christopher Ferris
7d691756e8 Merge "Make allocations use unique_ptr." 2015-10-14 21:10:05 +00:00
Christopher Ferris
634df89db6 Make allocations use unique_ptr.
Change-Id: I4b84b8106faeaeb61847f8f9d13fd6444f474efd
2015-10-14 14:03:29 -07:00
Sami Tolvanen
4bd3148e0f Merge "Revert "Error correction: Use libfec in fs_mgr"" 2015-10-14 19:47:59 +00:00
Sami Tolvanen
0923453462 Revert "Error correction: Use libfec in fs_mgr"
This reverts commit 3de3a0f351.

Change-Id: I1f121cbc4431b8d8ff146eab29832a8dda1eb8ba
2015-10-14 19:46:16 +00:00
Badhri Jagan Sridharan
ba0005118b Merge "adbd: Add os descriptor support for adb." 2015-10-14 17:28:53 +00:00
Sami Tolvanen
a2cfddd37e Merge "Error correction: Use libfec in fs_mgr" 2015-10-14 16:35:51 +00:00
Steve Fung
72e3c828dc crash_reporter: Update to use the os-release.d configs
The product_id and product_version has been moved into the
/etc/os-release.d key-value store, update crash_reporter to
use these values.

Bug: 22874192
Change-Id: I71886574d1aa4e0a3ac18e1c361ec65684af9b49
2015-10-13 16:34:01 -07:00
Alex Vakulenko
7d85a6a568 Merge "system/core: Rename "chromeos" -> "brillo" in include paths and namespaces" 2015-10-13 23:12:29 +00:00
Alex Vakulenko
74dc62460b system/core: Rename "chromeos" -> "brillo" in include paths and namespaces
libchromeos is transitioning to libbrillo and chromeos namespaces
and include directory is changing to brillo.

Bug: 24872993
Change-Id: I797613a38c7444a113f12e38366a424388477276
2015-10-13 15:29:24 -07:00
Mark Salyzyn
cee44732e6 Merge "logd: correct for number of elements in prune" 2015-10-13 22:20:29 +00:00
Steve Fung
4f11a401fc Merge "crash_reporter: Report the bdk_version" 2015-10-13 21:14:35 +00:00
Mark Salyzyn
58b8be8906 logd: correct for number of elements in prune
Chatty logs would distort the average log size by elevating the
elements, but not the size. Add statistical collection for the
number of elements that report chatty, and subtract that from
the number of elements to improve the pruning estimate. Pick
minElements as 1% rather than 10% of the total with this more
accurate number of elements, to a minumum of 4.

Bug: 24511000
Change-Id: I3f36558138aa0b2a50e4fac6440c3a8505d95276
2015-10-13 13:43:16 -07:00
Mark Salyzyn
9b3a2784b9 Merge "logd: use coalesce instead of merge (cleanup)" 2015-10-13 16:47:15 +00:00
Sami Tolvanen
3de3a0f351 Error correction: Use libfec in fs_mgr
Use libfec to read and parse verity metadata to protect against data
corruption.

Bug: 21893453
Change-Id: Ieee6a1441e2f68148ba635235216e36c69b13db1
2015-10-13 15:53:25 +01:00
Elliott Hughes
2154e42168 Merge "Switch to android::base::ReadFully" 2015-10-13 14:50:22 +00:00
Johan Redestig
67b3cad9a0 Switch to android::base::ReadFully
The if (read(...size) != size) pattern is unreliable, switch
to the android base ReadFully which wraps read in a loop.

Change-Id: I2324e4c45da3c9b53b18df6eb09ce69a6604b5d1
2015-10-13 14:49:38 +00:00
Elliott Hughes
73bf853edf Merge "Switch fs_mgr_verity.c to C++." 2015-10-13 14:43:47 +00:00
Sergio Giro
f83766079e Merge "system/core: fix iterator for LruCache" 2015-10-13 07:30:34 +00:00
Mark Salyzyn
1c04253af2 Merge "logd: object layer format statistics" 2015-10-12 22:10:30 +00:00
Alex Vakulenko
5117e41392 Merge "Update metrics to use weaved's client library" 2015-10-12 20:36:15 +00:00
Sergio Giro
0cb59c0dce system/core: fix iterator for LruCache
Was failing to return the first element

Change-Id: Ic803f5d463a56519212014d0d190407cf4b859cf
2015-10-12 16:13:44 +01:00
Steve Fung
aa265b633b crash_reporter: Report the bdk_version
Add the bdk_version to the crash report.

Bug: 24579018
Change-Id: I00ad1079ee3aacc5d0456f80d83f42c4d28045df
2015-10-12 00:42:05 -07:00
Nick Kralevich
2fb90dc8b2 Merge changes from topic 'userspace-audit'
* changes:
  debuggerd: audit pid, uid and gid on SE Linux denial
  property_service: log pid,uid and gid of setprop client
2015-10-10 20:07:24 +00:00
Steve Fung
4b2d6dd346 Merge "crash_reporter: Use the actual GID of the crashing process" 2015-10-10 05:33:49 +00:00
Alex Vakulenko
82b02de5aa Update metrics to use weaved's client library
Do not use weave'd D-Bus proxies directly. Use the new client library.

Change-Id: I524d9c5c4c057bd1f82a280ec96848b8a8f4fe29
2015-10-09 20:07:47 -07:00
Nick Kralevich
9e27cab695 Merge "init.rc: Disable sysrq from the keyboard" 2015-10-10 00:33:50 +00:00
Steve Fung
773fd3c428 crash_reporter: Use the actual GID of the crashing process
Rather than assuming the UID and GID of crashing processes is
the same, report and use the actual GID that the process was
running as.

Bug: 24678424
Change-Id: I3cfc415be2feb2863a4f4b850bfd4a3267217a44
2015-10-09 17:16:48 -07:00
Nick Kralevich
d28a535d9a init.rc: Disable sysrq from the keyboard
Don't allow the accidental triggering of sysrq functionality
from the keyboard. The only expected use of sysrq functionality
is via /proc/sysrq-trigger

Please see https://www.kernel.org/doc/Documentation/sysrq.txt for
additional information on /proc/sys/kernel/sysrq

Bug: 13435961
Change-Id: I60dc92a4b2b4706e8fa34a6cead9abd449f7375f
2015-10-09 17:09:10 -07:00
Alex Vakulenko
a3ae129f22 Merge "metricsd: Update weave command APIs" 2015-10-09 22:10:56 +00:00
Mark Salyzyn
aaad42f47c logd: use coalesce instead of merge (cleanup)
- switch to coalesce instead of merge in naming of functions
  and variables. Confusing since we also to merge-sorts and
  other activities in the logger.
- define maxPrune rather than using a number in the code path.

Bug: 24511000
2015-10-09 15:00:44 -07:00
Elliott Hughes
55793400f2 Merge "init shouldn't call DumpState by default." 2015-10-09 21:23:22 +00:00
Elliott Hughes
1946d3bca8 init shouldn't call DumpState by default.
The cost of generating and throwing away a bunch of stuff that no one
normally sees is high enough to be worth avoiding.

Here's AOSP ToT on N9...

 init: (Parsing /system/etc/init/atrace.rc took 0.0112s.)
 init: (Parsing /system/etc/init/bootanim.rc took 0.0094s.)
 init: (Parsing /system/etc/init/crash_reporter.rc took 0.0103s.)
 init: (Parsing /system/etc/init/debuggerd.rc took 0.0090s.)
 init: (Parsing /system/etc/init/debuggerd64.rc took 0.0085s.)
 init: (Parsing /system/etc/init/drmserver.rc took 0.0078s.)
 init: (Parsing /system/etc/init/dumpstate.rc took 0.0073s.)
 init: (Parsing /system/etc/init/gatekeeperd.rc took 0.0063s.)
 init: (Parsing /system/etc/init/installd.rc took 0.0067s.)
 init: (Parsing /system/etc/init/keystore.rc took 0.0060s.)
 init: (Parsing /system/etc/init/lmkd.rc took 0.0060s.)
 init: (Parsing /system/etc/init/logcatd.rc took 0.0059s.)
 init: (Parsing /system/etc/init/logd.rc took 0.0068s.)
 init: (Parsing /system/etc/init/mdnsd.rc took 0.0057s.)
 init: (Parsing /system/etc/init/mediaserver.rc took 0.0064s.)
 init: (Parsing /system/etc/init/metrics_daemon.rc took 0.0063s.)
 init: (Parsing /system/etc/init/mtpd.rc took 0.0055s.)
 init: (Parsing /system/etc/init/netd.rc took 0.0066s.)
 init: (Parsing /system/etc/init/perfprofd.rc took 0.0057s.)
 init: (Parsing /system/etc/init/racoon.rc took 0.0054s.)
 init: (Parsing /system/etc/init/rild.rc took 0.0061s.)
 init: (Parsing /system/etc/init/servicemanager.rc took 0.0063s.)
 init: (Parsing /system/etc/init/surfaceflinger.rc took 0.0061s.)
 init: (Parsing /system/etc/init/uncrypt.rc took 0.0068s.)
 init: (Parsing /system/etc/init/vdc.rc took 0.0065s.)
 init: (Parsing /system/etc/init/vold.rc took 0.0063s.)

0.0112+0.0094+0.0103+0.0090+0.0085+0.0078+0.0073+0.0063+0.0067+0.0060+
0.0060+0.0059+0.0068+0.0057+0.0064+0.0063+0.0055+0.0066+0.0057+0.0054+
0.0061+0.0063+0.0061+0.0068+0.0065+0.0063 = 0.1809

And here it is again with the logging disabled:

 init: (Parsing /system/etc/init/atrace.rc took 0.0021s.)
 init: (Parsing /system/etc/init/bootanim.rc took 0.0006s.)
 init: (Parsing /system/etc/init/crash_reporter.rc took 0.0007s.)
 init: (Parsing /system/etc/init/debuggerd.rc took 0.0004s.)
 init: (Parsing /system/etc/init/debuggerd64.rc took 0.0005s.)
 init: (Parsing /system/etc/init/drmserver.rc took 0.0005s.)
 init: (Parsing /system/etc/init/dumpstate.rc took 0.0005s.)
 init: (Parsing /system/etc/init/gatekeeperd.rc took 0.0005s.)
 init: (Parsing /system/etc/init/installd.rc took 0.0005s.)
 init: (Parsing /system/etc/init/keystore.rc took 0.0013s.)
 init: (Parsing /system/etc/init/lmkd.rc took 0.0006s.)
 init: (Parsing /system/etc/init/logcatd.rc took 0.0013s.)
 init: (Parsing /system/etc/init/logd.rc took 0.0007s.)
 init: (Parsing /system/etc/init/mdnsd.rc took 0.0005s.)
 init: (Parsing /system/etc/init/mediaserver.rc took 0.0009s.)
 init: (Parsing /system/etc/init/metrics_daemon.rc took 0.0008s.)
 init: (Parsing /system/etc/init/mtpd.rc took 0.0011s.)
 init: (Parsing /system/etc/init/netd.rc took 0.0005s.)
 init: (Parsing /system/etc/init/perfprofd.rc took 0.0005s.)
 init: (Parsing /system/etc/init/racoon.rc took 0.0005s.)
 init: (Parsing /system/etc/init/rild.rc took 0.0005s.)
 init: (Parsing /system/etc/init/servicemanager.rc took 0.0005s.)
 init: (Parsing /system/etc/init/surfaceflinger.rc took 0.0005s.)
 init: (Parsing /system/etc/init/uncrypt.rc took 0.0005s.)
 init: (Parsing /system/etc/init/vdc.rc took 0.0005s.)
 init: (Parsing /system/etc/init/vold.rc took 0.0006s.)

0.0021+0.0006+0.0007+0.0004+0.0005+0.0005+0.0005+0.0005+0.0005+0.0013+
0.0006+0.0013+0.0007+0.0005+0.0009+0.0008+0.0011+0.0005+0.0005+0.0005+
0.0005+0.0005+0.0005+0.0005+0.0005+0.0006 = 0.0181

It's less than a second, but one problem is that the cost of the current
dumping is proportional to the number of init.rc files, so the more
cleanly you factor things, the more it would cost.

Change-Id: Id96f59e7d0b082d8cfdba4bdbff43a922ba4eeee
2015-10-09 14:03:14 -07:00
Elliott Hughes
246c18caf5 Switch fs_mgr_verity.c to C++.
This is the minimal change just to keep it building, and doesn't
attempt to clean up any of the code.

Change-Id: I975710322ae33d8946497df25bf85b2fe28976a4
2015-10-09 11:52:00 -07:00
Alex Vakulenko
35f8963825 metricsd: Update weave command APIs
Weave has changed some of D-Bus APIs and metrics needs to be updated
accrdingly. Command::Done is replaced with Complete(), Command::Abort
now takes error code and error messages, Command::category is removed
and Command::status is renamed to Command::state

Change-Id: Ifbfd6d852f4a328168e28484d1152a24b8c8b42b
2015-10-09 08:18:35 -07:00
Steve Fung
23fe7be8d6 Merge "crash_reporter: Support crashes from arbitrary users" 2015-10-08 22:11:13 +00:00
Mark Salyzyn
df345a8aac Merge changes Icc984f40,Ie4c46bc9,I0f238985,I63a729d2,I2b5900a2
* changes:
  logd: clearAll by UID speedup
  logd: clear return and deal with busy if readers locked
  logd: update region lock after entry has passed to reader socket
  logcat: do not exit buffer loop on error
  logd: clientHasLogCredentials false negatives
2015-10-08 14:22:03 +00:00
Steve Fung
6db7cd7836 crash_reporter: Support crashes from arbitrary users
In order to read the /proc/<pid> files from non-root users without
using CAP_SYS_PTRACE and CAP_DAC_OVERRIDE, use setresuid(..) and
setresgid(..) to switch to the process's user to copy off necessary
files for generating the breakpad minidump.

Bug: 24678424
Change-Id: I4a43583033587441394483ce678c40c4161808b9
2015-10-07 18:16:53 -07:00
Nick Kralevich
b3fbdf5583 Merge "fs_config.c: remove setuid from procrank" 2015-10-08 00:08:58 +00:00
Elliott Hughes
21f99c089e Merge "Use const auto&/auto&& in adb." 2015-10-07 23:54:17 +00:00
Nick Kralevich
e2b2996d96 fs_config.c: remove setuid from procrank
procrank only exists on userdebug/eng builds. For those builds,
procrank can be executed by running "su 0 procrank" instead of
relying on the binary being setuid root. This reduces the number
of setuid binaries on Android and allows for the deletion of
SELinux policy to support this.

Bug: 18342188
Change-Id: I982283f2e0f6fbe5efaffc08501c1ec175f65373
2015-10-07 16:41:47 -07:00