Commit graph

56753 commits

Author SHA1 Message Date
Automerger Merge Worker
dff44256cf Merge "incremental_server: fix a use of uninitalized memory" am: 0ea130eab1
Change-Id: I9ec36fbf1074413cedf222773b0a81fbfde7acf7
2020-02-22 09:35:46 +00:00
Treehugger Robot
0ea130eab1 Merge "incremental_server: fix a use of uninitalized memory" 2020-02-22 09:18:55 +00:00
Automerger Merge Worker
a857716791 Merge "Add adb_pairing* tests to TEST_MAPPING." am: 2b9ac8112a
Change-Id: Id7d0395a3f766d1e0a3080f1937c26a6723aaf69
2020-02-22 02:22:32 +00:00
Joshua Duong
2b9ac8112a Merge "Add adb_pairing* tests to TEST_MAPPING." 2020-02-22 02:10:24 +00:00
Automerger Merge Worker
eeb50d0a88 Merge "adbd: fix build breakage." am: af40ce7d57
Change-Id: Ia2c744bda3ea2e630991e7622b919e3dc5e983b2
2020-02-22 01:06:46 +00:00
Arthur Ishiguro
b5693bdae7 Adds AID_CONTEXT_HUB
This will be used to access the Context Hub.

Bug: 149981913
Test: Compile
Change-Id: Ic89cf5b1a8a01ea7077bf7dd89501ed3623f217d
2020-02-21 16:56:00 -08:00
Josh Gao
af40ce7d57 Merge "adbd: fix build breakage." 2020-02-22 00:50:27 +00:00
Josh Gao
6d949e89a4 adbd: fix build breakage.
This broke because two CLs touching the Android.bp file both
independently passed presubmit, but failed when combined.

Clean up a misindentation while we're at it.

Bug: http://b/150032367
Test: mma in system/core/adb
Change-Id: I091ef9dec806c767ffb21a5fd73b2bb37ab29ff9
2020-02-22 00:43:55 +00:00
Tom Cherry
662b4691b1 liblog: add benchmark tests for not-printed message
Add a BM_log_verbose_overhead test that measure the overhead of
writing a log message that will not be printed due to verbosity
levels.  This was optimized in R to not format the log messages before
checking if they will be logged.

Results with R:
BM_log_verbose_overhead_null_mean          159 ns     159 ns    100
BM_log_verbose_overhead_null_median        159 ns     159 ns    100
BM_log_verbose_overhead_null_stddev        0.568 ns   0.464 ns  100
Results with Q:
M_log_verbose_overhead_null_mean           601 ns     600 ns    100
BM_log_verbose_overhead_null_median        601 ns     600 ns    100
BM_log_verbose_overhead_null_stddev        2.40 ns    2.23 ns   100

This benchmark shows liblog's overhead when not printing a log message
to be nearly ~4x faster than with Q.

Test: run this benchmark
Change-Id: I09a60e61bf064330bf15a9d0a946acf16e777a6d
2020-02-21 16:38:31 -08:00
Tom Cherry
3574c37f98 liblog: add __attribute__((uninitialized)) to liblog buffers
These buffers are immediately written into with *printf() and are in
the hot path, so do not initialize them.  This saves ~70ns off of each
log message, which is ~14% of the overhead within
__android_log_print() when writing to a no-op logger.

Test: liblog benchmarks
Change-Id: I2b898e72c75b57bc63fee565b49a4e00e377ed1a
2020-02-21 16:37:43 -08:00
Automerger Merge Worker
7ecfa1a7f8 Merge "adbd: remove static dependency on libcutils." am: 744ba42d2d
Change-Id: I7b96502cbb480b8d5046867e851124de3910731a
2020-02-22 00:22:15 +00:00
Joshua Duong
49dd8e560e Add adb_pairing* tests to TEST_MAPPING.
Bug: 111434128

Test: This is the test
Change-Id: I97e4d4ed6318de34a62b60144e790142d00e1629
Exempt-From-Owner-Approval: missed adding it in previous CL.
2020-02-21 16:06:27 -08:00
Josh Gao
744ba42d2d Merge "adbd: remove static dependency on libcutils." 2020-02-22 00:03:21 +00:00
George Burgess IV
19b500bd50 incremental_server: fix a use of uninitalized memory
Without this, the caller is likely to assume that their buffer is
fully usable, which clang's analyzer doesn't believe is the case.

