Commit Graph

38989 Commits

Author SHA1 Message Date
android-build-prod (mdb) 142eeae546 Merge "adb: Avoid waiting for emulator connections"
am: 8ef8d1eb6b

Change-Id: I3720cad78b1d8449c3e1cfedc57bc3c673c73b80
2018-05-01 18:55:31 -07:00
android-build-prod (mdb) 8ef8d1eb6b Merge "adb: Avoid waiting for emulator connections" 2018-05-02 01:46:12 +00:00
Luis Hector Chavez c587f02cc6 adb: Avoid waiting for emulator connections
This change exempts the emulator connections from
WaitableConnection.WaitForConnection(). This is because emulator
connections are a) more reliable and b) handled a bit differently than
normal TCP connections.

Bug: 78991667
Test: emulator -showkernel ; adb shell
Change-Id: I552946198889a82d6c265f45e8c3b38f6ac9d045
2018-05-01 17:12:16 -07:00
Tao Bao b2cacbb983 Merge changes from topic "libsparse-callback"
am: 49b7f296b9

Change-Id: I106758e1ba319e0b2f1a912fe383f5ab5752ee2f
2018-04-30 16:02:15 -07:00
Tao Bao 315efbeb9a libsparse: Use 'size_t' for the 'len' parameter in callbacks.
am: e18c03165b

Change-Id: I8ac1fc964bf8245dcc274c57656eb12425693b77
2018-04-30 16:01:43 -07:00
Tao Bao 49b7f296b9 Merge changes from topic "libsparse-callback"
* changes:
  fastboot: Track the libsparse API change.
  libsparse: Use 'size_t' for the 'len' parameter in callbacks.
2018-04-30 21:48:46 +00:00
Elliott Hughes d16019bd7d Merge "Add test_suites lines."
am: 4e6f3d9603

Change-Id: I5e12282fcd3e5d609f5ef5c47a9218e18d2ecda2
2018-04-28 09:09:54 -07:00
Elliott Hughes 4e6f3d9603 Merge "Add test_suites lines." 2018-04-28 16:02:40 +00:00
android-build-prod (mdb) e315b34fd8 Merge "crash_dump: defuse our signal handlers earlier."
am: c314d4db9f

Change-Id: I84666ea2b3239e013a02891fe3ca89e44966f151
2018-04-27 16:36:41 -07:00
android-build-prod (mdb) c314d4db9f Merge "crash_dump: defuse our signal handlers earlier." 2018-04-27 23:29:00 +00:00
android-build-prod (mdb) 3a4c6abb2e Merge "adb: Make the Connection object a std::shared_ptr"
am: 2666955d3d

Change-Id: Iccd959a9eead41516a4b9cb54b0fa9af1f57f29e
2018-04-27 16:27:55 -07:00
android-build-prod (mdb) 2666955d3d Merge "adb: Make the Connection object a std::shared_ptr" 2018-04-27 23:16:37 +00:00
Elliott Hughes 40fdf3f4ab Add test_suites lines.
Bug: N/A
Test: builds
Change-Id: Ic5e2b9206bcfcb53c774989013b5db6aab462e42
2018-04-27 16:12:06 -07:00
Josh Gao 38ac45df17 crash_dump: defuse our signal handlers earlier.
We have a LOG(FATAL) that can potentially happen before we turn off
SIGABRT. Move the signal handler defusing to the very start of main.

Bug: http://b/77920633
Test: treehugger
Change-Id: I7a2f2a0f2bed16e54467388044eca254102aa6a0
2018-04-27 13:31:47 -07:00
android-build-prod (mdb) 70d6050321 Merge "adb: Add a way to distinguish between connection failures and successes"
am: 65027d9d80

Change-Id: I1c1a7e837c1d67284bec76a9169cd71707845edc
2018-04-27 13:08:00 -07:00
android-build-prod (mdb) 65027d9d80 Merge "adb: Add a way to distinguish between connection failures and successes" 2018-04-27 19:51:25 +00:00
android-build-prod (mdb) 0209029219 Merge "Remove misleading comment."
am: 584e2fe709

Change-Id: I8432690d37d305b66edc0376fe3dad6311e571c3
2018-04-26 17:57:16 -07:00
android-build-prod (mdb) 584e2fe709 Merge "Remove misleading comment." 2018-04-27 00:49:30 +00:00
android-build-prod (mdb) 8584ffe608 Merge "Show signal sender for SI_FROMUSER signals."
am: b802255b06

Change-Id: I72095feb662d8a04b1a1faa0e8619b2f1f702e2c
2018-04-26 14:26:22 -07:00
android-build-prod (mdb) b802255b06 Merge "Show signal sender for SI_FROMUSER signals." 2018-04-26 21:16:57 +00:00
Luis Hector Chavez 9a388d5387 adb: Make the Connection object a std::shared_ptr
This change is in preparation to allow the TCP-based transports to be
able to reconnect. This is needed because multiple threads can access
the Connection object. It used to be safe to do because one instance of
atransport would have the same Connection instance throughout its
lifetime, but now it is possible to replace the Connection instance,
which could cause threads that were attempting to Write to an
atransport* to use-after-free the Connection instance.

