Commit Graph

2554 Commits

Author SHA1 Message Date
George Burgess IV a712e2164a Merge "Add a NOLINT for the memory leak we added" am: 10f62351eb am: 4e3ae2cbfa
am: ad4025b35b

Change-Id: I1d4831bc70b8874e66583f4a130b3a711c24b019
2018-03-01 22:19:41 +00:00
George Burgess IV 657db00e3d Add a NOLINT for the memory leak we added
Added by I7255d45335fa009dc9e5de99dff67af52bd70e06

Bug: None
Test: Ran the analyzer. Complaint is gone.
Change-Id: Id9b8debd8b9690210f5a8e19154ee3a5095b8fbd
2018-03-01 18:59:50 +00:00
Josh Gao 0e459e1d47 Merge "adb: add a way to make the server intentionally leak." am: 1ac7150590 am: 9ba182e3bb
am: 399c3591f2

Change-Id: Ifa340ad4f3ce53786391722a7d4f8b97816dfd20
2018-02-28 23:16:34 +00:00
Josh Gao e2176118f4 adb: add a way to make the server intentionally leak.
Add a way to test LeakSanitizer with the server by adding an
environment variable that intentionally leaks.

Test: ASAN_OPTIONS=detect_leaks=1:leak_check_at_exit=1 ADB_LEAK=1 adb server nodaemon
Change-Id: I7255d45335fa009dc9e5de99dff67af52bd70e06
2018-02-28 14:16:14 -08:00
Luis Hector Chavez b14ce54176 Merge "Change the remount command to be more container-friendly" am: d24c8484c8 am: 677288c80a
am: d12cf88945

Change-Id: Ie9986fe8723ed34ecc787deb72bd75c89f1e8554
2018-02-28 17:12:31 +00:00
Treehugger Robot d24c8484c8 Merge "Change the remount command to be more container-friendly" 2018-02-28 16:48:37 +00:00
Josh Gao a085c9f826 Merge changes I0783be05,Id8178913 am: 09d5e258ef am: 2c1b3e9761
am: d8b711e16b

Change-Id: Ifa679ee1857fddf693f9e9b994bb4d9dff3f6c8a
2018-02-28 02:07:21 +00:00
Josh Gao e39ccd3cbd adb: allow reentrant calls to fdevent_run_on_main_thread.
Previously, reentrant calls to fdevent_run_on_main_thread would
deadlock.

Test: adb_test on host
Change-Id: I0783be0558dcaf61ddbe76d13ac6917fc2de0be0
2018-02-27 14:50:07 -08:00
Josh Gao d51c6df1ef adb: stop using quick_exit.
We don't actually need to use quick_exit to avoid calling static
destructors, since we have -Wexit-time-destructors to guarantee we
don't actually have any, and this precludes the use of asan's exit time
leak checking, so switch back to atexit/exit.

Test: ASAN_OPTIONS=detect_leaks=1:leak_check_at_exit=1 adb server nodaemon with a manually inserted leak
Change-Id: Id8178913f64cb02c820c5073351369a9e4d8c74d
2018-02-27 14:50:07 -08:00
Luis Hector Chavez 0db4b7a95b Change the remount command to be more container-friendly
Passing in MS_REMOUNT | MS_BIND tells the kernel to only remove the
MS_RDONLY flag and keep all the other flags the same. This is also the
only kind of remount that is allowed in Linux containers (to be more
precise, within user namespaces).

This change also attempts to always run the remount command when dealing
with /, since containers will almost always run a loop device, and since
the number of the device changes, it is not convenient to put it in the
fstab. Plus, the container won't have permission to modify it, but might
be able to perform the remount.

Bug: 72178046
Test: `adb remount` works in both sailfish and Chrome OS
Change-Id: I9e8ec8afcd57f67875a312824667768b3aa89faa
2018-02-27 14:37:26 -08:00
Josh Gao 0a3726a113 Merge "adb: switch apacket over to a std::string payload." am: 581a4ceb00 am: 4d74066425
am: ea9359a957

Change-Id: Ib9b1f7c9c3e59e3cfd3ea492360703d2b7a68119
2018-02-24 01:10:36 +00:00
Josh Gao f571fcbe87 adb: switch apacket over to a std::string payload.
Test: python test_device.py with walleye/x86_64 emulator
Change-Id: I0a18941af1cb2279e5019a24ace25741def1202f
2018-02-21 14:30:17 -08:00
Elliott Hughes 4c33b88c4b Merge "bpfmt." am: 0609e8d231 am: b57755c429
am: a91867a788

Change-Id: Ieb0985434e2464e47b3adb93fb27fe5042e91657
2018-02-20 02:24:45 +00:00
Treehugger Robot 0609e8d231 Merge "bpfmt." 2018-02-20 02:02:59 +00:00
George Burgess IV 54abd1d82f Merge "Fix a memory leak" am: cb1b68f9b3 am: 894337ee0b
am: 2a7d34014a

Change-Id: I2b763775555659f77e969f1d4d5bc73363afc53b
2018-02-19 11:02:02 +00:00
George Burgess IV cb2449f851 Fix a memory leak
If create_service_thread fails, we'll leak `arg`.