Another option is to set `*size` to nonzero.

Caught by the static analyzer:
system/core/adb/client/incremental_server.cpp:111:31: warning: 1st
function call argument is an uninitialized value
[clang-analyzer-core.CallAndMessage]

Bug: None
Test: TreeHugger
Change-Id: Ib844aa4ab3ebb297ca8f6f4289bbe3212275275b
2020-02-21 14:36:31 -08:00
Automerger Merge Worker
7c6cb8b9dc Merge changes from topic "adbwifi-system-core" am: e20d3a006a
Change-Id: If686ba95502883a9fa47be6eb91e0ecc75e74a38
2020-02-21 21:14:53 +00:00
Automerger Merge Worker
8cc1101a45 Merge "[adbwifi] Add pairing_auth library." am: df8f1217d0
Change-Id: I7e12cc0c936d2a78939c1edf0355e543807c4b4a
2020-02-21 21:14:41 +00:00
Automerger Merge Worker
f3c0bcf622 Merge "adbd_auth function signature changes." am: d62c817cce
Change-Id: I39eea46dc9d475bf9724125708541c577fbab4c7
2020-02-21 21:14:29 +00:00
Joshua Duong
e20d3a006a Merge changes from topic "adbwifi-system-core"
* changes:
  [adbwifi] Add A_STLS command.
  [adbwifi] Add adbwifi_libs, TLS connection, and MDNS implementation.
  [adbd-apex] Export adbd libraries used by system_server.
  [adbwifi] Add pairing_connection library.
2020-02-21 21:07:27 +00:00
Joshua Duong
5cf7868b7e [adbwifi] Add A_STLS command.
This command will be sent by adbd to notify the client that the
connection will be over TLS.

When client connects, it will send the CNXN packet, as usual. If the
server connection has TLS enabled, it will send the A_STLS packet
(regardless of whether auth is required). At this point, the client's
only valid response is to send a A_STLS packet. Once both sides have
exchanged the A_STLS packet, both will start the TLS handshake.

If auth is required, then the client will receive a CertificateRequest
with a list of known public keys (SHA256 hash) that it can use in its
certificate. Otherwise, the list will be empty and the client can assume
that either any key will work, or none will work.

If the handshake was successful, the server will send the CNXN packet
and the usual adb protocol is resumed over TLS. If the handshake failed,
both sides will disconnect, as there's no point to retry because the
server's known keys have already been communicated.

Bug: 111434128

Test: WIP; will add to adb_test.py/adb_device.py.

Enable wireless debugging in the Settings, then 'adb connect
<ip>:<port>'. Connection should succeed if key is in keystore. Used
wireshark to check for packet encryption.

Change-Id: I3d60647491c6c6b92297e4f628707a6457fa9420
2020-02-21 21:07:13 +00:00
Joshua Duong
d85f5c0130 [adbwifi] Add adbwifi_libs, TLS connection, and MDNS implementation.
Bug: 111434128, 119493510, 119494503

Test: Enable wireless debugging in Settings UI, click "pair with pairing code"
to generate pairing code.
On client, 'adb pair <ip_address>', enter pairing code at prompt and hit
enter. Pairing should complete.
'adb logcat'.
Change-Id: I86527bd3fc52e30a8e08ec5843dc3e100abf91fa
Exempt-From-Owner-Approval: approved already
2020-02-21 21:06:40 +00:00
Joshua Duong
16d5bc6ed5 [adbd-apex] Export adbd libraries used by system_server.
Bug: b/111434128
Bug: b/149181583

Test: cat proc/`pidof system_server`/maps | grep libadb
Test: cat proc/`pidof adbd`/maps | grep libadb
Change-Id: Idd36ca31cba7e4dc2d8836d229b23665e69b42fb
Exempt-From-Owner-Approval: approved already
2020-02-21 21:06:28 +00:00
Joshua Duong
c7a1fb8fd9 [adbwifi] Add pairing_connection library.
Bug: 111434128
Bug: 119494503

Test: atest adb_pairing_connection_test
Change-Id: I54d68c65067809832266d6c3043b63222c98a9cd
Exempt-From-Owner-Approval: approved already
2020-02-21 21:06:12 +00:00
Joshua Duong
df8f1217d0 Merge "[adbwifi] Add pairing_auth library." 2020-02-21 21:04:48 +00:00
Joshua Duong
340a5e86d2 [adbwifi] Add pairing_auth library.
Bug: 111434128
Bug: 119494503

