Commit graph

52701 commits

Author SHA1 Message Date
Suren Baghdasaryan
d11c6f7fd8 Merge "lmkd: Track processes using pidfds" 2019-10-09 17:46:14 +00:00
Hridya Valsaraju
524dc3f8ef Merge "Export ion_4.12.h and ion_4.19.h" 2019-10-09 16:58:32 +00:00
Suren Baghdasaryan
530098cebc Merge "lmkd: Add support for process death notifications" 2019-10-09 16:18:40 +00:00
Treehugger Robot
b18dc5d287 Merge "Add a link from runtime ns to the neuralnetworks ns" 2019-10-09 15:20:03 +00:00
Tom Cherry
e3fc9ac7e3 Merge "liblog: remove alarm in logd_reader.cpp" 2019-10-09 14:48:38 +00:00
Martin Stjernholm
58ee7e3ae1 Merge "Continue without DEX support if libdexfile_external.so fails to load." 2019-10-09 12:06:07 +00:00
Daichi Hirono
e76c0d2816 Add a link from runtime ns to the neuralnetworks ns
libneuralnetworks.so could be preloaded. In that case, it should be
accessible from libnativeloader which runs in the art namespace.

Bug: 141847343
Bug: 142089311
Test: m, cheets2 boots
Change-Id: I8710b624dff131f5cb797d53915f6597e3017c34
2019-10-09 07:43:52 +00:00
Treehugger Robot
2a46301b48 Merge "Prepare for libnative{bridge,loader} moving to art/" 2019-10-09 07:43:46 +00:00
Hridya Valsaraju
f142c4dd41 Export ion_4.12.h and ion_4.19.h
Also, clean-up duplicate copies of the header files.

Bug: 140916230
Test: make, ./ion-unit-tests
Change-Id: Iab06ba622ab1d50e902ae20411bae73d0b00bbc7
2019-10-08 21:36:03 -07:00
Suren Baghdasaryan
11dc734a06 lmkd: Track processes using pidfds
lmkd uses PIDs to track processes, however occasionally a PID of a process
might be reused without lmkd detecting that. This can happen if originally
registered process crashes, PID numbers wrap around and the same PID gets
reused for a different process. In this situation lmkd might kill a wrong
process. To prevent this issue from occurring lmkd will track processes
using their pidfd. During process registration lmkd calls sys_pidfd_open
and stores returned pidfd with the process record. Returned pidfd will not
be reused until lmkd closes it which happens only after the process is
unregistered. This way lmkd ensures that process identification is unique
and can't be reused.

Bug: 135608568
Test: lmkd_unit_test with and without pidfd kernel support
Change-Id: Ida10ea13905c250e47f792cdd6bd2e65aeaa3709
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-10-08 18:15:34 -07:00
Suren Baghdasaryan
f2081a96be lmkd: Add support for process death notifications
With pidfd polling support lmkd can detect process death without periodic
polling. Implement mechanism to detect kernel pidfd support using
pidfd_open syscall existence as an indicator. Implement the logic to use
pidfd to wait for process death.

Bug: 135608568
Test: lmkd_unit_test with and without pidfd kernel support
Change-Id: Ic6db7e50893534467f5130a7f998b66fb4451272
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-10-08 18:15:12 -07:00
Tom Cherry
5398021b9e liblog: remove alarm in logd_reader.cpp
There is an alarm() call that provides a 30 second timeout in case
logd is unavailable.  The main reason for this is in the case that logd
is crashing, debuggerd is ptrace'ing logd, and tombstoned is
attempting to dump log messages.  In this case, with no other checks
and without this alarm, tombstoned will deadlock when dumping log
messages.

However, tombstoned already has two mechanisms to prevent the above
situation from happening:
1) It checks that the thread name that is is dumping is either logd or
   starts with "logd." and skips dumping logs in this case.
2) It does not dump logs if it is running in process for any process.

Calling alarm() or modifying signal handlers from general purpose
libraries is not recommended either, so without a strong reason to
keep this, this change removes it.