Bug: 74411879
Test: system/core/adb/test_adb.py
Change-Id: I4f092be11b2095088a9a9de2c0386086814d37ce
2018-04-26 13:53:35 -07:00
Luis Hector Chavez 56fe753070 adb: Add a way to distinguish between connection failures and successes
This change adds a callback that is invoked exactly once, either when
the connection is fully established (i.e. CNXN packets have been sent
and received) or the atransport object is deleted before that (because
the connection failed).

This helps in distinguishing between successful and failing connections
for TCP. Especially when there is some kind of port
forwarding/multiplexing in between (like an SSH tunnel or SSLH proxy).

Bug: 74411879
Test: adb connect chromebook:22 (which runs an sslh tunnel to adbd).
      either succeeds or fails, but not fake-succeeds.

Change-Id: I7e826c6f5d4c30338a03b2d376a857ac5d05672a
2018-04-26 13:53:35 -07:00
Mika Raento fdc259bfb5 Merge "Systrace support for NNAPI"
am: da2535c0ea

Change-Id: I090393c955ed624cad2b2ea2c2be0247d6bb5cb4
2018-04-26 11:13:11 -07:00
Mika Raento da2535c0ea Merge "Systrace support for NNAPI" 2018-04-26 17:01:32 +00:00
Elliott Hughes 70d8f28945 Show signal sender for SI_FROMUSER signals.
Suicide doesn't change:

  signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------

