Commit graph

57274 commits

Author SHA1 Message Date
Jiyong Park
d427b54c53 Merge "Revert "Make libstatssocket a shared_lib"" 2020-05-08 08:11:24 +00:00
Jiyong Park
3e0ec0f7f7 Revert "Make libstatssocket a shared_lib"
This reverts commit 29512fbf70.

Reason for revert: breakage https://android-build.googleplex.com/builds/quarterdeck?branch=aosp-master&target=run_bluetooth_host_native_tests&lkgb=6474123&lkbb=6474183&fkbb=6474137

Bug: 156046846
Test: m on full-eng

Merged-In: I5889dd718536f5f2c693b4c2e7331c9cc2eb2ac9
Change-Id: If28b7590d4e58e44a24581f3b5891b2441504801
2020-05-08 07:57:09 +00:00
Jiyong Park
d25f5dbba9 Merge "Make libstatssocket a shared_lib" 2020-05-08 02:12:58 +00:00
Christopher Ferris
7821048120 Merge "Change call to mmap64." 2020-05-07 18:35:54 +00:00
Peter Collingbourne
4cd4b45a32 Merge "Add support for MTE error reports in tombstones." 2020-05-07 17:51:51 +00:00
Tom Cherry
972f1ba172 Merge changes Ib0f33d2f,Ife6c09dd,I55ed5656
* changes:
  logd: enable -Wextra
  logd: don't check of the timestamp of audit messages is monotonic
  Remove the monotonic option for logging
2020-05-07 16:12:33 +00:00
Christopher Ferris
7b9f35c9de Change call to mmap64.
The code was using an off64_t but calling mmap. This caused the code
to abort on 32 bit.

Add a unit test that would abort on the previous version.

Bug: 155662887

Test: New unit test passes.
Change-Id: I7a6efbc0d4227403c3d08a08deea56f239382157
2020-05-06 22:32:18 +00:00
Yifan Hong
1af4a81f7d Merge "libsnapshot: fix incorrect assumption of cow images" 2020-05-06 22:06:12 +00:00
Joshua Duong
2814928567 Merge "[adb client] Fix mdns discovery service registry." 2020-05-06 21:39:59 +00:00
Tom Cherry
053dacab48 logd: enable -Wextra
Also drop -Wall and -Werror since they're included by default now.

Test: build
Change-Id: Ib0f33d2f02e00aaf544cb0ce5acec5d8acaa8a81
2020-05-06 13:57:57 -07:00
Tom Cherry
517808981e logd: don't check of the timestamp of audit messages is monotonic
This is the last isMonotonic() user and can go away.  This timestamp
is set in the kernel source in either the audit_get_stamp() or
__audit_syscall_entry() functions.  In both cases, the value used is
from ktime_get_coarse_real_ts64(), which is a realtime timestamp.

Test: audit messages show in the log correctly.
Change-Id: Ife6c09dd97fccdfc7a8f07ee63161079ae2eccc4
2020-05-06 13:37:33 -07:00
Tom Cherry
f2c2746aba Remove the monotonic option for logging
This has been around for ~5 years but there has been roughly no
adoption, so remove this as we clean up the logging code.

Future efforts may track the monotonic timestamp in all cases.

Test: logging unit tests
Change-Id: I55ed565669f923988e741f6b384141bba893630d
2020-05-06 13:37:33 -07:00
Tom Cherry
72fdec1777 Merge changes I9a357a3e,I7cfc6393,I69148243
* changes:
  logd: start cleaning up LogReaderThread
  logd: use std::function and lambdas where appropriate
  logd: rename LogTimes -> LogReaderThread
2020-05-06 20:34:42 +00:00
Treehugger Robot
c3d30bfdff Merge "Fix GetGlobalVariableOffset with tagged pointer in aarch64" 2020-05-06 05:53:45 +00:00
David Anderson
6bc06af640 Merge "libfiemap: Remove brittle tests." 2020-05-06 02:14:05 +00:00
David Anderson
f74f58fa17 Merge "liblp: Add integer overflow checks when aligning." 2020-05-06 01:36:10 +00:00
Yifan Hong
e6c1a84276 libsnapshot: fix incorrect assumption of cow images
libsnapshot used to assume CoW images are always mapped
with device mapper, and call GetDeviceString directly.
However, in tests, it is possible that it is mapped as loop
devices. Fix the incorrect assumption and calls
IImageManager::GetMappedImageDevice instead.

