Commit Graph

35689 Commits

Author SHA1 Message Date
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
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
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
Adam Vartanian 5b37a8ce87 Fix integer overflow in utf{16,32}_to_utf8_length am: f0a43dede9 am: 33abf90994 am: 789673b15c am: 1436927851 am: d70e582d67
am: 62d5a78df3

Change-Id: If605b2b03790475250c3a5c9627b9f6177c01226
2017-09-11 11:06:21 +00:00
Adam Vartanian 62d5a78df3 Fix integer overflow in utf{16,32}_to_utf8_length am: f0a43dede9 am: 33abf90994 am: 789673b15c am: 1436927851
am: d70e582d67

Change-Id: Ia12301ba4850284d81de3a4ed2fe3f519a6859fc
2017-09-11 11:02:51 +00:00
Adam Vartanian d70e582d67 Fix integer overflow in utf{16,32}_to_utf8_length am: f0a43dede9 am: 33abf90994 am: 789673b15c
am: 1436927851

Change-Id: Ia81a894419957960682a221159449f3e92d06b03
2017-09-11 10:58:21 +00:00
Adam Vartanian 1436927851 Fix integer overflow in utf{16,32}_to_utf8_length am: f0a43dede9 am: 33abf90994
am: 789673b15c

Change-Id: I352f33cf5a9a402a17f7a0f2c8739b54256392c2
2017-09-11 10:54:22 +00:00
Adam Vartanian 789673b15c Fix integer overflow in utf{16,32}_to_utf8_length am: f0a43dede9
am: 33abf90994

Change-Id: I5509908232bd838a229c1c2f3a35e0960a741288
2017-09-11 10:50:21 +00:00
Adam Vartanian 33abf90994 Fix integer overflow in utf{16,32}_to_utf8_length
am: f0a43dede9

Change-Id: Ie8e67d97272102eee952c21d82cf06c6a50f1ea9
2017-09-11 10:46:20 +00:00
Adam Vartanian f0a43dede9 Fix integer overflow in utf{16,32}_to_utf8_length
Without an explicit check, the return value can wrap around and return
a value that is far too small to hold the data from the resulting
conversion.

No CTS test is provided because it would need to allocate at least
SSIZE_MAX / 2 bytes of UTF-16 data, which is unreasonable on 64-bit
devices.

Bug: 37723026
Test: run cts -p android.security
Change-Id: Ie2606b92b9eab1acfe8ce4663b43b81156a4cad7
Merged-In: I56ba5e31657633b7f33685dd8839d4b3b998e586
2017-09-11 10:46:06 +01:00
Adam Vartanian 1ba748810e Fix integer overflow in utf{16,32}_to_utf8_length am: 47efc676c8
am: 6e2bf89dc7

Change-Id: I6b5786e20b0df1729453d21e05dbd926aabbf56d
2017-09-11 09:30:42 +00:00
Adam Vartanian 6e2bf89dc7 Fix integer overflow in utf{16,32}_to_utf8_length
am: 47efc676c8

Change-Id: Id54a1e644fc02a2923c6bf165205d16e43cf5eb2
2017-09-11 09:26:42 +00:00
TreeHugger Robot 04907ad6d7 Merge "Define priority for video threads" into oc-mr1-dev 2017-09-08 20:05:39 +00:00
TreeHugger Robot 80206d8f03 Merge "fix: boot fails on ASAN builds with VNDK restriction" into oc-mr1-dev 2017-09-08 01:20:30 +00:00
Jeff Tinker 17ffcc4280 Define priority for video threads
Video threads have soft realtime requirements that
must be met in order to maintain reliable frame delivery
even when the system is under high load. This CL
defines a new priority that can be used by video
threads, enabling them to be scheduled appropriately
relative to other system threads.

Change-Id: Idd57207e30309dfdff24389db0acf107532f9e5a
related-to-bug:63898080
2017-09-07 16:14:07 -07:00
Daniel Rosenberg 8ca02bbeb5 Add derive_gid flag for mounting sdcardfs
Turns on the derive_gid feature for sdcardfs. This was moved
under a mount flag in the kernel.

Test: If the derive_gid flag is supported, the first mount
      should succeed. If the flag is not, the second should
      succeed.
Bug: 63245673
Change-Id: If1c1bce13d14120732e420252cb5605d33ce7c40
2017-09-07 15:30:01 -07:00
TreeHugger Robot 5809705759 Merge "libadf is a new member of VNDK" into oc-mr1-dev 2017-09-07 12:12:30 +00:00
Jiyong Park a07f3057d0 vendor apk is unbundled
For devices where VNDK restrictions are all enforced, vendor apks are
recognized as unbundled; since system partition and vendor partition can
be updated independently from each other.

However, since vendor apks are still bundled in the vendor partition,
they are allowed to do more than ordinaly unbundled apks that are
downloaded and installed to the data partition.

1) /vendor/lib is allowed. So the path is added to the search_paths and
permitted paths of the classloader namespace.
2) LLNDK libs are allowed in addition to the NDK libs. So, LLNDK lib list
from llndk.libraries.txt is added to the list from public.libraries.txt.
3) VNDK-SP libs are allowed. To do so, the classloader namespace is
linked to the 'vndk' namespace where VNDK-SP libs are searched and
loaded from. The list of available VNDK-SP libs is read from
vndksp.libraries.txt file.
4) Name of the namespace is changed to 'vendor-classloader-namespace'
since the namespace is configured differently from the ordinary
'classloader-namespace'.

Bug: 63553457
Test: 2017 pixel devices build and boots to the UI
Test: a vendor apk (e.g. TimeService.apk) works. Turn the airplain mode on.
Set time. Reboot the device. The time is not reset.
Test: 1) set target as 2017 pixel
2) m -j CtsVendorJniTestCases
3) copy the built apk into /vendor/app/CtsVendorJniTestCases
4) reboot / factory reset
5) adb shell am instrument -w android.jni.vendor.cts

Change-Id: I447452eb025c0a0fd076b5c9ac081d453dc6074e
2017-09-07 20:26:10 +09:00
Adam Vartanian 47efc676c8 Fix integer overflow in utf{16,32}_to_utf8_length
Without an explicit check, the return value can wrap around and return
a value that is far too small to hold the data from the resulting
conversion.

No CTS test is provided because it would need to allocate at least
SSIZE_MAX / 2 bytes of UTF-16 data, which is unreasonable on 64-bit
devices.

Bug: 37723026
Test: run cts -p android.security
Change-Id: I56ba5e31657633b7f33685dd8839d4b3b998e586
2017-09-07 10:36:19 +01:00