This also shortens the liblog.wrap_mode_blocks test time, since the 30
second issue that it ensures does not happen has been fundamentally
removed.

Test: `kill -8 `pidof logd`` succeeds without delay
Test: liblog, logd unit tests
Change-Id: Id8a40544645d220e49f7ba299201af80a0c44de9
2019-10-08 13:05:55 -07:00
Tom Cherry
5d7969b58a Merge "liblog: remove code checking for fd = 0" 2019-10-08 19:24:02 +00:00
Martin Stjernholm
9062bb4269 Continue without DEX support if libdexfile_external.so fails to load.
libunwindstack may be used in situations where we cannot guarantee that
libdexfile_external.so is available, e.g. from libc_malloc_debug.so in the
bootstrap Bionic, or in APEXes with incomplete linker configs.

Test: atest libunwindstack_unit_test
Test: atest --host libunwindstack_unit_test
Test: rm -f out/host/linux-x86/lib*/libdexfile_external.so && \
  out/host/linux-x86/nativetest64/libunwindstack_unit_test/libunwindstack_unit_test
  (check that DexFile(s)Test tests fail without abort)
Bug; 139408016
Change-Id: I7eeee77ab363d9d39412ece2038ce786394bb34f
2019-10-08 19:21:45 +01:00
Christopher Ferris
c48c2afa1e Merge "Handle when bias is different in elf headers." 2019-10-08 17:41:25 +00:00
Christopher Ferris
819f13116e Handle when bias is different in elf headers.
The original code assumed that the load bias in the program headers
would be exactly the same as in eh_frame/eh_frame_hdr/debug_frame.

This isn't guaranteed, so add a section bias for use when creating
a DwarfSection. In addtion, make the load bias and section bias
a signed value. There is no reason that this value needs to be positive,
so don't force it to be.

Add a new offline test that has a different load bias in eh_frame than
in the executable load.

Add additional unit tests to verify the load bias values are set properly.

Clean up the tests in ElfInterfaceTest, making all tests names follow the
same convention.

Bug: 141888859
Bug: 142094469

Test: New units and old unit tests pass on host and taimen.
Change-Id: Ib878123ab5545f0f315c749cfe0d27b012d873ee
2019-10-08 17:36:06 +00:00
Tom Cherry
29d0e89364 liblog: remove code checking for fd = 0
Fix a typo where I check socket()'s return value for 0 instead of -1
as an error.

Remove code that checks if socket() returns 0 as the actual fd that it
returns.  This should not happen in any well formed program.

Test: liblog unit tests
Change-Id: I1d878e85d9a39155d68c6c84e9cf9b0db8d1b3a4
2019-10-08 10:18:20 -07:00
Elliott Hughes
4d7d903e2b Merge "init: actually report which signal is causing the reboot." 2019-10-08 17:13:59 +00:00
Orion Hodson
a65f314e17 Prepare for libnative{bridge,loader} moving to art/
Add temporary public visibility for libraries.

Update bpfmt for ART's repohooks.

Bug: 137364733
Test: m nothing
Test: copy libs to art/, create a CL, run repohooks, m nothing.

Change-Id: Ib9a280136e4b992fe17b8943cf404c9c803efb8d
2019-10-08 16:44:44 +01:00
Nikita Ioffe
f1933c910d Merge "Add a skeleton of userspace reboot" 2019-10-08 14:42:36 +00:00
Treehugger Robot
5bbe4a1b26 Merge "[liblog] fix -Wreorder-init-list" 2019-10-08 14:24:41 +00:00
Nikita Ioffe
ba6968e636 Add a skeleton of userspace reboot
This CL only draws boundaries between userspace and full reboots, and
adds some functionality that will be required for userspace reboot:

* Whenever device is shutting down is now controlled in reboot.cpp,
  since during userspace reboot this state can change.
* Now it's also possible to restart handling of control messages inside
  property service. In case of userspace reboot, init will restart it
  after stopping post-data services.
* New userspace-reboot-requested trigger is added similar to shutdown
  one for full reboot.