Test: libsnapshot_fuzzer with corpus
Bug: 154633114
Change-Id: I1ec39744480e514ae7a7902643ed863e0ca0a340
2020-05-05 18:01:15 -07:00
David Anderson
e3fa729dc2 libfiemap: Remove brittle tests.
libfiemap functionality is extensively tested via libsnapshot, gsid, and
fiemap_writer_test. However those tests rely on the configuration of the
device, and libfiemap has fairly different behavior based on whether FBE
or metadata encryption is in use. (The former will use loop devices, the
latter uses dm-linear).

To expand coverage, we added tests with very complicated nesting,
creating fiemaps on a rw partition mounted off a device backed by a
fiemap. Unsurprisingly, this was brittle to begin with, and now
consistently fails due to the intermediate partition not having
sepolicy.

Given the preference toward metadata encryption, and the fact that the
FBE mode will still be properly tested via VTS, let's just remove these
tests.

Bug: 148874852
Test: fiemap_image_test
Change-Id: I7be7d44dea81508505c050ed995b3b78086ad35f
2020-05-05 15:33:21 -07:00
David Anderson
42c2733d6c liblp: Add integer overflow checks when aligning.
This will prevent ubsan crashes on invalid inputs.

Bug: 155510366
Test: liblp_test gtest
Change-Id: Id6dd8badd0025d6cac3113c3f9076ea3f4d9c175
2020-05-05 11:37:53 -07:00
Yifan Hong
2e66043394 Merge "Add tests for zero snapshot size." 2020-05-05 15:23:35 +00:00
Joshua Duong
077ac11106 [adb client] Fix mdns discovery service registry.
We were getting stale service ip addresses because we weren't
destroying the sdref correctly.

Also, we were leaking the ResolvedServices when removing it from the
ServiceRegistry. Converted them to smart pointers to fix that.

Bug: 153343580

Test: test_adb.py
Change-Id: Ib7c1dbf54937d4ac6d9885cb5f7289bef616d12e
2020-05-05 00:21:12 -07:00
Tom Cherry
cef47bb38c logd: start cleaning up LogReaderThread
1) We can use real member functions with std::thread and
   std::function, so use those instead of the 'me' pointer.
2) Don't expose member variables directly.
3) Rename and document member variables, since all of their references
   are being touched anyway.

Test: logging unit tests
Change-Id: I9a357a3ea8691433d58687c95356b984b83e9c36
2020-05-04 17:44:52 -07:00
Tom Cherry
320f5968da logd: use std::function and lambdas where appropriate
Test: logging unit tests
Change-Id: I7cfc63937b5dadb5547c4661ca2f5204d7b4a174
2020-05-04 17:37:14 -07:00
Tom Cherry
6ec71e9253 logd: rename LogTimes -> LogReaderThread
LogTimes has evolved from being simply a store of the last timestamp
that each reader has read to being a class representing an individual
reader thread, including the thread function, so name it
appropriately.

Test: logging unit tests
Change-Id: I6914824376a6ff1f7509e657fa4dc044ead62954
2020-05-04 17:37:08 -07:00
Tom Cherry
794acfc0fe Merge changes Ic7620978,I6d5bab58,Id1668c26,Icdb56b6f,Ic0c86a2b
* changes:
  logd: remove FlushCommand
  logd: rename mOldest -> oldest_
  logd: separate PruneList from LogBuffer
  logd: don't use SIGHUP to reinitialize
  logd: decouple LogTags from LogBuffer
2020-05-04 22:12:48 +00:00
Tom Cherry
79d54f7877 logd: remove FlushCommand
This code has evolved to the point that it LogReader::notifyNewLog()
executes FlushCommand on every socket.  FlushCommand then iterates
over all log reader threads in LogTimes and flushes triggers them to
flush logs if they match the client.  This can be simplified to simply
looping over all of the reads in LogTimes.

