Commit graph

52737 commits

Author SHA1 Message Date
Treehugger Robot
af15eff03b Merge "Don't preload libneuralnetworks.so" 2019-10-15 12:35:47 +00:00
Jooyung Han
9e52397825 Merge "Use com.android.vndk.current variant for vndk list" 2019-10-15 09:21:19 +00:00
Treehugger Robot
e34d239023 Merge changes I1cae6530,I7ffaa260
* changes:
  Publish chunk size in utility.h
  Remove magic numbers from test and use storage literals
2019-10-15 04:55:19 +00:00
Alessio Balsini
9e95202e4d Publish chunk size in utility.h
The chunk size of the snapshot should be kept consistent among different
files.
Move it to libsnapshot/utility.h to improve its visibility.

Change-Id: I1cae6530a07c88f3a0091ca7d8bb2eb590a6710f
Bug: 140835698
Test: m
Signed-off-by: Alessio Balsini <balsini@google.com>
2019-10-14 21:07:07 +01:00
Alessio Balsini
3f6334e623 Remove magic numbers from test and use storage literals
Use constant expressions and storage literals to simplify readability.

Change-Id: I7ffaa260a2cd77dc0e24980f115f9e8df72708e6
Bug: 140835698
Test: libsnapshot_test
Signed-off-by: Alessio Balsini <balsini@google.com>
2019-10-14 21:07:02 +01:00
Tom Cherry
a5a107fb6d Merge "init: trigger shutdown directly from builtins" 2019-10-14 13:48:52 +00:00
Jooyung Han
82f94d61cb Use com.android.vndk.current variant for vndk list
New linkerconfig reads some txt files which list various kinds of
vndk libraries. For example, vndksp.libraries.txt file has the list of
VNDKSP type libraries. The exact file names are retrieved from .vendor
variants.

With VNDK APEX, .vendor variants are not installed but
.com.android.vndk.current variants are packaged into VNDK APEX.

This CL changes the variant type from .vendor to
.com.android.vndk.current so that *.libraries.txt files can list the
installed files correctly.

Bug: 141451661
Test: m && device boot
Change-Id: Ibbc27b1ae6a44cc2337a0b14918caa27107a4c8e
2019-10-13 22:03:50 +09:00
Christopher Ferris
3902531b86 Merge "Replace MOCK_METHODN with MOCK_METHOD macro." 2019-10-12 00:43:05 +00:00
Christopher Ferris
baf058bbf7 Replace MOCK_METHODN with MOCK_METHOD macro.
Test: Builds and unit tests pass.
Change-Id: I64e0034359c213f37c098d1c97be260bd955ca0f
2019-10-11 14:30:18 -07:00
Tom Cherry
212b8247ab Merge "liblog: don't sleep in the middle of tests" 2019-10-11 21:00:02 +00:00
Tom Cherry
0dbfea7b07 init: trigger shutdown directly from builtins
Especially now that property_service is a thread, there may be some
delay between when init sets sys.powerctl and when the main thread of
init receives this and triggers shutdown.  It's possible that
outstanding init commands are run during this gap and that is not
desirable.

Instead, have builtins call TriggerShutdown() directly, so we can be
sure that the next action that init runs will be to shutdown the
device.

Test: reboot works
Test: reboot into recovery due to bad /data works
Change-Id: I26fb9f4f57f46c7451b8b58187138cfedd6fd9eb
2019-10-11 13:45:42 -07:00
Treehugger Robot
536e8ded6b Merge "Only allow alphanumerical characters, '-' and '_' in event trigger names" 2019-10-11 20:11:49 +00:00
Treehugger Robot
0e9a0f9831 Merge changes I8804f7dd,I3cbca589
* changes:
  [fs_mgr] fix -Wreorder-init-list
  [debuggerd] fix -Wreorder-init-list
2019-10-11 19:52:37 +00:00
Christopher Ferris
d1cb35bdef Merge "Add method to get usage stats for a single map." 2019-10-11 18:16:01 +00:00
Tom Cherry
dbc4815dbf liblog: don't sleep in the middle of tests
A lot of liblog tests follow this pattern:
1) Write a log message
2) Sleep ~1 second
3) Use the non_blocking log reader to dump all log messages
4) Test those log messages

This causes running back to back tests to be very slow and still
allows for some amount of flakiness if the system is very loaded.

This change replaces that pattern with the following:
1) Write a log message
2) Set an alarm for 2 seconds as a test timeout
3) Read logs with the blocking reader until finding the expected log
   messages
4) Test those log messages
5) Use the non_blocking reader to dump all log messages
6) Re-test those log messages, to ensure no duplicates, etc, which
   isn't done in step 3).

Despite dumping the logs twice, the tests are orders of magnitude
faster in the good case, and should be less prone to flakes.

Test: liblog-unit-tests
Change-Id: Iedf473316576b8007746fe3560815bde1813787a
2019-10-11 10:56:11 -07:00
Nick Desaulniers
8e048440e5 [fs_mgr] fix -Wreorder-init-list
C++20 will require members in a designated initializer to be in order
unlike C99.

Bug: 139945549
Test: mm
Change-Id: I8804f7dd5cba1035ac7a2979a47b661d722f664a
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
2019-10-11 10:54:53 -07:00
Nikita Ioffe
aaab596687 Only allow alphanumerical characters, '-' and '_' in event trigger names
This should help in preventing silly typos like "on foo:"