Test: adb reboot
Test: adb reboot userspace
Bug: 135984674
Change-Id: Id55a53ba781d2b90ce40449037b6d8d47e72c476
2019-10-08 12:16:06 +01:00
Martin Stjernholm
c14b27f22d Merge "Ensure all namespaces have links to /system/lib(64) for the sanitizer libs." 2019-10-08 11:06:05 +00:00
Treehugger Robot
6c1668d660 Merge "libutils: flattenable deprecation comment" 2019-10-08 04:44:58 +00:00
Nick Desaulniers
34282df8bb [liblog] fix -Wreorder-init-list
Bug: 139945549
Test: mm
Change-Id: I57de1a650d2c85dfb4f8817bbc80eb2296eaf568
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
2019-10-07 21:28:43 -07:00
Treehugger Robot
b7dee5d148 Merge "Rename the runtime linker namespace following ART/Runtime APEX split." 2019-10-08 03:33:29 +00:00
Elliott Hughes
636ebc9b3b init: actually report which signal is causing the reboot.
It wasn't clear to me why init was rebooting until I saw that it was
SIGABRT, which then made me read through earlier log spam to work out
what was actually unhappy (the SELinux compiler, in my case).

Test: worked out why init was rebooting my device
Change-Id: I605d8956213c4c23711073fd4b0ff99562b7f351
2019-10-07 18:16:23 -07:00
Steven Moreland
ae9749a29a libutils: flattenable deprecation comment
This class isn't used very much and it isn't supported by AIDL. In order
to recommend new users against this and recommend an alternative, added
a comment here.

Bug: 142282873
Test: N/A

Change-Id: If7c6c9fac6c868ed6a515e658de752092d25d5f9
2019-10-07 18:14:14 -07:00
Kiyoung Kim
59a9cef6a0 Merge "Disable to build ld.config.txt with previous vndk version" 2019-10-08 00:57:41 +00:00
Treehugger Robot
4ad0da974e Merge "init: drop unused direct dependency on libcrypto.so" 2019-10-07 23:12:56 +00:00
Suren Baghdasaryan
d72d846754 Merge "lmkd: Fix string null termination in proc_get_size and proc_get_name" 2019-10-07 22:53:49 +00:00
Elliott Hughes
69627e52b9 Merge "adb: log more detail on failure to read keys." 2019-10-07 22:29:32 +00:00
Treehugger Robot
07577e3778 Merge "Fix explicit constructor warning from cpplint" 2019-10-07 21:47:26 +00:00
Suren Baghdasaryan
ca0790d3f7 lmkd: Fix string null termination in proc_get_size and proc_get_name
Fix string null termination and cleanup proc_get_size and proc_get_name
functions.

Bug: 74119935
Test: lmkd_unit_test
Change-Id: Ied176b8d347b672b91866ac59a813d4ff349930a
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-10-07 12:50:38 -07:00
Tobias Thierer
1be2a2ce8d init: drop unused direct dependency on libcrypto.so
When I previously tried this in https://r.android.com/1108553 , it broke on
some targets but I think that may have been fixed. I'm trying it again now
to see if this now passes treehugger and sticks.

Note: There is still an indirect dependency via libfs_mgr.

Bug: 137267623
Test: Treehugger
Change-Id: I2d8b909e451bb64a1eb0719a145dfd74da1dcbad
2019-10-07 19:34:16 +00:00
Eric Biggers
736557c510 Merge changes from topic "fscrypt-key-mgmt-improvements"
* changes:
  init/fscrypt_init_extensions: support setting v2 encryption policies
  fs_mgr_fstab: support specifying encryption policy version in fstab
