Commit graph

13040 commits

Author SHA1 Message Date
Christopher Ferris
35c8136d96 Remove PtraceRead error message.
This error message has no meaning and makes it look like an unwinding
failure occurred. These messages are showing up more often now
that a lot more of debuggerd is using the ReadWord and Read calls.

If a higher level function wants to indicate there is an error, then
it can add a more meaningful error.

Bug: 21818730
Change-Id: I83aca9cf241aee99e7425059b1b6e0d229c08a5e
2015-06-12 23:03:22 -07:00
Nick Kralevich
4d87095ebf Remove calls to is_selinux_enabled()
d34e407aeb removed support for
running with SELinux completely disabled. SELinux must either be
in permissive or enforcing mode now.

Remove unnecessary calls to is_selinux_enabled(). It always returns
true now.

Change-Id: Ife3156b74b13b2e590afe4accf716fc7776567e5
2015-06-12 22:12:33 -07:00
Mark Salyzyn
555d91985d Merge "Revert "logd: regression in log_strtok_r"" 2015-06-12 22:37:22 +00:00
Mark Salyzyn
4fb24dda34 Revert "logd: regression in log_strtok_r"
This reverts commit d3c5093a3c.

Change-Id: I52558fd0e9f75ba1cc6a151785fc91857c27ab9a
2015-06-12 22:36:57 +00:00
Mark Salyzyn
de42d34cd5 Merge "logd: regression in log_strtok_r" 2015-06-12 22:33:11 +00:00
Mark Salyzyn
d3c5093a3c logd: regression in log_strtok_r
In commit 'logd: fix kernel logline stutter'
2c3b300fd8 we introduced log_strtok_r.
as a replacement for strtok_r that dealt with a problem with
some kernel log messages. Fix is to refine definition of
is_timestamp to not match on patterns like [0].

Change-Id: I0867a555a3bca09bbf18d18e75e41dffffe57a22
2015-06-12 22:21:44 +00:00
Elliott Hughes
4931ae545a Merge "Minor "adb help" fixes." 2015-06-12 21:45:12 +00:00
Elliott Hughes
7e067cff7a Minor "adb help" fixes.
One day we should slim this down. (Maybe implement the "help" versus
"help all" distinction that doesn't currently exist but was documented
before this change.)

Bug: https://code.google.com/p/android/issues/detail?id=158394
Change-Id: Ie24b588ffea00d262ce7ab0e5c328120ba8af240
2015-06-12 14:33:17 -07:00
Evgenii Stepanov
c1c7f457d7 Merge "Add a space before :=." 2015-06-12 21:31:27 +00:00
Evgenii Stepanov
1d2567eb7c Merge "Fix SANITIZE_TARGET build of liblog." 2015-06-12 21:31:00 +00:00
Evgenii Stepanov
6aaf740834 Add a space before :=.
Change-Id: Ib1d94648cdc163675ac7b6acf86408d5be6b5ad2
2015-06-12 14:18:33 -07:00
Evgenii Stepanov
c744ef5547 Fix SANITIZE_TARGET build of liblog.
* liblog does not use STL, don't link it.
* ASan runtime library depends on liblog, hence liblog can never be
  sanitized.

Bug: 21785137
Change-Id: I1e97378c61d4d18d740287f5f0881427aa7cc227
2015-06-12 14:18:33 -07:00
Mark Salyzyn
e59c469fa8 logd: filter on __android_log_is_loggable
- Default level when not specified is ANDROID_LOG_VERBOSE
  which is inert.

Bug: 20416721
Bug: 19544788
Bug: 17760225
Change-Id: Icc098e53dc47ceaaeb24ec42eb6f61d6430ec2f6
2015-06-12 10:35:09 -07:00
Mark Salyzyn
c158456f50 liblog: __android_log_is_loggable support global properties
- Add support for "log.tag" and "persist.log.tag" global
  logging properties, effectively a runtime default minimum
  logging level.