Code readability was the primary motivation here, but note that 64% of
LogReader::notifyNewLog() was spent looping over the sockets, and an
additional 78% of FlushCommand::runSocketCommand() was spent
repeatedly locking and unlocking the LogTimes lock.

Overall, this reduces the cost of LogReader::notifyNewLog() in
LogListener::onDataAvailable() from 5.91% to 2.93%.  This is the
critical path for handling incoming log messages, so it's a
non-trivial savings.

Test: logging unit tests
Test: unprivileged clients still cannot view privileged logs
Change-Id: Ic7620978a6c23e5e2cb179ff0c42b7cea52fc011
2020-05-04 11:19:44 -07:00
Alessio Balsini
f2554ab2ad Merge "fiemap_image_test: libcrypto_utils as static lib" 2020-05-04 17:48:06 +00:00
Tom Cherry
20118eec69 logd: rename mOldest -> oldest_
I added mOldest recently before mentally committing to have new code
follow the Google C++ style guide.

Test: build
Change-Id: I6d5bab5833e14ac3808862598a2a60989d805e18
2020-05-04 10:17:42 -07:00
Tom Cherry
5a3db391b4 logd: separate PruneList from LogBuffer
logd needs a pointer to PruneList, but it should not own it and it
should not have initPrune() or formatPrune() functions.

Test: logging unit tests
Change-Id: Id1668c26d07eb5d1e4cf267f5748c20a79f711ae
2020-05-04 10:02:55 -07:00
Tom Cherry
e170d1ac8d logd: don't use SIGHUP to reinitialize
It doesn't look like there are any users, since there is a much better
mechanism, `logd --reinit` that exists for this behavior.  The
settings app and init.rc use that mechanism and they are the two major
clients that force logd to reinitialize.

This saves us from creating a thread and marginally cleans up
main.cpp.

Test: log reinitialization works
Change-Id: Icdb56b6f59adbba82812231a4f3a6ffd1a7955fc
2020-05-04 10:02:51 -07:00
Tom Cherry
1a12ae3a25 logd: decouple LogTags from LogBuffer
LogBuffer needs a pointer to LogTags, but it should not own the
instance.  It should not provide accessors into LogTags either.

Also, clean up CommandListener a bit.

Test: logging unit tests
Change-Id: Ic0c86a2bac0c4dd80262278588b9fdc2326dbe5b
2020-05-04 10:01:37 -07:00
David Anderson
67da0932d8 Merge "fastboot: Fix snapshot-update merge behavior." 2020-05-04 16:07:56 +00:00
Treehugger Robot
f9273c2aa3 Merge "processgroup: Set min_sdk_version" 2020-05-04 15:52:39 +00:00
Jooyung Han
6789753739 Merge "libcutils: Set min_sdk_version" 2020-05-04 15:51:33 +00:00
Treehugger Robot
2a2e9e0a34 Merge "gralloc: Set min_sdk_version" 2020-05-04 14:17:22 +00:00
Tej Singh
29512fbf70 Make libstatssocket a shared_lib
Make libstatssocket unable to be linked as a static lib on the platform.

Test: bit libstatssocket_test:*
Test: bit statsd_test:*
Test: atest LibStatsPullTests
Bug: 149340100

Merged-In: I5889dd718536f5f2c693b4c2e7331c9cc2eb2ac9
(cherry picked from commit d78f4dab02)
Change-Id: I5889dd718536f5f2c693b4c2e7331c9cc2eb2ac9
2020-05-04 21:46:15 +09:00
Orion Hodson
2f448104d7 Merge "Add libnativehelper.so to public libraries" 2020-05-04 07:23:19 +00:00
David Anderson
5a0177d945 fastboot: Fix snapshot-update merge behavior.
When merging in recovery, the "imminent data wipe" code was used, which
made the assumption the /metadata and /data state would be zapped. This
caused future OTAs to error because the old snapshots were detected.