2019-10-07 19:09:43 +00:00
Colin Cross
d0accefc05 Merge "Change logpersist.start to sh_binary" 2019-10-07 17:47:45 +00:00
Ashwini Oruganti
c5f8b3925b Merge "Show bug_map links on user builds" 2019-10-07 16:37:35 +00:00
Tom Cherry
dfc6ea334a Merge "liblog: run in isolated mode, disable flaky tests" 2019-10-07 16:36:09 +00:00
Elliott Hughes
7fb1407125 adb: log more detail on failure to read keys.
Before we just got "Failed to read key". After:

  adb E 10-07 08:20:14 258249 258249 auth.cpp:176] Failed to read key \
    from '/usr/local/google/home/enh/.android/adbkey'
  94390117965240:error:0900006e:PEM routines:OPENSSL_internal:NO_START_LINE:\
    external/boringssl/src/crypto/pem/pem_lib.c:622:Expecting: ANY PRIVATE KEY

Also fix the misleading "Failed to generate" message from adb_auth_init.

Bug: http://b/141715453
Test: manually corrupted key; see above
Change-Id: I6732ee6b683c8548d596d7c22eeddab8ce9a3cea
2019-10-07 08:25:42 -07:00
Orion Hodson
1384e7a706 Fix explicit constructor warning from cpplint
Bug: 137364733
Test: m
Change-Id: Ia3badccda5e6ca139d889c3c7b5aa8a9ab79ef38
2019-10-07 15:28:45 +01:00
Nikita Ioffe
baca43b3d8 Merge "Make init.updatable_crashing a read/write property" 2019-10-07 13:51:25 +00:00
Martin Stjernholm
39e65d5b05 Ensure all namespaces have links to /system/lib(64) for the sanitizer libs.
This CL updates ld.config.vndk_lite.txt, which still is not handled by
linkerconfig.

Test: presubmits
Bug: 140790209
Change-Id: Ia822f86aa0b853656555ade0bed191e07c07d09d
2019-10-07 12:14:57 +01:00
Martin Stjernholm
752a1e0408 Rename the runtime linker namespace following ART/Runtime APEX split.
Remove the kludge in libnativeloader to deal with the inconsistency wrt the
name of the APEX package.

Test: Build & boot
Test: atest system/core/libnativeloader (on cf_x86_phone)
Bug: 139408016
Change-Id: I6115b49237c78c2ea4aa943ca4fe0b296b5a2b62
2019-10-07 12:14:57 +01:00
Kiyoung Kim
7f5ec44dbc Disable to build ld.config.txt with previous vndk version
As generic ld.config.txt will be covered with linker config generator,
ld.config.txt with previous vndk build is no longer required. This
change removes this part so there will be no unnecessary build step for
multiple vndk version build. Also vndk snapshot will have vndkcore and
vndkprivate files with version number, update_and_install_ld_config.mk
has been updated temporary for vndk_lite build.

Bug: 142072719
Test: m -j passed with aosp_arm64 build
Change-Id: Ia7529c80b179dc262c6e7646a34c2a05a0d9be84
2019-10-07 17:30:42 +09:00
Kiyoung Kim
f2098870c1 Merge "Temporary add ld.config.txt build" 2019-10-07 05:48:03 +00:00
Treehugger Robot
71f124dc54 Merge "Add a link from runtime ns to the neuralnetworks ns" 2019-10-07 03:36:14 +00:00
Kiyoung Kim
2e7b3df686 Temporary add ld.config.txt build
Last generic ld.config.txt deprecation caused build error from
build_test build because of invalid ld.config.txt build target. To fix
this ld.config.txt build target should be enabled until
ld.config.vndklite.txt and ld.config.legacy.txt also become deprecated.

Bug: 138920271
Test: m ld.config.txt passed
Test: build_test passed
Change-Id: I7f45ee66d3ed70a1a698261e1e801a30729f592f
2019-10-07 11:10:37 +09:00
Kiyoung Kim
e5013de9ac Merge "Deprecate ld.config.txt for fully treblelized devices" 2019-10-07 01:07:58 +00:00
Jiyong Park
8ec6f59e62 Add a link from runtime ns to the neuralnetworks ns
libneuralnetworks.so could be preloaded. In that case, it should be
accessible from libnativeloader which runs in the runtime namespace.

Bug: 141847343
Bug: 142111172
Test: m, marlin/sailfish boots
Change-Id: I5b2f3073d0711d6049b4e1e1bd0bcc403949fe14
2019-10-07 09:34:41 +09:00