- Add a thread-safe single level cache plus selective logic for the
  four properties being checked to help speed up logging decision
  on subsequent identical calls.
- Using new __system_property_area_serial() to make for
  efficient (<100ns) handling of cache misses. Despite adding
  two new properties, we are 8 times faster on subsequent calls
  even if the properties do not exist.
- A NULL or blank tag is no longer directed to return default,
  it will check the pair of global logging properties first.
- Add liblog.is_loggable gTest
- Fixup liblog.android_logger_get_, allow no content in crash buffer
- Fixup liblog.max_payload, lowered logd priority increases latency

Bug: 19544788
Bug: 21696721
Change-Id: Ideb887755aa3f1fd14a2603bda1fe23cba49642c
2015-06-12 10:35:09 -07:00
Elliott Hughes
57bd480c3b Merge "Make it clearer to grep that init is built with clang." 2015-06-11 15:03:55 +00:00
Elliott Hughes
1115c25d5e Make it clearer to grep that init is built with clang.
Change-Id: Ic2abffd27e382cb691d772cdf088442645e59bf7
2015-06-10 22:43:51 -07:00
Elliott Hughes
c604ccfadd Merge "Only pass nomblk_io_submit option when mounting ext4" 2015-06-11 01:22:57 +00:00
Elliott Hughes
116db9293b Merge "Fix fastboot --help formatting." 2015-06-10 19:12:21 +00:00
Elliott Hughes
08df533e2a Fix fastboot --help formatting.
Bug: http://b/21755417
Change-Id: I827d8e9ebe7ba8e8f75c2fa0ca975560817c18fa
2015-06-10 12:10:00 -07:00
Sami Tolvanen
4e359e1da3 Merge "fs_mgr: Use ro.boot.veritymode" 2015-06-10 16:55:55 +00:00
Sami Tolvanen
ac5c1224cf fs_mgr: Use ro.boot.veritymode
If verity state is managed by bootloader, it will pass the verity
mode to the kernel in the androidboot.veritymode command line
parameter. Init copies the value to the ro.boot.veritymode property.

Check for ro.boot.veritymode in fs_mgr and use the value to set
dm-verity mode. If this property is not set, store verity state in
metadata as before, if a storage location is specified in fstab.

Change-Id: Ife3c978c133248432c302583d3b70e179605fe42
2015-06-10 17:40:29 +01:00
Tao Bao
22644e52f0 Merge "Change pre-recovery into two services" 2015-06-10 00:43:34 +00:00
Tao Bao
04b10b9aa3 Change pre-recovery into two services
/system/bin/uncrypt needs to be triggered to prepare the OTA package
before rebooting into the recovery. Separate pre-recovery (uncrypt)
into two services: uncrypt that does the uncryption work and
pre-recovery that actually reboots the device into recovery.

Also create /cache/recovery on post-fs in case it doesn't exist.

Bug: 20012567
Bug: 20949086
(cherry picked from commit e48aed0f0a)
Change-Id: I9877cd6ac9412ea6a566bb1ec0807940c7a38ce5
2015-06-09 14:52:43 -07:00
Mark Salyzyn
177d36b985 Merge "Lower the priority of the threads in logd/logcat." 2015-06-09 19:42:08 +00:00
Riley Andrews
aede9897df Lower the priority of the threads in logd/logcat.
(cherry pick from commit d98f4e8af5)

sched_batch implies only a penalty to latency in scheduling, but
does not imply that the process will be given less cpu time. Increase
the nice level to 10 to prioritize it below ui threads.

Bug: 21696721
Change-Id: I075af059dc755402f7df9b0d7a66cca921ff04b2
2015-06-09 12:40:20 -07:00
Spencer Low
3abd31d8f4 adb server: don't close stale fd when TCP transport is closed
I think this fixes a scary bug that could be on all host platforms.

When running 'adb unroot' with an emulator, the connection to the
emulator is dropped (as expected). I noticed that the adb.log showed:

