Commit Graph

35705 Commits

Author SHA1 Message Date
Josh Gao 85366c15d4 adb: remove SendConnectOnHost.
This logic appears to be racy, and it shouldn't actually be needed, if
our devices follow the USB spec. Use libusb_set_interface_alt_setting
on device initialization as well, to add one more thing that should
reset the data toggles.

Bug: 67320882
Bug: http://b/32952319
Test: python test_device.py
Change-Id: I392198af3d72c524b893e5056afa2b4617cea49c
(cherry picked from commit 4b5d4da6f6)
2017-10-02 16:14:30 -07:00
Josh Gao 59dc0ecaaa adb: partially revert b5e11415.
Revert the write_msg_lock part of commit b5e11415. A write which hangs
will hold onto the mutex, preventing the device kick from ever
happening, which also causes lots of other stuff to hang, due to Kick
being called with the transport lock taken.

Bug: 67320882
Test: python test_devices.py
Change-Id: Ie7c958799c93cad287c32d6bbef30c07f40c2d51
(cherry picked from commit 33d14b8748)
2017-10-02 16:14:28 -07:00
Josh Gao e3585684d9 adb: reformat comments.
Bug: 67320882
Test: none
Change-Id: Ib484f701f66cdb57f303dbd6d5eb2e5a15abdc0e
(cherry picked from commit 55c8b34f14)
2017-10-02 16:14:25 -07:00
Huihong Luo f0a4fb6ea5 Fix bug #37284906, adb shell crashes on windows with invalid options.
For example, "adb.exe shell -list" crashes without this fix.
Test: adb.exe shell -list-packages

Bug: 67320882
Change-Id: I96be44128ff3ecab7804b70074cbde630b3fc3d1
(cherry picked from commit af39885c9f)
2017-10-02 16:14:23 -07:00
Felipe Leme ec92e5f194 Don't preserve file attributes when pulling bugreport file...
...otherwise it could have weird dates when the device clock is wrong.

Bug: 67320882
Test: m -j32 adb && ./out/host/linux-x86/bin/adb bugreport test.zip && ls -l test.zip
Test: m -j32 adb_test && ./out/host/linux-x86/nativetest64/adb_test/adb_test

Fixes: 63927360

Change-Id: I3f87277f1acb97212a87b89639e42b6d7d300faa
(cherry picked from commit 4bfddbd20e)
2017-10-02 16:14:20 -07:00
Elliott Hughes 0617eb7d83 Fix reference to out of scope local in adb_thread_setname.
Bug: 67320882
Bug: https://android-review.googlesource.com/#/c/168725/5/adb/sysdeps.h@639
Test: boots, adbd thread names look sane
Signed-off-by: Ivan Maidanski <i.maidanski@samsung.com>
Change-Id: Ib3bdf53658f3903de8f0a5688f7d77745e677c77
(cherry picked from commit 7462f1858c)
2017-10-02 16:14:10 -07:00
Elliott Hughes 93764d3c07 Merge "run-as: Keep supplementary groups." into oc-mr1-dev 2017-09-30 14:26:04 +00:00
TreeHugger Robot feb2833644 Merge changes I644e25fc,I934509c7 into oc-mr1-dev
* changes:
  adbd: improve thread names.
  Fix a potential memory leak
2017-09-30 00:12:42 +00:00
Keun Soo Yim aedc1c9ab0 Merge "Tests are run with proper namespace configs by their locations" into oc-mr1-dev 2017-09-29 22:59:28 +00:00
Jorge Lucangeli Obes bc76f0ea2f run-as: Keep supplementary groups.
This broke TCP debugging because processes don't inherit the AID_INET
group.

Bug: 67058466
Test: adb shell run-as com.example.native_activity groups prints "inet".

(cherry picked from commit 8c27e19c1c)

Change-Id: I30bc3152267a2b3ee099bc9f604c017ef33dd685
2017-09-29 15:49:20 -07:00
TreeHugger Robot 2f00c80c2b Merge "Fix: make vndk namespace visible for 2016 Pixes" into oc-mr1-dev 2017-09-29 20:41:42 +00:00
Josh Gao 3f526fe1e3 adbd: improve thread names.
Name each service thread specifically to improve debuggability.