This fixes a static analyzer complaint:
system/core/adb/services.cpp:298:13: warning: Potential leak of memory
pointed to by 'arg'

Bug: None
Test: Reran the static analyzer. No more complaints about this leak.
Change-Id: I5aec7fd78f2cc775b650501b02bdf0039d1647ca
2018-02-19 01:05:56 -08:00
Elliott Hughes dc699a269f bpfmt.
Bug: N/A
Test: builds
Change-Id: I89ad00e1c4c7e0767bc80a7ac7935a4d55e090ac
2018-02-16 17:58:14 -08:00
Josh Gao d8e298a3ac Merge "adbd: receive jdwp pids from art as raw integers." am: d31df3a1be am: f6a2296aff
am: 33bedcde5b

Change-Id: I8317d035fe4d65e06bcd849b64654419c051c021
2018-02-14 00:06:17 +00:00
Treehugger Robot d31df3a1be Merge "adbd: receive jdwp pids from art as raw integers." 2018-02-13 23:34:49 +00:00
Josh Gao 483046d952 Merge "adb: fix build breakage." am: 14d7cdce51 am: a4c4ef463b
am: 07de47eeb3

Change-Id: I935612655924b3263883e0f4bfdba2bdbd9d5386
2018-02-13 08:50:37 +00:00
Josh Gao 69b86a24a4 Merge "adb: use delete on objects with destructors." am: e504360f3d am: 854879ecdc
am: 84cd5de121

Change-Id: I33b77e3daef7e7778cce6b05a36b9710f6209af5
2018-02-13 08:44:58 +00:00
Josh Gao 1b58bbf2ef adb: fix build breakage.
Test: mma
Change-Id: Id8e7ffd2212449bbac5b64b50e7b3aef7e97d649
2018-02-12 18:03:49 -08:00
Josh Gao e0361d1e90 adb: use delete on objects with destructors.
asocket has a destructor now, so we have to delete it, or leak the
data pointed to by its std::string.

Bug: http://b/73257049
Test: manual testing with asan
Change-Id: Ia88199292cc74e10032a9a16226d3afc61c3e0be
2018-02-12 17:31:39 -08:00
Josh Gao 86f39b4078 adbd: receive jdwp pids from art as raw integers.
Don't go through a pointless conversion to hex that reduces our maximum
pid to 64k.

Bug: http://b/17661822
Test: `adb jdwp`
Change-Id: Idd572eac827f3ed3825ac2cf55fc4db109e70854
2018-02-12 15:07:28 -08:00
Josh Gao 8d220bb0cd Merge "adb: switch asocket::enqueue to std::string." am: 9bf624cd3a am: e523a6c94f
am: 16bbf3b4cd

Change-Id: Ie46218fe0fff30999f1ca40c509bb7e27fe2cb42
2018-02-08 05:37:19 +00:00
Josh Gao e75f43461d Merge changes I86bcfaaa,I24d7f5d0 am: f99711fe87 am: 157c2fa504
am: d3f70d4a83

Change-Id: Iafc3ec17d90251d1f120c34f27f5c17041f6f882
2018-02-08 05:10:22 +00:00
Josh Gao 9bf624cd3a Merge "adb: switch asocket::enqueue to std::string." 2018-02-08 01:06:22 +00:00
Josh Gao f99711fe87 Merge changes I86bcfaaa,I24d7f5d0
* changes:
  adb: restore packet data length checks.
  adb: switch asocket's intrusive linked list to vectors.
2018-02-08 00:34:40 +00:00
Josh Gao 465c5849d7 Merge "adb: don't spew to logcat when tracing is enabled." am: 28c44863f6 am: b652ac4bd8
am: b4affd20b7

Change-Id: I9711ce90493b7b311ae04fe5c4b25739cb57dbc2
2018-02-07 08:57:59 +00:00
Josh Gao 95c4497bd4 adb: don't spew to logcat when tracing is enabled.
When persist.adb.trace_mask is used to enable verbose logging, avoid
exponential logging when a user runs `adb logcat`. As a side-effect,
set the minimum logging level to include everything when ADB_TRACE is
used on the client (which is something we want anyway).

Bug: http://b/72971016
Test: `adb shell 'setprop persist.adb.trace_mask; killall adbd'; adb logcat`
Change-Id: Id4bca1f3933a920345499dbeaeb103c8a2e220cd
2018-02-06 15:55:06 -08:00
Josh Gao 27cb7dca77 adb: switch asocket::enqueue to std::string.
Switch asocket over to taking a std::string instead of apacket* for
data. This allows us to remove asocket specific fields from apacket*.

Test: python test_device.py with x86_64 emulator, walleye
Test: adb_test on host
Change-Id: I9d157ff331a75ba49a54fdd4194e3f6cdff722f4
2018-02-06 12:59:06 -08:00
Josh Gao 5caaebdc3d adb: restore packet data length checks.
These checks were moved to after the read of the payload, which is too
late. Add a check before each read to avoid a heap buffer overflow.

