Commit graph

34745 commits

Author SHA1 Message Date
Christopher Ferris
2502a60ea1 If the pc is set to zero, the unwind is done.
Bug: 68047085

Test: Ran new unit tests, verified new unwinder does not show an
Test: extra pc zero frame for arm 32 bit processes.
Change-Id: Ic6532e56fbb786a8b7d41638abae777c2d0f1d59
2017-10-23 14:55:16 -07:00
Christopher Ferris
26b614ddf6 Merge "Multiple bugfixes, small restructuring." 2017-10-23 19:16:13 +00:00
Jae Shin
678efa25a6 Merge changes from topic "rs_vndk_step2"
* changes:
  fix: boot fails on ASAN builds with VNDK restriction
  templatize ld.config.txt
  Make default namespace for system processes isolated
  vndk: add vendor/lib(64)/vndk for vendor namespace
  Implement system namespace for vendor process
  Use the legacy linker namespace configs when target is sanitized
  Permit /system/lib/vndk-sp/hw/ for 'sphal' namespace
  Add system/${LIB}/vndk to default namespace for vendor.
  Add [test] section for /data/[nativetest|benchmarktest]
  /data/nativetest[64] processes are running with the new ns config
2017-10-23 02:43:52 +00:00
Jiyong Park
257de3def5 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.

Merged-In: I0e21e20d9aca340b984968e07d4ce542ae10fd31
Change-Id: I0e21e20d9aca340b984968e07d4ce542ae10fd31
(cherry picked from commit faefa6bd36)
2017-10-23 02:42:47 +00:00
Jiyong Park
ecc703c792 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.
Merged-In: I8170e6c3f6ee04b16359791d64cc46bd2714a073
Change-Id: I8170e6c3f6ee04b16359791d64cc46bd2714a073

(cherry picked from commit 367984602a)
2017-10-23 02:40:37 +00:00
Jiyong Park
246338f90e 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
Merged-In: I2bbe9cc19940c3633c2fb901f9bf8ab813e38c13
Change-Id: I2bbe9cc19940c3633c2fb901f9bf8ab813e38c13
(cherry picked from commit 55f05d79f9)
2017-10-23 11:10:32 +09:00
Justin Yun
b5ddc5ae6b vndk: add vendor/lib(64)/vndk for vendor namespace
When the vndk is extended by vendor, the libs in vendor/lib(64)/vndk
will override system/lib(64)/vndk libs. Vendor binaries will search
vndk libs in vendor/lib(64)/vndk prior to system/lib(64)/vndk.

Also, remove a workaround for libsdm-color.so

Bug: 65032513
Test: build and boot check for libsdm-color.so will be loaded on boot
Test: currently no libs exist on vendor/lib(64)/vndk. No test for it
Merged-In: I99ed37eb1a9e92c83533e2d92c9c06db11f01e97
Change-Id: I99ed37eb1a9e92c83533e2d92c9c06db11f01e97
(cherry picked from commit 3094de9684)
2017-10-23 11:10:31 +09:00
Justin Yun
333845c710 Implement system namespace for vendor process
For vendor process default namespace searches as following order:
1. /vendor/lib/(hw|egl), /vendor/lib: Vendor libs + VNDK-vnd-ext
2. /system/lib/vndk-$(ver): VNDK libs
3. /vendor/lib/vndk-sp-$(ver): VNDK-SP-vnd-ext
4. /system/lib/vndk-sp-$(ver): VNDK-SP
and searches system namespace (/system/lib) only for LL-NDK libs.
This configuarion is used only with BOARD_VNDK_VERSION is defined.

Bug: 37192038
Test: build with 'BOARD_VNDK_VERSION=current' and boot

Merged-In: If9778b9266a084846ba8fe73e6bff25828359d33
Change-Id: If9778b9266a084846ba8fe73e6bff25828359d33
(cherry picked from commit 24c29f1be4)
2017-10-23 11:10:30 +09:00
Jiyong Park
614c5521a3 Use the legacy linker namespace configs when target is sanitized
The new linker namespace config causes problem when the target is
sanitized: vendor libs which are loaded in the sphal namespace can't
link against to libclang_rt* libs which are in /system/lib directory
because the directory is not allowed for sphal namsapce.

Long-term solution would be installing libclang_rt* to both /system/lib
and /vendor/lib so that vendor libs can link against to the one in
/vendor/lib.

Until the work is done, let's just disable the new linker namespace
config when the target is to be sanitized.

Bug: 63535130
Test: make SANITIZE_TARGET=integer_overflow
SANITIZE_TARGET_DIAG=integer_overflow builds and boots to the UI