Bug: http://b/65648324
Bug: 64709603 (presubmit balking at the line above)
Test: adb shell debuggerd -b `adb shell pidof adbd` during a sync
Change-Id: I644e25fc2f14a26eafd19f596e4e8f3c2bb79967
(cherry picked from commit bcadc77550)
2017-09-29 12:43:07 -07:00
Ting-Yuan Huang c4c0a7136b Fix a potential memory leak
Bug: 65648324
Test: Built without seeing the warnings
Change-Id: I934509c78482af9ef7dc447c807f6450484b4b38
(cherry picked from commit f26cf6d520)
2017-09-29 12:43:01 -07:00
TreeHugger Robot 152687b26e Merge "Remove workaround for VNDK violations" into oc-mr1-dev 2017-09-29 18:24:45 +00:00
Jiyong Park 326b783ad9 Tests are run with proper namespace configs by their locations
Tests in /data/[nativetest|benchmarktest] run with namespace config for
system and tests in /data/[nativetest|benchmarktest]/vendor run with
namespace config for vendor.

They no longer run in the 'test' namespace config which didn't impose
any restriction for libraries.

Bug: 67028906
Test: sailfish/marlin builds and boots
Test: no VTS regression on system.img from GSI + vendor.img from
marlin/sailfish
Test: VtsKernelLibcutilsTest successful in above config

Change-Id: I28cdef960d087565c8a22dca0e9a154fb1c3bb94
2017-09-29 05:04:27 +09:00
Josh Gao c03127ef5c Merge changes I12d46493,I0ed00441,I55e5dc5a,If61296ff into oc-mr1-dev
* changes:
  adb: add lock to remove_socket.
  Revert "adb: fix deadlock between transport_unref and usb_close."
  adb: allow selection of a specific transport.
  adb: fix deadlock in kick_all_transports.
2017-09-28 17:51:44 +00:00
Josh Gao 2b933918fc adb: add lock to remove_socket.
The comment that was previously here says that local_socket_list_lock
must be taken, but this function is exposed to external callers that
can't possibly take the lock.

Bug: http://b/65419665
Bug: 64709603 (presubmit balking at the line above)
Test: python test_device.py
Change-Id: I12d464933936b2a210a827ccf19ea201020d8d78
(cherry picked from commit 62c92f0c05)
2017-09-27 14:36:12 -07:00
Josh Gao c78ecca70b Revert "adb: fix deadlock between transport_unref and usb_close."
This reverts commit 7e197ef833.

The mutex lock in transport_unref hides a race that seems otherwise
hard to fix. Specifically, there's no synchronization between acquiring
a transport and attaching it to an asocket*, leading to badness if the
transport is closed in between the two operations.

Fix the original problem the reverted patch addressed by manually
unlocking before calling unregister_usb_transport.

Bug: http://b/65419665
Bug: 64709603 (presubmit balking at the line above)
Test: python test_device.py
Change-Id: I0ed0044129b1671b2c5dd1b9fa2e70a9b4475dc5
(cherry picked from commit e48ecce671)
2017-09-27 14:36:08 -07:00
Josh Gao 1bd8498fc8 adb: allow selection of a specific transport.
Extend device selection to allow selecting a specific transport via
monotonically increasing identifier (visible in devices -l).

This is useful when using multiple devices (like hikey960...) that
have identical bogus serial numbers like 0123456789ABCDEF.

Bug: http://b/37043226
Bug: 65419665
Test: adb -t {1, 2, 9999999} {get-serialno, shell, features}
Change-Id: I55e5dc5a406a4eeee0012e39b52e8cd232e608a6
(cherry picked from commit b122b17555)
2017-09-27 14:36:02 -07:00
Josh Gao 39103b95c8 adb: fix deadlock in kick_all_transports.
Previously, kick_all_transports would deadlock if there were any
inaccessible transports, because the transport kick function would call
unregister_usb_transport, which attempts to take the already-held
transport lock.

Fix this by switching the transport lock over to a recursive mutex.