This CL allows OTAs to proceed even if unexpected snapshots are present.
It also forces the state to "MergeCompleted" after a merge in recovery,
so that the next normal boot can perform cleanup.

Bug: 155339165
Test: fastboot snapshot-update merge, then take another OTA
      vts_libsnapshot_test
Change-Id: Ief6dea3ba76323044e61307272dda320a4494aea
2020-05-02 16:02:07 -07:00
Yifan Hong
f4cd49afa4 Merge changes from topic "snapshot_fuzz"
* changes:
  Enable automatic libsnapshot fuzzer runs
  Also log corpus when aborted through libbase.
  libsnapshot_fuzzer: Fuzz MapUpdateSnapshot.
  libsnapshot_fuzzer: construct valid super partition metadata.
  libsnapshot_fuzzer: Fuzz CreateUpdateSnapshots
  libsnapshot_fuzzer: add additional tests for more APIs
  libsnapshot_fuzzer: use protobuf
  libsnapshot_fuzzer: map super image
2020-05-02 04:46:31 +00:00
Treehugger Robot
0964727323 Merge "first_stage_init: add support to skip module load failures" 2020-05-02 02:07:44 +00:00
Christopher Ferris
8f9d4afa2d Merge "Fix dangling pointer issue in LocalUpdatbleMaps" 2020-05-02 00:15:21 +00:00
Will McVicker
c8907427bc first_stage_init: add support to skip module load failures
Extend androidboot.first_stage_console cmdline property to enable
skipping module load failures without stopping at a serial console. This
is useful for GKI development.

Set androidboot.first_stage_console=2 for this behavior.

Bug: 155296582
Test: verify behavior for values 0, 1, and 2
Change-Id: I068c631a22c848e45a421b297b1acae1b3deb3c1
2020-05-01 16:47:12 -07:00
Yifan Hong
e0c2e62c87 Add tests for zero snapshot size.
Test: run vts_libsnapshot_test
Test: fails without the fix patch
Bug: 155484992
Change-Id: Ia048704f427682d4f83219fbf9813ae06d05298b
2020-05-01 16:22:27 -07:00
Yifan Hong
d2a8418acf Merge "Handle zero snapshot size appropriately." 2020-05-01 22:54:14 +00:00
Sim Sun
a7a194beb4 Fix dangling pointer issue in LocalUpdatbleMaps
Libunwindstack would remove duplicated items and update the `prev_map`
during reparsing `/proc/self/maps`. But we leave `prev_real_map`
pointing toward a MapInfo that will be deleted soon. It will cause a
dangling pointer issue.

Add new tests to cover this dangling pointer issue.

Bug: 155511785

Test: libunwindstack_test
Change-Id: I62e1b97bcb73f07e9349671f0b758f5ec9de16c0
2020-05-01 22:20:01 +00:00
Yifan Hong
83c690c7a6 Handle zero snapshot size appropriately.
This won't happen in practice because device size is never
zero. Hypothetically, if it is, PartitionCowCreator still
suggests that a CoW size of 8192 bytes needs to be created. In
reality, it is not necessary.

Test: libsnapshot_fuzzer
Bug: 155484992
Change-Id: I6c69f54820522d50c699384eec90c474ca3a9402
2020-05-01 18:46:44 +00:00
Yifan Hong
c43f513c91 Enable automatic libsnapshot fuzzer runs
Test: none
Bug: 154633114
Change-Id: I226d88b74bd1ea6b3cb912609d7bdf10aa8208fd
2020-05-01 11:00:48 -07:00
Yifan Hong
4d5bfabfeb Also log corpus when aborted through libbase.
If a CHECK or LOG(FATAL) is hit, also attempt to log the current
corpus.

Test: pass
Bug: 154633114
Change-Id: Id0f376021011924f5d64eb5b591b5ebab6dc7dbc
2020-05-01 11:00:48 -07:00
David Anderson
b827d1db0c Merge "remount: Improve messaging when a reboot is needed." 2020-05-01 17:44:18 +00:00
Nikita Ioffe
e874875570 Merge "Reject services that are both critical and oneshot" 2020-05-01 16:07:09 +00:00