Merged-In: I6afb69885aaa3d25e554b9ca699a572248bfc50a
Change-Id: I6afb69885aaa3d25e554b9ca699a572248bfc50a
(cherry picked from commit fff6f75fc1)
2017-10-23 11:10:29 +09:00
Jiyong Park
b5c0fc3ceb Permit /system/lib/vndk-sp/hw/ for 'sphal' namespace
android.hidl.memory@1.0-impl.so is a SP-HAL located in
/system/lib/vndk-sp/hw. This can't be moved to /vendor/lib since it is a
framework HAL.

Bug: 62930720
Test: 2017 pixel builds and boots with BOARD_VNDK_VERSION on
Merged-In: I9c456983ef68120c5e8c629efc6dd66a26220ecb
Change-Id: I9c456983ef68120c5e8c629efc6dd66a26220ecb
(cherry picked from commit 7d4cf3fd33)
2017-10-23 11:10:28 +09:00
Justin Yun
e373672afd Add system/${LIB}/vndk to default namespace for vendor.
With BOARD_VNDK_VERSION=current, vndk libs will be installed in
system/${LIB}/vndk. To make them available for vendor, it must be
added to default namespace.

Bug: 63866913
Test: build and boot with BOARD_VNDK_VERSION=current
Merged-In: I9e467a6125fc89513754b56a2420975559144f98
Change-Id: I9e467a6125fc89513754b56a2420975559144f98
(cherry picked from commit 90a2487776)
2017-10-23 11:10:27 +09:00
Jiyong Park
c8ae86afdd Add [test] section for /data/[nativetest|benchmarktest]
We have both system and vendor tests in the same directory
/data/nativetest. Since we can't distinguish system and vendor tests at
runtime, we choose to run all of them with the legacy namespace
configuration where /system/lib and /vendor/lib are both accessible
without any restriction. Furthermore, /system/lib/vndk-sp is added to
the list of accessible directories for tests since some libs (such as
libion.so) exist only in the directory but not in /system/lib.

This will change in the future when we install system and vendor tests
into different directories (vendor tests goes into ./vendor subdir).
Then, we will run the tests with [system] or [vendor] configurations
depending on their paths.