Bug: 65419665
Test: manual
Change-Id: If61296ff4745e1699f3e216811c1383582627604
(cherry picked from commit 1db71afe97)
2017-09-27 14:35:52 -07:00
Mark Salyzyn 27e56723de Merge changes I6620c996,I094c2cb0 into oc-mr1-dev
* changes:
  bootstat: bootloader stat files misspelled
  bootstat: switch from root.root to system.log
2017-09-27 14:53:53 +00:00
Elliott Hughes bab3354ede Show the number of VMAs in the tombstone.
Tombstones (especially ones with lots of VMAs) are regularly truncated.
We can at least show the number of VMAs, though, for anyone interested
in knowing whether they got close to the default 64Ki limit.

Bug: http://b/66911122
Bug: 64709603 (presubmit balking at the line above)
Test: ran crasher, examined tombstone

(cherry picked from commit 868d39a82f)

Change-Id: I286db66f28f132307d573dbe5164efc969dc6ddc
2017-09-26 17:24:39 -07:00
Mark Salyzyn 594ce46f64 bootstat: bootloader stat files misspelled
(cherry picked form commit 25246ddfe6)

Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Bug: 65843095
Change-Id: I6620c9965f4af8b6a3829f1f4cdcc9b691471a71
2017-09-26 11:27:52 -07:00
Mark Salyzyn c4a524b1d7 bootstat: switch from root.root to system.log
(cherry picked from commit c3ad75be84)

bootstat does not need root uid and root gid permissions to perform
its tasks.  It appears that system uid and log gid are adequate and
appropriate.

Test: manual
Bug: 63736262
Bug: 65843095
Change-Id: I094c2cb054e441562fa8717a4d3dc0086fb70a7a
2017-09-26 11:27:02 -07:00
Jiyong Park f8025aae82 Remove workaround for VNDK violations
lib-dplmedia.so and qseeproxydaemon no longer depend on non-VNDK
libraries. Remove the workaround.

Bug: 64427765
Bug: 64820887
Test: 2017 pixel devices boots
Change-Id: Ib8bcbbb16169dc5c997d6c0dad061c66dcd0ccfe
2017-09-26 01:54:57 +09:00
Jiyong Park 1cc09e749f Fix: make vndk namespace visible for 2016 Pixes
The nativeloader tries to find the 'vndk' namespace when there is a
vendor apk in the classloader paths. This can happen even for a
downloaded app if the app is using a vendor apk via <uses-library> tag.

In order to prevent the nativeloader from failing to find the vndk
namespace, the namespace is marked as visible.

Bug: 66482442
Test: download the app mentioned in the bug, it does not crash.
Change-Id: I82e2394eb6eedcb8645e1a5b3735bbfe2735b312
2017-09-26 01:38:22 +09:00
Yoshitaka Seto 5dec8e22c3 Remove pstore related unit tests from CTS
Pstore test cases should not belong to CTS.
The test cases should be a part of GTS if really required.

Test: manual
Bug: 66431569
Bug: 63969981
Bug: 63913130
Signed-off-by: Srinavasa Nagaraju <Srinavasa.Nagaraju@sony.com>
Signed-off-by: Yoshitaka Seto <yoshitaka.seto@sony.com>
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Tested-by: Srinavasa Nagaraju <Srinavasa.Nagaraju@sony.com>
Change-Id: Icd326403711ad268ce28a3863045fc9b2f211461
2017-09-21 13:37:50 -07:00
James Hawkins 5cf1f6a8c8 libmetricslogger: Fix one incorrect (deprecated) logtag and one
duplicate logtag.

Bug: 65841976
Bug: 65961260
Test: none
Change-Id: I6491c3c05e3a56b45d4a77cfa83f8e14eb226e64
(cherry picked from commit 2dcca295a6)
2017-09-20 08:18:05 -07:00
Robert Benea 19e26708c2 Simplify lmkd functionality
Get min adj score when needed, instead to propagate from caller funct.

Bug:65642829
Test: tested on gobo_512
Change-Id: I87f15c5c6206d471002828a24d0462b0abb0d196
2017-09-17 18:31:35 -07:00
Tom Cherry cbd66d3c8a init: fix crash when reboot is triggered by a builtin
Builtin commands may set the sys.powerctl property, which causes
reboot to be immediately processed.  Unfortunately, part of the reboot
processing involves clearing the action queue, so when this scenario
happens, ActionManager::ExecuteOneCommand() can abort due to its state
being unexpectedly changed.