Test: python test_device.py with x86_64 emulator, walleye
Change-Id: I86bcfaaa9004951cc52ad89af74680cf748e717d
2018-02-06 12:59:06 -08:00
Josh Gao 5e5076404a adb: switch asocket's intrusive linked list to vectors.
Test: python test_device.py
Change-Id: I24d7f5d0401de77d80c7a2dd5a7dcb551943342d
2018-02-06 12:59:06 -08:00
Josh Gao 2309f0fd40 Merge changes I877b8027,I469bd931 am: 8848052c9f am: 99500f1e3b
am: b685db4bf2

Change-Id: I249ca7c34ac6262140e70244bfec877f6fa6fe9d
2018-01-31 21:52:21 +00:00
Josh Gao b800d88b34 adb: extract atransport's connection interface.
As step one of refactoring atransport to separate out protocol handling
from its underlying connection, extract atransport's existing
hand-rolled connection vtable out to its own abstract interface.

This should not change behavior except in one case: emulators are
now treated as TCP devices for the purposes of `adb disconnect`.

Test: python test_device.py, with walleye over USB + TCP
Test: manually connecting and disconnecting devices/emulators
Change-Id: I877b8027e567cc6a7461749432b49f6cb2c2f0d7
2018-01-30 15:22:41 -08:00
Josh Gao fb413a2304 adb: fix a leak.
Test: none
Change-Id: I469bd93180cd2a8b6408f73e8c8f164f72b3345c
2018-01-30 13:32:38 -08:00
Calin Juravle aa7753871e Accept DexMetadata files (.dm) for install-multiple
Allow .dm files (DexMetadata) to be passed to adb install-multiple.

Do not rename the input files based on their indices as the naming matters
for associating an .dm file to an .apk file.

Test: adb install-multiple -p com.android.cts.classloadersplitapp base.apk
     split.apk split.dm

Bug: 30934496
Change-Id: I2ac39e00d64eae938124250033f79e02f3c3f9c0
2018-01-17 19:06:28 -08:00
Treehugger Robot ef213b6d5b Merge "adb/fastboot: switch over to shared AdbWinApi." 2018-01-09 19:49:23 +00:00
Josh Gao b0449da977 adb/fastboot: switch over to shared AdbWinApi.
Bug: http://b/71721338
Test: manually ran adb/fastboot on windows
Change-Id: I9fee6ea4c0e07cbeb69a48e456161832a5994e7b
2018-01-08 16:45:30 -08:00
Elliott Hughes 18cdd3502a Merge "Sort devices list before output." 2018-01-08 22:11:23 +00:00
Mike Frysinger 50ecaca744 adb: add missing condition_variable include
Test: build still works
Change-Id: I0e77336bab2a4a54cb2e77143162627d47aac0b1
2018-01-02 02:25:02 -05:00
Elliott Hughes 579e682628 Add std::string StartsWith*/EndsWith* overloads.
We should have done this from the beginning. Thanks to Windows, we're not
going to be able to switch libbase over to std::string_view any time soon.

Bug: N/A
Test: ran tests
Change-Id: Iff2f56986e39de53f3ac484415378af17dacf26b
2017-12-20 09:42:22 -08:00
Artem Iglikov 04398a9b23 Sort devices list before output.
Makes copy of the transport list and sorts it by type and serial before
printing.

Bug: 70748433
Test: adb devices displays all connected devices
Change-Id: I917728a102972f2f38f2e370a0c6011c1eb883c7
2017-12-19 09:22:53 +00:00
Tim Murray de47194940 adb: disable checksum on new versions
The checksum is unnecessary. Improves adb performance by 40% on USB2.

Test: new adb works with new + old adbd, old adb works with new adbd
bug 67327728

Change-Id: I761d8a5a62deaea9bbb092ea9926b2d6d312f00d
2017-12-14 14:18:26 -08:00
Elliott Hughes bf2062f800 Merge "Set $TMPDIR for `adb shell`." 2017-12-12 00:29:50 +00:00
Treehugger Robot 6f29887c71 Merge "adb: get libusb compiling on Windows." 2017-12-11 19:24:41 +00:00
Elliott Hughes d42df42f30 Set $TMPDIR for `adb shell`.
Bug: http://b/19635681
Test: printenv
Change-Id: I21e89b9d7cccad23f32a3062a9e04e59b8278104
2017-12-11 10:40:57 -08:00
Josh Gao 9425996b45 adb: get libusb compiling on Windows.
This still doesn't work yet because libusb doesn't support hotplug on
Windows yet, but it's in the milestones for the next libusb release,
and this is enough to start poking around with the WinUSB device-side
stuff, so leave it broken for now.

Bug: http://b/68993980
Test: set ADB_LIBUSB=1; adb.exe server nodaemon aborts in the expected place
Change-Id: Icef7d46e31c847d6a8e724c6f58ae5db43673c16
2017-12-08 13:11:15 -08:00
Treehugger Robot a4a9a81d38 Merge "adb: disable USB packet overflow checking on OS X." 2017-12-08 20:31:51 +00:00
Elliott Hughes 3289b9c928 Merge "Add OWNERS." 2017-12-07 23:21:26 +00:00