But homicide now looks like this (this is `sleep 666` killed by
`kill -SEGV` as root:

  signal 11 (SIGSEGV), code 0 (SI_USER from pid 4446, uid 0), fault addr --------

Bug: http://b/78594105
Test: manual
Change-Id: I8c2feafba8cc5a3db85e8250004d428a464c5d9e
2018-04-26 08:19:17 -07:00
Mika Raento 2c2e3e89b0 Systrace support for NNAPI
Change-Id: I5abf283b5fb04725ec0b8ffbb8191fbddec1766b
Bug: 78137932
Test: mm
2018-04-26 09:34:22 +01:00
Elliott Hughes 78495e02d6 Merge changes Iefcb1ec9,I6df97295
am: efbbe6120b

Change-Id: I010810329e0078efbd376b8162bb11852ce54a0c
2018-04-25 16:57:56 -07:00
Elliott Hughes efbbe6120b Merge changes Iefcb1ec9,I6df97295
* changes:
  Rewrite get_sched_policy_name for safety.
  cutils: add restricted cpuset
2018-04-25 23:46:53 +00:00
Elliott Hughes 9f49508f36 Rewrite get_sched_policy_name for safety.
This way you'll get a build time error if you make the usual mistake of
adding to the enum but not adding an entry to the array.

Also improve the unit tests, and fix get_sched_policy_name's incorrect
behavior on invalid inputs.

Bug: N/A
Test: ran tests
Change-Id: Iefcb1ec9ef66267837da7a576c8be3d0cfb16cd0
2018-04-25 14:55:48 -07:00
Elliott Hughes e9f842142c Merge "Make ziparchive-tests run standalone."
am: c8a8771b6b

Change-Id: Ideba391ab6a25aae34eeced8f445ae444a871ecb
2018-04-25 14:51:53 -07:00
Elliott Hughes c8a8771b6b Merge "Make ziparchive-tests run standalone." 2018-04-25 21:38:13 +00:00
Tim Murray 419ba9e2aa cutils: add restricted cpuset
(cherrypick of 658ae90f69 without the init.rc change)

Bug: 78197570
Test: CTS
Change-Id: I6df972950b75a839caa463ae282ad000b959e8ae
2018-04-25 14:30:37 -07:00
Paul Crowley 9f5aa032f8 Merge "Wipe metadata when we wipe userdata and cache."
am: f88905d231

Change-Id: I92163caab6e2e65565d80bcf7f3661eec757afb1
2018-04-25 13:49:57 -07:00
Elliott Hughes bde0ec9e00 Make ziparchive-tests run standalone.
We need to (a) tell soong to copy our data and (b) automatically find
our data relative to our executable.

The real point of this is to be able to run these tests in APCT and
presubmit.

Bug: N/A
Test: ran tests on host and device, from a variety of directories
Change-Id: I4c0be1ac60f03953fdd5ba6e3d15b1aaa37ed019
2018-04-25 12:50:17 -07:00
Paul Crowley f88905d231 Merge "Wipe metadata when we wipe userdata and cache." 2018-04-25 19:42:56 +00:00
Paul Crowley 4d17006b57 Wipe metadata when we wipe userdata and cache.
Bug: 78469699
Test: Run "fastboot -w" and see that metadata is wiped
Change-Id: I2d795281c48b59c87d4f8f010037d95186f55684
2018-04-25 10:51:05 -07:00
Tao Bao 7d27ffdd45 fastboot: Track the libsparse API change.
Bug: 78432315
Test: Successfully flash a previously failing (huge) sparse image.
Test: `fastboot update` existing marlin-img.zip.
Change-Id: I09c9a06109769882d26be56d4a0d2a2b7b62cb5f
2018-04-25 10:37:01 -07:00
Tao Bao e18c03165b libsparse: Use 'size_t' for the 'len' parameter in callbacks.
This CL updates the callback function signature in
sparse_file_callback() and sparse_file_foreach_chunk().

Before:
int sparse_file_callback(
    struct sparse_file *s, bool sparse, bool crc,
    int (*write)(void *priv, const void *data, int len), void *priv);

int sparse_file_foreach_chunk(
    struct sparse_file *s, bool sparse, bool crc,
    int (*write)(
        void *priv, const void *data, int len, unsigned int block,
        unsigned int nr_blocks),
    void *priv);

After:
int sparse_file_callback(
    struct sparse_file *s, bool sparse, bool crc,
    int (*write)(void *priv, const void *data, size_t len), void *priv);

int sparse_file_foreach_chunk(
    struct sparse_file *s, bool sparse, bool crc,
    int (*write)(
        void *priv, const void *data, size_t len, unsigned int block,
        unsigned int nr_blocks),
    void *priv);

The length (i.e. 'len') comes from the size of a chunk, which could be
legitimately larger than INT_MAX. Prior to this CL, callers (e.g.
write_sparse_data_chunk()) were already passing unsigned int to the
callbacks. When a chunk size exceeds INT_MAX, the callback would see a
negative value, which could lead to undesired behavior. For example,
out_counter_write(), as one of the internal callbacks in libsparse,
gives a wrong sum of chunk sizes, which in turn fails the fastboot
flashing when given a huge sparse image.

It also defines SPARSE_CALLBACK_USES_SIZE_T that allows clients to keep
their codes compatibile with both versions.

Bug: 78432315
Test: `m dist` (with matching changes to all the clients)
Test: Build fastboot and successfully flash a previously failing (huge)
      sparse image.
Change-Id: Iac4bcf7b57039d08af3c57f4be00d75f6b693d93
2018-04-25 10:29:22 -07:00
Tom Cherry 587297953e Merge "logd: notify kernel log readers of new messages"
am: 6a2686b0f3

Change-Id: Ie35d577147257b9fc571628ca069d5305b163fec
2018-04-25 09:49:49 -07:00
Tom Cherry 6a2686b0f3 Merge "logd: notify kernel log readers of new messages" 2018-04-25 16:40:59 +00:00
Tao Bao a1b308e288 Merge "fastboot: sparse_file_len() returns int64_t."
am: 9249f4bc41

Change-Id: Iebfcb88abdb89f708bd34e0c6417ad4dc721c106
2018-04-25 06:40:00 -07:00
Tao Bao 9249f4bc41 Merge "fastboot: sparse_file_len() returns int64_t." 2018-04-25 13:32:43 +00:00
Steven Moreland 9261ab0080 Merge "init: clarify documentation for disabled"
am: 9feca7c249

Change-Id: I4b5d06d470dce6ef7fef036bd535e586161a9439
2018-04-24 18:11:28 -07:00
Tao Bao 41cf35f8b2 fastboot: sparse_file_len() returns int64_t.
Check that the value fits in uint32_t that's supported by the current
protocol.

Also fix and sanity check the max_size before passing it to
sparse_file_resparse(), which accepts `unsigned int`. This shouldn't
happen in practice because of RESPARSE_LIMIT (1 GiB).

Test: `fastboot flash` with small and large images.
Change-Id: I0a8279fc14c54c40a70ddce65c3b25173c0d0a40
2018-04-24 18:10:42 -07:00
Treehugger Robot 9feca7c249 Merge "init: clarify documentation for disabled" 2018-04-25 01:00:54 +00:00
Steven Moreland 8cb36868a4 init: clarify documentation for disabled
Services can be started by name or interface name now.

Bug: N/A
Test: N/A
Change-Id: I9fef619e7c27d458193311f7cd7fca4dcf8c8e72
2018-04-24 16:24:58 -07:00
Tom Cherry cbfebdbadb logd: notify kernel log readers of new messages
LogBuffer::log() returns either a negative number on error or a
positive number indicating the length of the message written.
Therefore, the check to notify kernel log readers of a new message
should be that this function's return value is > 0.

Bug: 78209416
Test: `adb logcat -b kernel` updates when new log messages are present
Change-Id: Icc18c0c22e62340994e5c26aedb72282d61c1541
2018-04-24 14:19:32 -07:00
Elliott Hughes f7b37121c6 Merge "Switch to PCRE grep."
am: 9aca01907d

Change-Id: Ica9a6728968661172ac141d8f0e404f7c80feb5a
2018-04-24 08:14:58 -07:00
Elliott Hughes 9aca01907d Merge "Switch to PCRE grep." 2018-04-24 15:08:57 +00:00
Elliott Hughes a366494fc3 Remove misleading comment.
Bug: N/A
Test: N/A
Change-Id: Ie93d9d0abb13bf204c62f6951d3a7bae650f8e08
2018-04-23 21:50:43 -07:00