Test: atest CtsInitTestCases
Test: builds
Bug: 135984674
Change-Id: I6e4e18970e957d25dea9f557f0d31a759fbe6150
2019-10-11 17:44:54 +01:00
Treehugger Robot
d4a1cd2cdd Merge "Fuzzer for libdm's dm-linear devices creation" 2019-10-11 15:38:23 +00:00
Treehugger Robot
6b0e789a21 Merge "lmkd: Remove unnecessary conditional" 2019-10-11 14:30:00 +00:00
Nikita Ioffe
4592237300 Merge "userspace reboot: stop post-data services and wait for them to be killed" 2019-10-11 10:29:50 +00:00
Treehugger Robot
30820a384c Merge "Move TempDevice to test_util.h" 2019-10-11 10:18:43 +00:00
Treehugger Robot
5a1489ce4e Merge "Move libnative{bridge,loader} to art/" 2019-10-11 09:57:05 +00:00
Florian Mayer
b8ba80ebd2 Merge "Remove useless goto." 2019-10-11 09:41:36 +00:00
Jiyong Park
98b1c69253 Don't preload libneuralnetworks.so
The lib isn't used by most of the apps. Don't waste memory by preloading
it to all apps.

Bug: 142482121
Test: `lsof -p $(pidof zygote64) | grep libneuralnetwork` shows nothing
Change-Id: I4a6e3df838fa3b7a46271e548e9fdc87bea948ae
2019-10-11 10:31:12 +09:00
Christopher Ferris
23f2a0b166 Add method to get usage stats for a single map.
The new scudo allocator creates a huge map in 64 bit address space. Some
tests would get the usage stats of all maps, but only really cared about
a small set of maps. In this case, provide a method to only get the usage
stats for the maps you care about.

Test: Unit tests pass.
Change-Id: Ie845e47a8c789a57bf689c9f0e5878a921640e30
2019-10-10 15:10:27 -07:00
Nick Desaulniers
67d52aa0f6 [debuggerd] fix -Wreorder-init-list
C++20 wants members to be ordered unlike C99.

Bug: 139945549
Test: mm
Change-Id: I3cbca589511c1e0bbc10c691949e18de77e16031
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
2019-10-10 14:54:35 -07:00
Suren Baghdasaryan
9186612f9a Merge "libmeminfo: Report VMA flags in showmap report" 2019-10-10 20:13:48 +00:00
Alessio Balsini
08916b9ea2 Fuzzer for libdm's dm-linear devices creation
Create a fuzzer that fuzzes the parameters used for the creation
of dm-linear tables through libdm.
This fuzzer is based on libdm::DmLinear.

Bug: none
Test: dm_linear_fuzzer
Change-Id: I052144c6eb0db4fa6a37b5e54fbcb8193e5dc88f
Signed-off-by: Alessio Balsini <balsini@google.com>
2019-10-10 20:59:33 +01:00
Alessio Balsini
5e6dc03fd5 Move TempDevice to test_util.h
TempDevice is useful class for tests, move it to test_util.h to improve
its visibility and make it usable by other tests.

Bug: none
Test: none
Change-Id: Idad5667844b10559b24f8f5e657e47d99e14209e
Signed-off-by: Alessio Balsini <balsini@google.com>
2019-10-10 20:59:33 +01:00
Florian Mayer
ad427b74c4 Remove useless goto.
Test: build

Change-Id: Ifb8d832de1115eefbf2e09c6d5c8f03244566933
2019-10-10 18:15:24 +01:00
Nikita Ioffe
3f4b0d6113 userspace reboot: stop post-data services and wait for them to be killed
* Refactored code around stopping services a little bit to reuse it
  between full reboot and userspace reboot.
* Add a scope_guard to fallback to full reboot in case userspace reboot
  fails.
* In case of userspace reboot init will also wait for services to be
  terminated/killed and log the ones that didn't react to
  SIGTERM/SIGKILL in time.
* If some of the services didn't react to SIGKILL, fail userspace reboot.

Test: adb reboot userspace
Bug: 135984674
Change-Id: I820c7bc406169333b0f929f0eea028d8384eb2ac
2019-10-10 18:13:42 +01:00
Greg Kaiser
5670fabb94 lmkd: Remove unnecessary conditional
We want poll_handler to be handler_info, so it's more efficient
to just unconditionally assign it.

Test: TreeHugger
Change-Id: I55b5164da1817ef77b5d455eb618f9a2471afc5c
2019-10-10 06:52:23 -07:00
Tom Cherry
cad2fc2429 Merge "liblog: use packed structs instead of raw unaligned reads" 2019-10-10 13:46:54 +00:00
Tom Cherry
bbbf089137 liblog: use packed structs instead of raw unaligned reads
Per jmgao@, we still need to worry about unaligned integer accesses.

In any case, we already have the packed structs for all of the
unaligned data that we're reading, so this change favors using those
packed structs.

Bug: 142256213
Test: x86,arm32,arm64 liblog-unit-tests
Change-Id: I21fc629eac49895d03b5b31daa4cc494b0c4c230
2019-10-09 18:20:49 -07:00
Suren Baghdasaryan
e8f1468b14 libmeminfo: Report VMA flags in showmap report
Add VMA flags into showmap report so that we can distinguish different
sections of an executable or a library.

Bug: 138148041
Test: showmap -v <PID>
Change-Id: Ic1a13accbea447548c75a0c54d750280e40c6de8
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-10-09 16:18:18 -07:00
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
Orion Hodson
60239d2069 Move libnative{bridge,loader} to art/
Bug: 137364733
Test: m
Change-Id: I8fc0796745f7310f477fe9f8b0821586742dd9c0
2019-10-09 13:32:35 +01: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