Test: atest adb_pairing_auth_test
Change-Id: Ieada7b8d9d8817292175623af55eac235b938c65
Exempt-From-Owner-Approval: approved already
2020-02-21 21:04:39 +00:00
Joshua Duong
d62c817cce Merge "adbd_auth function signature changes." 2020-02-21 21:02:33 +00:00
Joshua Duong
51378f41a1 adbd_auth function signature changes.
Bug: 111434128

Test: make
Change-Id: If801346e436dc7d7a7dfbbc296f7b2393d1e91af
Exempt-From-Owner-Approval: approved already
2020-02-21 20:12:23 +00:00
Jacob Abrams
43d246c5c2 Prevent infinite loop on zero length USB descriptors
If a USB device descriptor has zero length it is invalid and iteration
should stop otherwise the code iterating will go into an infinite loop.

Bug: 149986186
Test: attach bad USB device with invalid descriptor length 0 then attach
a good USB device and ensure it is recognized properly

Change-Id: I7571a6357bdc13af221cf8be01eba16f5bc976a3
2020-02-21 11:11:02 -08:00
Automerger Merge Worker
cfb05f56eb Merge "fs_mgr: support metadata_csum for ext4 partition" am: 04bf79dcb4
Change-Id: Id217bec57ae8f9ab36f7af0e332328ff1decec59
2020-02-21 05:41:19 +00:00
Automerger Merge Worker
0cbea75fce Merge "Initialize |sentBlocksCount|" am: b182a3582c
Change-Id: I91a105146a320c8d1f24ecf3b4e4e0af736b77fe
2020-02-21 05:41:08 +00:00
Jaegeuk Kim
04bf79dcb4 Merge "fs_mgr: support metadata_csum for ext4 partition" 2020-02-21 05:40:48 +00:00
Yurii Zubrytskyi
b182a3582c Merge "Initialize |sentBlocksCount|" 2020-02-21 05:29:45 +00:00
Automerger Merge Worker
187bf6c184 Merge "Remove ld.config.txt from adbd APEX" am: 5694a9559b
Change-Id: I92291c853973747891490ab0b9fafca4a15dd7a0
2020-02-21 04:19:35 +00:00
Kiyoung Kim
5694a9559b Merge "Remove ld.config.txt from adbd APEX" 2020-02-21 04:10:13 +00:00
Yifan Hong
738a94b798 libsnapshot: dump rollback indicator
Test: snapshotctl dump
Bug: 149956852
Change-Id: Ib0308ab75d6dce4047b46d06cece95eed23620a9
2020-02-20 18:41:10 -08:00
Automerger Merge Worker
1714e21a8f Merge "Fix the MacOS build of incremental*" am: f10099d79a
Change-Id: Ic5885f76a96d4dd258d0a93df9af1e5ba71c1847
2020-02-21 01:59:26 +00:00
Josh Gao
f10099d79a Merge "Fix the MacOS build of incremental*" 2020-02-21 01:48:52 +00:00
Steven Moreland
401d69aa94 libutils: introduce sp<T>::make
This is in preparation of doing what we did for SharedRefBase (hiding
operator new) so that clients can't accidentally construct
shared_ptr/unique_ptr or any other alternative memory management scheme
which would conflict with RefBase. You can see what ultimately happened
to SharedRefBase in frameworks/native CL
10d9ddf2e3da3ba3a425fb8396aaaec728e5fbdb.

The goal for this:
- promote use of 'sp<T>::make' over 'sp<T> .. = new T'
- make 'operator new' a private member of RefBase

Bug: 138956784
Test: libutils_test
Change-Id: I47f4d28edbf7534730c7b6fb1de748dd60f34e11
2020-02-20 17:21:27 -08:00
Yurii Zubrytskyi
12051a0937 Initialize |sentBlocksCount|
It happened to always be 0 during all tests.

Test: manual
Change-Id: I2f5089096a8ecda2ec52756199412c7d43f6903c
2020-02-20 16:03:10 -08:00
Yurii Zubrytskyi
b65950642d Fix the MacOS build of incremental*
Test: local build, no feature code changes