_fh_from_int:  1168: 5280 | _fh_from_int: invalid fd 106 passed to adb_close

Background: Every transport has a socketpair (two bidirectional sockets
connected to each other to form one 'pipe') that are used as follows:

* When adb wants to write to a transport, it writes to
t->transport_socket (half of the socketpair). An input thread reads from
t->fd (the other half of the socketpair) and writes the data to the
underlying transport (TCP, USB).

* An output thread reads from the underlying transport (TCP, USB) and
writes the data to t->fd. The main thread runs fdevent_loop() which
reads from t->transport_socket and processes the packets (that really
came from the underlying transport).

So t->fd and t->transport_socket are just an intermediate pipe between
transport agnostic code in adb and the underlying transport (TCP, USB).

Here's what I think is going on:

1. When the TCP transport is closed (such as when running adb unroot),
adb server's output thread notices this (adb_read() returns zero), and
it writes a special packet to t->fd.

2. The main thread processes the special packet by writing the special
packet to the input thread.

3. input_thread() sees the special packet, so it breaks out of a read
loop and calls transport_unref() which calls transport_unref_locked().

4. transport_unref_locked() calls t->close() which is a function pointer
that points to transport_local.cpp: remote_close() which calls
adb_close(t->fd). <----- ****THIS IS THE BUG****

I think this is a (very old) typo and it should instead be
adb_close(t->sfd) (the transport’s actual TCP socket) because it does
not make sense for the particular transport mechanism (TCP, USB) to be
messing with a socket of the socketpair of the transport agnostic code
(t->fd).

5. transport_unref_locked() calls remove_transport() which writes an
action to another special socketpair.

6. The action is read and eventually transport_registration_func() is
called and it calls adb_close(t->fd). But t->fd was already
(erroneously) closed in #4 above!! Anyway, this causes the adb.log
output.

The fix is to fix the typo changing t->fd to t->sfd and adding some
resiliency around whether the socket has already been closed (probably
by remote_kick()).