Longer term, the real fix here is to split init and property service.
In this case, the property sets will be sent to property service and
the reboot will only be processed once property service responds back
to init that the property has been set.  Since that will not happen
within the action queue, there will be no risk of failure.

Short term, this change sets a flag in init to shutdown the device
before the next action is run, which defers the shutdown enough to fix
the crash, but continues to prevent any further commands from running.

Bug: 65374456
Test: force bullhead into the repro case and observe that it no longer
      repros

Merged-In: I89c73dad8d7912a845d694b095cab061b8dcc05e
Change-Id: I89c73dad8d7912a845d694b095cab061b8dcc05e
(cherry picked from commit 3633a4014a)
2017-09-16 00:33:13 +00:00
TreeHugger Robot df77f328e7 Merge "Revert "Revert "Add derive_gid flag for mounting sdcardfs""" into oc-mr1-dev 2017-09-15 21:59:31 +00:00
Rom Lemarchand ac8dc7e76f Revert "Revert "Add derive_gid flag for mounting sdcardfs""
This reverts commit 28dbcaa23b.

Reason for revert: All kernel prebuilts merged

Bug: 65600849
Bug: 65573871
Change-Id: Ib3cae2908c9e8f2b69d8effe618a6f1ac94f44e2
2017-09-15 20:36:26 +00:00
TreeHugger Robot 767eb64f36 Merge "Downgrade memory pressure events" into oc-mr1-dev 2017-09-15 01:42:33 +00:00
Robert Benea 6e8e710675 Downgrade memory pressure events
If the system has enough memory the pressure events are ignored or
downgraded from critical to medium.

Bug: 65642829
Test: tested on gobo
Change-Id: I44e66d2e35508aceee5c1719313db217b80d582e
2017-09-14 13:47:40 -07:00
Richard Uhler c397915d72 Merge "Revert "Add derive_gid flag for mounting sdcardfs"" into oc-mr1-dev 2017-09-14 14:55:32 +00:00
Richard Uhler 28dbcaa23b Revert "Add derive_gid flag for mounting sdcardfs"
This reverts commit 8ca02bbeb5.

Causes boot loop on bullhead.
Bug: 63245673
Bug: 65660058

Change-Id: Ife5f83ebf56fb956e5015d2797b5b47a515ec171
2017-09-14 14:51:36 +00:00
Josh Gao 4fda598b08 Merge "debuggerd_fallback: print maps." into oc-mr1-dev 2017-09-14 06:02:48 +00:00
TreeHugger Robot 47c5929bb5 Merge "Add derive_gid flag for mounting sdcardfs" into oc-mr1-dev 2017-09-14 01:37:01 +00:00
TreeHugger Robot 6f7d928940 Merge changes from topic "vndk_jni" into oc-mr1-dev
* changes:
  vendor apk is unbundled
  add llndk|vndksp.libraries.txt to vndk_package
2017-09-14 01:35:43 +00:00
Josh Gao 0aeeda0024 debuggerd_fallback: print maps.
Bug: http://b/63400743
Bug: http://b/65590288
Bug: 64709603 (presubmit balking at the line above)
Test: killall -ABRT media.codec
Change-Id: I58e47dcd8e99ad7a5945604c27876dd01259e501
Merged-In: I58e47dcd8e99ad7a5945604c27876dd01259e501
(cherry picked from commit fdc95c9670)
2017-09-13 18:33:34 -07:00
Tom Cherry ece234f9ac Merge "init: fix variable scope issue with ExpandArgs()" into oc-mr1-dev 2017-09-13 22:40:44 +00:00
Tom Cherry 48db85c19f init: fix variable scope issue with ExpandArgs()
ExpandArgs() was factored out of Service::Start() to clean up init,
however this introduced a bug: the scope of expanded_args ends when
ExpandArgs() returns, yet pointers to the c strings contained within
those std::strings are returned from the function.  These pointers are
invalid and have been seen to cause failures on real devices.

This change moves the execv() into ExpandArgs() and renames it
ExpandArgsAndExecv() to keep the clean separation of Service::Start()
but fix the variable scope issue.

