Commit Graph

35673 Commits

Author SHA1 Message Date
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
Jiyong Park 26335f89b1 add llndk|vndksp.libraries.txt to vndk_package
List of llndk and vndk-sp libraries are written in the txt file so that
they can be available at run-time. The information is used by
libnativeloader to configure the classloader-namespace specially for
vendor apks.

Bug: 64882323
Test: build 2017 pixel devices. check that the two files exist on
/system/etc.

Change-Id: Ifbe339a5862f6ef57a8213a14a022765ccf77283
2017-09-07 11:51:29 +09:00
TreeHugger Robot cd00582000 Merge changes from topic "hide_log_time" into oc-mr1-dev
* changes:
  Hide implementation details of log_time struct
  Don't rely on transitively included headers
2017-09-07 02:39:39 +00:00
Jiyong Park 98c0d030c9 Hide implementation details of log_time struct
In the future, the sizes of tv_sec and tv_nsec (or even the size of
log_time struct itself) can change due to the 32-bit overflow expected
to happen in the year 2138. In order to hide such implementation details
to the clients of liblog, the two macros LOG_TIME_SEC and LOG_TIME_NSEC
are introduced.

Furthermore, vendors are provided with a simplified version of log_time.h
without C++ APIs. In doing so, log_time.h no longer includes time.h.
This breaks several modules that implicitly relied on the hidden
dependency, which should be fixed.

Bug: 37629934
Test: build with BOARD_VNDK_VERSION=current
Change-Id: I01b36078c1d8f3f44824be20ae769ba1465b6feb
2017-09-06 15:30:50 +09:00
Jiyong Park e6474b7fa2 Don't rely on transitively included headers
One must explicitly include what it need.
time.h for clock_gettime

Bug: 37629934
Test: build
Merged-In: I992eac637f373b204aa161b0b26f5563e952c27e
Change-Id: I992eac637f373b204aa161b0b26f5563e952c27e
2017-09-06 15:30:32 +09:00
Jiyong Park 4729da4c8a libadf is a new member of VNDK
The library is used by both platform (e.g. libminui) and vendors (for
theor HW composer HAL impl).

Bug: 64050301
Test: 2017 pixel devices build
Test: libadf.so is in /system/lib[64]/vndk directory
Change-Id: I20b8b9728cdc56a7491266070740c3330d4324dc
2017-09-06 13:31:12 +09:00
Jiyong Park 5e73998997 Revert "libcutils_header exports liblog_headers"
This reverts commit 8f63b6cfca.

Reason for revert: the use of cutils/log.h is discouraged. clients should use log/log.h. aosp/420955

Bug: 37342627
Change-Id: I6605aa89b0ef2b9afd0fdd52c1dee1ee0021debd
2017-09-06 01:48:43 +00:00
Jiyong Park 8f63b6cfca libcutils_header exports liblog_headers
cutils/log.h includes log/log.h. Therefore, libcutils_headers needs to
export the liblog_headers so that the clients of libcutils don't have to
explicitly include liblog (or liblog_headers).

Bug: 37342627
Test: build sdk_gphone_x86 userdebug with BOARD_VNDK_VERSION=current
Change-Id: I8875855222b4d073fac4a22bff488c9d082d39df
2017-09-04 12:18:40 +09:00
TreeHugger Robot 2d3cf6799e Merge "templatize ld.config.txt" into oc-mr1-dev 2017-09-01 03:23:17 +00:00
TreeHugger Robot 7e929121b1 Merge "Revert "adbd: lessen security constraints when the device is unlocked"" into oc-mr1-dev 2017-09-01 01:30:51 +00:00
TreeHugger Robot d9d20baf6f Merge "libz is back to LLNDK" into oc-mr1-dev 2017-09-01 00:39:14 +00:00
Jiyong Park faefa6bd36 fix: boot fails on ASAN builds with VNDK restriction
Fix the bug that caused boot failure on ASAN builds with VNDK
restriciton. The major cause is because incorrect (old) ld.config.txt
was used when the build is sanitized, which prevented the dynamic linker
to find some VNDK libs that only exist in /system/lib/vndk; the old
ld.config.txt does not have the directory in its search paths. So, this
CL fixes the problem by having the same ld.config.txt for both sanitized
and non-sanitizied builds.