Bug: 63597267
Test: run bionic-unit-tests
Test: run linker-unit-tests
Merged-In: I810003b2da0b30335200c130f484ea7b041f9f80
Change-Id: I810003b2da0b30335200c130f484ea7b041f9f80
(cherry picked from commit c034a43d44)
2017-10-23 11:10:26 +09:00
Jiyong Park
433fe3a8a2 /data/nativetest[64] processes are running with the new ns config
Native tests under /data/nativetest[64] directory is now running with
the same linker namespace configuration as /system/bin/* processes.

This allows us to stop mimicing the linker namespace configuration of the
/system/bin/* processes using LD_LIBRARY_PATH.

Bug: 63597267
Test: run bionic-unit-tests
Test: run linker-unit-tests
Merged-In: If8e2ed0b8016e4e07bf6829735b8e02f952042d0
Change-Id: If8e2ed0b8016e4e07bf6829735b8e02f952042d0
(cherry picked from commit 9d1e50b809)
2017-10-23 11:10:25 +09:00
Christopher Ferris
e69f470933 Multiple bugfixes, small restructuring.
- Move the load bias stored out of ElfInterface into Elf. For the compressed
  sections, the load bias was not the same as the data from the uncompressed
  section.
- Move the initialization of the compressed section into Init. It was too easy
  to forget to call the init of the compressed section.
- Do not automatically add in load bias to the pc before calling ElfInterface
  code. Do all of the pc manipulations in the Elf object.
- Change the interface GetFunctionName code to pass in the load_bias instead
  of modifying the pc inside the code.
- Modify the Step function to pass in the elf offset, not add it to the pc.
  It is necessary to have two different relative values when executing the
  Step: a pc that is relative to the beginning of the elf for the reading data
  the actual instructions when trying to determine if this is in a signal
  frame, and a pc that is relative to the map for finding the appropriate
  unwind information.
- Add a feature to Unwinder so that an unwind can be stopped if it ends up
  in map that has a specified suffix. This is so that the ART unwinding
  code doesn't require skipping the compressed section. Instead, stop at
  if trying to unwind through a known suffix code that means the code is
  in java code. This is important because the compressed section data is
  not only used by the jave compiled code, so that will continue to work.
- Fix tests for restructuring, add new tests for new functionality.

Test: Ran art test 137-cfi using new unwinder as default.
Test: Ran new unit tests.
Change-Id: I42e658c64c5e14f698ba34944a3043afac967884
2017-10-20 11:15:32 -07:00
Tom Cherry
4e2a8e375e Merge "init: clean up subcontext_test" 2017-10-20 14:36:31 +00:00
Treehugger Robot
0f40200577 Merge "init language extension for lazy HIDL services." 2017-10-20 06:38:42 +00:00
Steven Moreland
e055d73396 init language extension for lazy HIDL services.
This associates every service with a list of HIDL services
it provides. If these are disabled, hwservicemanager will
request for the service to startup.

Bug: 64678982
Test: manual with the light service
Change-Id: Ibf8a6f1cd38312c91c798b74574fa792f23c2df4
2017-10-19 20:38:47 -07:00
Josh Gao
76ecdd6a95 Merge "liblogcat: avoid double close." 2017-10-20 02:07:28 +00:00
Treehugger Robot
cba7f57119 Merge "init: add SelabelInitialize() for subcontext" 2017-10-20 00:43:29 +00:00
Tom Cherry
0d1452ee1b init: add SelabelInitialize() for subcontext
Children of init that use any of the SELinux wrapper functions,
including make_dir(), mkdir_recursive(), and plenty others, need to
first initialize the sehandle with SelabelInitialize().

I wish there were a better solution, but early init doesn't actually
want this handle initialized, so that is a valid use case.  Ueventd
needs to initialize this before fork()'ing, so lazy initialization is
not universally acceptable either.  Likely we won't have other
children that fork() then exec() init again, so this should be okay.

Bug: 62875318

Test: init unit tests
Test: sailfish creates directories with correct SELabel after wipe
Change-Id: I6de937604a060e18945427418f15b90e0b9d5c37
2017-10-19 16:25:45 -07:00
Tom Cherry
e6d37cdbf9 init: clean up subcontext_test
subcontext_test had been failing due to setexeccon() failing to
transition to vendor_init context.  This is a good thing as nothing
other than init should be able to transition into this context.

I don't want to add code to skip the setexeccon() call only for the
tests, so I instead call setexeccon() with the return value of
getcon().  This works however only for root, so these tests are
skipped for non-root.

Test: init unit tests
Change-Id: I8a415599e0ec5506511202f7f5018c0e5265837d
2017-10-19 16:24:56 -07:00
Josh Gao
03d055d6ff liblogcat: avoid double close.
Bug: http://b/67960705
Test: mma
Change-Id: I0b9015f0b4e64631a3476966decce3b6210bb801
2017-10-19 13:19:19 -07:00
Christopher Ferris
b3959bb47e Merge "Fix demangle of function names." 2017-10-19 20:03:51 +00:00
Treehugger Robot
a03c935e27 Merge "bootstat: Add more boot reasons found by logging in the wild." 2017-10-19 19:41:34 +00:00
James Hawkins
34073b583a bootstat: Add more boot reasons found by logging in the wild.
Bug: none
Test: none
Change-Id: I7e388326be44aeb3e6fdb79d2e173dc17eb8bc1f
2017-10-19 10:44:22 -07:00
Christopher Ferris
9a6b3e39e5 Fix demangle of function names.
Also move the Backtrace::CreateNew function into the same place as ::Create
in preparation for the switch to the new unwinder as the base.

Test: Verify that names are demangled properly.
Change-Id: I6274cd43ea52210523e1e1ce23af5b22f62f4573
2017-10-18 19:20:12 -07:00
Treehugger Robot
d72d92aee2 Merge "init: add extra std::move" 2017-10-19 02:17:20 +00:00
Treehugger Robot
6393c62e2e Merge "bootstat: remove extraneous android_logcat_destroy." 2017-10-19 01:43:22 +00:00
Treehugger Robot
22d2136d75 Merge "libbacktrace is not directly available to vendors" 2017-10-19 01:31:24 +00:00
Treehugger Robot
6e52973623 Merge "init: wait_for_prop shouldn't run in a subcontext" 2017-10-19 00:10:18 +00:00
Josh Gao
52315ae329 bootstat: remove extraneous android_logcat_destroy.
android_logcat_pclose already does that.

Bug: http://b/67960705
Test: mma
Change-Id: I03d06b10807e8a313c9654c2e1db36bfb59e3f99
2017-10-18 16:57:33 -07:00
Treehugger Robot
ab62265fa1 Merge "Use target.linux for all linux kernel based targets" 2017-10-18 22:46:05 +00:00
Tom Cherry
5d7b55bc69 init: add extra std::move
This is meant to be copy-and-move, but I forgot the move.

Test: build
Change-Id: I755ad0d99624dc0ae419ad9ed3ae6d0e017b27c5
2017-10-18 14:52:33 -07:00
Tom Cherry
fa3e52c64a init: wait_for_prop shouldn't run in a subcontext
wait_for_prop sets a flag that prevents the action queue from
continuing while otherwise allowing init's main loop to continue
executing.  This cannot be done from a subcontext, so it's moved to
normal init.

All property functions need work in any case, particularly once
property_service is moved out of init.

Bug: 62875318
Test: boot sailfish and see that the previous failure related to this
      is fixed

Change-Id: Ib9e0d0bdbd0ff22ab0e5c3fe6db620700af266c6
2017-10-18 14:42:27 -07:00
Christopher Ferris
8158d708c3 Merge "Fix setting of map_offset in frame data." 2017-10-18 16:01:25 +00:00
Christopher Ferris
c5a3baa5e3 Fix setting of map_offset in frame data.
The old code set the map_offset from elf_offset, but it should have used
offset. Without this change, frame data is not properly shown for shared
libraries in an apk.

Add new unit test to verify that map_offset is set properly.

Test: Ran new unit tests.
Change-Id: I2fe5abda23a5de51c8fcf9361ba9350b80446f15
2017-10-17 18:42:03 -07:00
Treehugger Robot
796987482f Merge "<stdbool.h> not necessary in C++." 2017-10-17 19:26:53 +00:00
Elliott Hughes
a0f73f9bff <stdbool.h> not necessary in C++.
Bug: N/A
Test: builds
Change-Id: I1f32b202e353414e74ace87a7d5b495b5deb5f99
Merged-In: I1f32b202e353414e74ace87a7d5b495b5deb5f99
2017-10-17 16:21:33 +00:00
Tom Cherry
4ff2607ef7 Merge "Only allow UTF8 encoded property values" 2017-10-17 16:12:34 +00:00
Dan Willemsen
bdddcab3bd Use target.linux for all linux kernel based targets
Now in Android.bp files, target.linux applies to all targets running a
linux kernel (android, linux_glibc, linux_bionic). So common
flags/sources/etc can be combined instead of copying them to each
target.

Test: m
Change-Id: If7ad138ea1c540c160731f86b6ccc0daa5c69b83
2017-10-16 20:55:39 -07:00
Tom Cherry
8702dcb992 Only allow UTF8 encoded property values
Java already restricts properties to only UTF8 valid strings, and
this change makes this restriction also apply to all native code.

Bug: 63177684
Test: new unit tests
Change-Id: I9fa0ecc0da066b0a026db3497c0f0cbf3f5c2d5a
2017-10-16 22:35:33 +00:00
Jiyong Park
b7d92c4b96 libbacktrace is not directly available to vendors
This lib becomes VNDK-SP just because libutils, which is VNDK-SP, is
depending on it. Since libutils provide android::CallStack class for
collecting and printing the callstack, there is no need for vendors to
use the internal libbacktrace library. Thus the lib is marked as
vendor_available: false.

Bug: 64730695
Test: build 2017 pixel device
Change-Id: I4ad91e3a6747bb0ae88d32cd26dfba32239c5b93
2017-10-16 11:35:02 +09:00
Jae Shin
06254de12a Merge "libkeymaster1 split" 2017-10-16 01:29:29 +00:00
Janis Danisevskis
5c148f3f26 libkeymaster1 split
libkeymaster1 was split into libkeymaster_portable and
libkeymaster_staging.

Bug: 37467707
Test: mma -j
Merged-In: Iead014db3f3d841f08c8072b0493ec9fd7a05055
Merged-In: I63869316451867d54bf34afb28ea232cc7eddbae
Change-Id: Iacdcef8631b4903fef4a79d146a9f59e37f31c3f
2017-10-14 01:18:32 +00:00
Mark Salyzyn
5126ce99de Merge "bootstat: test: duration fixes" 2017-10-13 16:32:10 +00:00
Mark Salyzyn
244947e813 bootstat: test: duration fixes
misspelled duration_test in test_thermal_shutdown

Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: I5981fa899db84199aefb46c8741511e6889bc79c
2017-10-13 09:29:53 -07:00
Treehugger Robot
af54c27e1b Merge "fs_mgr: removing is_device_secure()" 2017-10-13 03:39:21 +00:00
Bowgo Tsai
744361fc57 fs_mgr: removing is_device_secure()
Previously there is no vboot 1.0 metadata for ENG builds. It relies on
is_device_secure() to query "ro.secure" and skip setting up dm-verity
if the value is 0 (meaning ENG build).

This change will be submitted together with other changes to add vboot
1.0 metadata for ENG builds with a "disable magic". The resulting
metadata will be the same as triggering an "adb disable-verity" on an
USERDEBUG image.

Bug: 63056044
Test: boot sailfish eng/userdebug builds

Change-Id: I35eef771e1b30bfc6d01b8ed76b40c942fe7b783
2017-10-13 06:34:12 +08:00
Tom Cherry
4a5a337ef2 Merge "Move some properties users to __system_property_read_callback()" 2017-10-12 16:53:41 +00:00
Tom Cherry
96e8042e41 Merge "Allow setting read-only properties with value length > 92 characters" 2017-10-12 16:09:43 +00:00