Bug: 65303004
Test: boot fugu
Change-Id: I612128631f5b58d040bffcbc2220593ad16cd450
(cherry picked from commit 5e405cacb1)
2017-09-13 13:11:48 -07:00
Tom Cherry 43a7da2c40 init: fix signal handling and LOG(FATAL) in child processes
Child processes inherit the signal handlers from their parent process.
In the case of init, fork()'ed processes, will attempt to reboot the
system if they receive a fatal signal).  This is not the correct behavior;
these processes should terminate due to the provided signal like other
processes on the system.

This is particularly important as there are multiple LOG(FATAL) calls
in service.cpp for failures after fork() but before execv() when a
service is started.

Note, that pthread_atfork() is not a viable solution since clone() is
used in some cases instead of fork() and atfork handlers are not
called with clone().

Bug: 65637054
Test: LOG(FATAL) from a child process of init and see that it
      terminates due to a signal correctly
Test: LOG(FATAL) from init proper and see that it reboots to the
      bootloader

Change-Id: I875ebd7a5f6b3f5e3e2c028af3306917c4409db3
2017-09-13 12:56:56 -07:00
James Hawkins ea2e67526d bootstat: Log the ro.boot.bootreason property through the new
platform_reason Tron field.

Bug: 63584589
Test: none
Change-Id: I369e6977c77619513eb7ce7637c1e3112e5a4b13
(cherry picked from commit 51e91f5e0b)
2017-09-13 08:38:38 -07:00
Robert Benea 164baebc01 Allow ANDROID_LOW_MEMORY_KILLER to coexist with lmkd
For Go devices fallback to memcg/memory pressure events for LMK.
Go devices will use memcg pressure events while inkernel module
is disabled.

Bug: 64852905
Test: tested on gobo
Change-Id: I267ab00be85e324331f6c91551ba013184de817e
2017-09-11 16:57:26 -07:00
Adam Vartanian f6397586ab Fix integer overflow in utf{16,32}_to_utf8_length am: f0a43dede9 am: 33abf90994 am: 789673b15c am: 1436927851 am: d70e582d67 am: 62d5a78df3 am: 5b37a8ce87 am: 16e2001f0b am: e2b5839d4c -s ours am: 84bdda1e6e -s ours
am: 94222586dc  -s ours

Change-Id: Ie89864f45955e2853d64b35b632fdb1aad37af13
2017-09-11 11:27:25 +00:00
Adam Vartanian 94222586dc Fix integer overflow in utf{16,32}_to_utf8_length am: f0a43dede9 am: 33abf90994 am: 789673b15c am: 1436927851 am: d70e582d67 am: 62d5a78df3 am: 5b37a8ce87 am: 16e2001f0b am: e2b5839d4c -s ours
am: 84bdda1e6e  -s ours

Change-Id: I89c0f62474f46aeedb3635ad92454c979335c829
2017-09-11 11:23:24 +00:00
Adam Vartanian 84bdda1e6e Fix integer overflow in utf{16,32}_to_utf8_length am: f0a43dede9 am: 33abf90994 am: 789673b15c am: 1436927851 am: d70e582d67 am: 62d5a78df3 am: 5b37a8ce87 am: 16e2001f0b
am: e2b5839d4c  -s ours

Change-Id: I2b8d19a8582f8de19332705fc4dcdc3a23fa8da2
2017-09-11 11:18:54 +00:00
Adam Vartanian e2b5839d4c Fix integer overflow in utf{16,32}_to_utf8_length am: f0a43dede9 am: 33abf90994 am: 789673b15c am: 1436927851 am: d70e582d67 am: 62d5a78df3 am: 5b37a8ce87
am: 16e2001f0b

Change-Id: I217092b993f50a6380cf76049ebb94a99505b4a0
2017-09-11 11:14:55 +00:00
Adam Vartanian 16e2001f0b Fix integer overflow in utf{16,32}_to_utf8_length am: f0a43dede9 am: 33abf90994 am: 789673b15c am: 1436927851 am: d70e582d67 am: 62d5a78df3
am: 5b37a8ce87

Change-Id: I9957d042e4b309f8071fe08c03177401051ec926
2017-09-11 11:10:53 +00:00