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>
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
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
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
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>
This should help in preventing silly typos like "on foo:"
Test: atest CtsInitTestCases
Test: builds
Bug: 135984674
Change-Id: I6e4e18970e957d25dea9f557f0d31a759fbe6150
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
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
C++20 wants members to be ordered unlike C99.
Bug: 139945549
Test: mm
Change-Id: I3cbca589511c1e0bbc10c691949e18de77e16031
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
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>
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>
* 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
We want poll_handler to be handler_info, so it's more efficient
to just unconditionally assign it.
Test: TreeHugger
Change-Id: I55b5164da1817ef77b5d455eb618f9a2471afc5c
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
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>
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
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>
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>
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
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