Furthermore, ld.config.txt is modified so that dependency to
libclang_rt* libs are redirected to those in /system/lib directory. This
ensures that the sanitizer runtime libs are not dual loaded but are
provided for both platform and vendors.

Bug: 65217017
Test: SANITIZE_TARGET=integer_overflow SANITIZE_TARGET_DIAG=integer_overflow m
on 2017 pixel devices. The build is successful and the device boots to
the UI.

Change-Id: I0e21e20d9aca340b984968e07d4ce542ae10fd31
2017-09-01 07:53:56 +09:00
Jiyong Park 367984602a templatize ld.config.txt
Lists of libraries in between the linker namespaces are no longer
hard-coded in ld.config.txt, but instead come from Soong.

Bug: 37139976
Test: build 2017 pixel device with BOARD_VNDK_VERSION=current m -j
Test: the device is bootable, basic functionalities (camera, camcorder,
wifi, bt, gps, etc.) work.
Change-Id: I8170e6c3f6ee04b16359791d64cc46bd2714a073
2017-09-01 07:53:56 +09:00
Jiyong Park 697eb2da0d libz is back to LLNDK
For 2016 pixel devices, where VNDK is not fully enforced, move libz back
to LLNDK so that we can pass the CTS without requiring the default
namespace to be isolated.

If we have libz in vndk-sp directory, test_linker_namespaces fails
because /system/lib/vndk-sp/libz.so becomes accessible. In order to make
the lib inaccessible, we have to make the default namespace isolated,
but this can't be done for 2016 pixel devices where VNDK is not fully
enforced. So, we choose to remove /system/lib/vndk-sp/libz.so and keep
the single copy at /system/lib.

Bug: 65018779
Test: android.jni.cts.JniStaticTest#test_linker_namespaces successful on
2016 pixel devices

Change-Id: Ib6b6560b02be69d2015c0afb86acf07c02b30c2f
2017-08-31 22:11:35 +09:00
Bowgo Tsai 9fa61b4df3 Revert "adbd: lessen security constraints when the device is unlocked"
This reverts commit f1d3dbc32f.

With the following changes to move /sbin/adbd to /system/bin/adbd,
we don't need this workaround anymore.

  https://android-review.googlesource.com/#/q/topic:move-adbd-to-system+(status:open+OR+status:merged)

Bug: 63313955
Bug: 63381692
Bug: 64822208
Test: 'adb root' works in VTS for a non-A/B device (userdebug GSI + user boot.img)

Change-Id: Ic1249d6abd7d6e6e7380a661df16d25447853a48
Merged-In: Ic1249d6abd7d6e6e7380a661df16d25447853a48
(cherry picked from commit 0603ec4294)
2017-08-31 16:26:49 +08:00
Jiyong Park 55f05d79f9 Make default namespace for system processes isolated
The default namespace for system process now becomes isolated, which
means it can load only the libs that are in search.paths and under
permitted.paths.

/system/framework, /system/app, /system/priv-app, /vendor/app, /data,
etc are added to the permitted paths since libart should be able to
dlopen odex files under the locations.

Following directories become unavailable:
/system/lib/vndk
/system/lib/vndk-sp

Bug: 37013858
Bug: 64888291
Bug: 64950640
Test: 2017 pixel devices builds and boots
Test: android.jni.cts.JniStaticTest#test_linker_namespaces passes
Change-Id: I2bbe9cc19940c3633c2fb901f9bf8ab813e38c13
2017-08-31 11:52:03 +09:00
Josh Gao a2f1335819 adbd: don't spin if file sync read fails.
Bug: http://b/64508974
Bug: 64709603 (presubmit balking at the line above)
Test: mma
Change-Id: Ifba6a9dea3138b6d2a62c91cc0532f63986c048a
(cherry picked from commit 1d6c01b53d)
2017-08-29 18:54:19 +00:00