Change-Id: Ic0072b06f6bfd6b12f26c4056bd3192cd3fdd778
2020-02-20 15:39:36 -08:00
Tom Cherry
7205c62933 init: handle property service callbacks asynchronously
A previous change moved property_service into its own thread, since
there was otherwise a deadlock whenever a process called by init would
try to set a property.  This new thread, however, would send a message
via a blocking socket to init for each property that it received,
since init may need to take action depending on which property it is.
Unfortunately, this means that the deadlock is still possible, the
only difference is the socket's buffer must be filled before init deadlocks.

There are possible partial solutions here: the socket's buffer may be
increased or property_service may only send messages for the
properties that init will take action on, however all of these
solutions still lead to eventual deadlock.  The only complete solution
is to handle these messages asynchronously.

This change, therefore, adds the following:
1) A lock for instructing init to reboot
2) A lock for waiting on properties
3) A lock for queueing new properties
4) A lock for any actions with ServiceList or any Services, enforced
   through thread annotations, particularly since this code was not
   designed with the intention of being multi-threaded.

Bug: 146877356
Bug: 148236233
Test: boot
Test: kill hwservicemanager without deadlock
Change-Id: I84108e54217866205a48c45e8b59355012c32ea8
2020-02-20 14:58:06 -08:00
Tom Cherry
2ac86de15a logd: don't coalesce identical log messages in the security buffer
This buffer isn't human readable and the parsers aren't set up to
handle the 'chatty' message for identical log messages.  Further, it
is a low volume buffer so there's not much in terms of memory saving
if this were enabled.

Bug: 137093665
Test: security unit tests
Change-Id: I03fce518d3308a6d9240bd29e83ff3237203fe3b
2020-02-20 13:21:51 -08:00
Automerger Merge Worker
b568c330dc Merge "libsnapshot: fix stats write in Resume()" am: 20d9d6a630
Change-Id: I37c5c5eb0063d4f4c94ed321c18614b93086a2bd
2020-02-20 20:18:24 +00:00
Alessio Balsini
20d9d6a630 Merge "libsnapshot: fix stats write in Resume()" 2020-02-20 19:37:25 +00:00
Tom Cherry
a2f9136b2c Refactor libinit_test_utils to not use libinit and expose its libraries
Users of libinit_test_utils must include all libraries that it uses.
If it uses libinit, then there is a large number of libraries that
must be included.  To avoid this, make libinit_test_utils only use
init_common_sources and the small number of required libraries that go
along with those sources.  Additionally, expose these sources as a
default for users of libinit_test_utils.

Test: build
Change-Id: I224fa7e0590d073e4cd40412b5dcb6f72a64b6bf
2020-02-20 11:31:35 -08:00
Alessio Balsini
91da9dfeef libsnapshot: fix stats write in Resume()
The Resume() operation is supposed to increment the resume counter, but
the updated counter value was not written to the device.
Fix by adding the write operation and refactoring the code.

Bug: none
Test: m
Change-Id: I3fffd61cc779c59e2780900809f0ce0b84258e78
Signed-off-by: Alessio Balsini <balsini@google.com>
2020-02-20 15:05:13 +00:00
Automerger Merge Worker
93823ce9df Merge "Store reason in case of userspace-reboot watchdog reboot" am: e53f8b8f9d
Change-Id: Iff395a6e8ad4e51026ff9bbc4aa711adf37a8491
2020-02-20 11:38:47 +00:00
Automerger Merge Worker
7521152cf2 Merge "[adb] Add a version field to v4 signature format" am: aab85d3b4c
Change-Id: I2cc666e0e12e160830746ebf2031f22fe041485e
2020-02-20 11:38:38 +00:00
Nikita Ioffe
e53f8b8f9d Merge "Store reason in case of userspace-reboot watchdog reboot" 2020-02-20 11:37:32 +00:00
Yurii Zubrytskyi
aab85d3b4c Merge "[adb] Add a version field to v4 signature format" 2020-02-20 11:28:18 +00:00
Kiyoung Kim
f611e41e14 Remove ld.config.txt from adbd APEX
Dynamic linker will use generated linker configuration in general. As
ld.config.txt file in the APEX module will not be used, we can remove
this to avoid confusion.

Bug: 149887007
Test: m -j passed
Test: Boot succeeded from cuttlefish and walleye
Change-Id: Ic98aca819b5a4d0e0af4fe0ea25145a483aa7d53
2020-02-20 16:06:53 +09:00