I tested this by putting a new adbd on an emulator, a new adb on Linux
and Windows and running the adb unroot scenario and checking adb.log. I
also ran test_adb.py (which doesn't totally work without problems with
an emulator, but I'll leave that to another day.)

Change-Id: I188b6c74917a3d721c150fd17ed0f2b63a2178c3
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2015-06-09 12:32:17 -07:00
Oreste Salerno
6ed84c986f Only pass nomblk_io_submit option when mounting ext4
This option only exists for ext4 filesystems, so it shouldn't be
used when mounting ext2/ext3.
This bug would cause the mount system call in check_fs to always fail
with ext2/ext3 filesystems.

Change-Id: I3c8938029357a4a4170355118b6757f61ff4b227
2015-06-09 16:38:35 +00:00
Elliott Hughes
6af8e11f4c Merge "Switch to toybox mount(1)." 2015-06-08 22:23:32 +00:00
Elliott Hughes
fa76ffccaa Merge "adb: win32: fix logging to adb.log" 2015-06-08 22:21:31 +00:00
Mark Salyzyn
69ecfdd570 Merge "logd: build breakage" 2015-06-08 21:55:52 +00:00
Elliott Hughes
24d41e76e7 Switch to toybox mount(1).
Change-Id: Ieda6e2bfbf5ea3e9a96f5facfded4c2a467e4a02
2015-06-08 14:52:25 -07:00
Mark Salyzyn
3e21de2915 logd: build breakage
OPEN_BRACKET_SPACE comparison always false

Change-Id: I1ff4288b4b79a49702727d3a8b8c8f179f500951
2015-06-08 14:52:14 -07:00
Mark Salyzyn
42951a8be7 Merge "logd: fix kernel logline stutter" 2015-06-08 20:33:13 +00:00
Mark Salyzyn
2c3b300fd8 logd: fix kernel logline stutter
- look for cases where one log line contains two without a newline.
- rare condition, occurs when a printk does not have
  a terminating newline under certain race conditions.
- the newline may be performed broken up as a second call
- the timestamps can be reversed (showing the race effects).
- driver(s) should really have the newline in there log messages.

Change-Id: Ibfb56b32047da3d6513db059ca6edad0f0105168
2015-06-08 13:10:31 -07:00
Elliott Hughes
e106191436 Merge "Make start/stop warn if you're not root." 2015-06-06 00:18:33 +00:00
Elliott Hughes
a945643831 Merge "Fix test_adb.py against production builds." 2015-06-06 00:16:23 +00:00
Paul Lawrence
af0baad7a6 Merge "adb shouldn't trace unless told to" 2015-06-06 00:08:57 +00:00
Elliott Hughes
6e83c3d76d Make start/stop warn if you're not root.
Bug: https://code.google.com/p/android/issues/detail?id=165602
Change-Id: Ia1e2de1697d971381b0c949fdaaeff424ab8bf32
2015-06-05 17:01:01 -07:00
Paul Lawrence
6f009d9496 adb shouldn't trace unless told to
Prevents clean unmount of /data in crypto bounce

Bug: 21516860
Change-Id: I1f761dfdf216dcb35b4609cd46cc4d0644cc4a81
2015-06-05 16:01:48 -07:00
Elliott Hughes
3595328564 Fix test_adb.py against production builds.
Also use assertEqual for better errors. (I accidentally tested against
a non-AOSP build that doesn't have the \r fix.)

Change-Id: Ib032c01efa4e1efb14467ca776a14160fff4ad39
2015-06-05 13:11:43 -07:00
Mark Salyzyn
515d581d2d Merge "logd: filters remove leading expire messages and rate" 2015-06-05 17:18:26 +00:00
Mark Salyzyn
047cc0729f logd: filters remove leading expire messages and rate
- Cleanup resulting from experience and feedback
- When filtering inside logd, drop any leading expire messages, they
  are cluttering up leading edge of tombstones (which filter by pid)
- Increase and introduce EXPIRE_RATELIMIT from 1 to 10 seconds
- Increase EXPIRE_THRESHOLD from 4 to 10 count
- Improve the expire messages from:
   logd : uid=1000(system) too chatty comm=com.google.android.phone,
                                                   expire 2800 lines
  change tag to be more descriptive, and reduce accusatory tone to:
   chatty : uid=1000(system) com.google.android.phone expire 2800
                                                               lines
- if the UID name forms a prefix for comm name, then drop UID name

Change-Id: Ied7cc04c0ab3ae02167649a0b97378e44ef7b588
2015-06-05 08:05:05 -07:00
Elliott Hughes
f9ae390f63 Merge "adb: win32: get test_adb.py running and passing 100%" 2015-06-05 00:50:08 +00:00
Elliott Hughes
ebce147077 Merge "adb: fix adb_close() vs. unix_close() usage" 2015-06-04 22:28:50 +00:00
Elliott Hughes
e1a06a5502 Merge "Fix whitespace in debug logging." 2015-06-04 22:23:45 +00:00
Elliott Hughes
e49236b3da Fix whitespace in debug logging.
Change-Id: I949317deaf782fea18b5c38b22dfd41811608276
2015-06-04 15:21:59 -07:00
Mark Salyzyn
7ea9e8d266 Merge "logd: switch to unordered_map from BasicHashtable" 2015-06-04 18:01:01 +00:00
Rom Lemarchand
4d2c1ee141 Merge "mkbootimg: misc typo fixes" 2015-06-04 17:01:00 +00:00
Rom Lemarchand
a8221d3427 mkbootimg: misc typo fixes
- Fix whitespace in parse_int
- Use two dashes for kernel_offset instead of four

Change-Id: I59667da457d0f0d78a946e543d1aa0aec5e682d5
2015-06-04 09:59:01 -07:00
Mark Salyzyn
79ae578edd Merge "liblog: logcat: Add printable format modifier" 2015-06-04 15:34:48 +00:00