Commit graph

57028 commits

Author SHA1 Message Date
Nikita Ioffe
f3504ec58d Add RootTargetPreparer for CtsInitTestCases and CtsFsMgrTestCases
Some of the test cases in CtsInitTestCases and CtsFsMgrTestCases require
root. This CL makes it possible to run such tests cases on userdebug
builds, which in turn means that they will be run on presubmit.

New option was implemented in
https://android-review.googlesource.com/c/platform/tools/tradefederation/+/1283834

Test: atest CtsInitTestCases
Test: atest CtsFsMgrTestCases
Change-Id: I3d29789ddd7ac549e40ac193c58d986670c49285
2020-04-14 18:57:07 +01:00
Jaegeuk Kim
8b8743462c Merge "fstab: support f2fs compression" 2020-04-14 15:54:18 +00:00
Tom Cherry
92d34064e1 Merge "liblog: remove operator overloads from log_msg" 2020-04-14 15:32:32 +00:00
Tom Cherry
0ca9bd2bcd liblog: remove operator overloads from log_msg
No one's using them and it's not intuitive how they would be used.

Test: build
Change-Id: I8d49825be2e7ecee9834060260b1c59c30664f1d
2020-04-13 13:48:58 -07:00
Treehugger Robot
451197cb64 Merge "[incfs] Stream the hash tree for incremental installation" 2020-04-13 20:37:27 +00:00
Alex Buynytskyy
82c1c9711d [incfs] Stream the hash tree for incremental installation
Instead of sending the whole tree upfront use the same
streaming interface for it as for the data blocks

This improves installation speed by almost 200ms,
650-800ms -> 500-600ms

Bug: 153696423
Test: manual, adb install in various configurations

Change-Id: Ia83de2af54ca0b1969397514ea5d761719af9055
Merged-In: Ia83de2af54ca0b1969397514ea5d761719af9055
2020-04-13 13:00:01 -07:00
Nikita Ioffe
1c14654732 Merge "Fallback to hard reboot if userspace reboot hasn't started in time" 2020-04-13 19:14:56 +00:00
Tom Cherry
ffe39ea541 Merge "Cleanup some trivial TODOs." 2020-04-13 15:39:49 +00:00
Nikita Ioffe
d05535485f Fallback to hard reboot if userspace reboot hasn't started in time
Similarly to other recovery mechanisms, timeout is controlled by a
read-only property that can be configured per-device.

Test: adb root
Test: adb shell setprop init.userspace_reboot.started.timeoutmillis 2
Test: adb reboot userspace
Bug: 152803929
Change-Id: Id70710b46da798945ac5422ef7d69265911ea5ef
2020-04-11 01:59:17 +01:00
Tom Cherry
ac0cee539f Merge "liblog: cleanup TODOs in tests" 2020-04-11 00:18:57 +00:00
Josh Gao
44b7cb92d6 Merge "debuggerd: don't leave a zombie child if crash_dump is killed." 2020-04-10 22:04:03 +00:00
Tom Cherry
acf0bebcf9 Merge "Revert "logd: iterator corruption paranoia"" 2020-04-10 20:53:59 +00:00
Tom Cherry
5f4c79f510 liblog: cleanup TODOs in tests
1) log_msg.msg() will never be nullptr, unless logd sends an invalid
   response, so it's the right idea to ASSERT() that this is true
   instead of just checking and continuing.
2) Even though liblog.too_big_payload is tautological, there's no
   reason not to test it, in case the assumptions that make it
   tautological change.
3) We're not too worried about the return value of logging functions
   or that liblog prevents them from being written (anyone can write
   their own values to logd after all).

Test: liblog-unit-tests
Change-Id: I144cc7cf45c164ea5f04e0786ff0e298fd626f07
2020-04-10 13:48:05 -07:00
Tom Cherry
5d93b127f5 Merge "init: fix todo in a test" 2020-04-10 19:56:04 +00:00
Josh Gao
8489bfb4d7 Merge "[adb] Don't copy features set on each get()" 2020-04-10 18:18:15 +00:00
Tom Cherry
85f2bc930a Cleanup some trivial TODOs.
1) There's no reason or way to support boot_clock for waiting for
   property changes, since the underlying futex_wait uses
   CLOCK_MONOTONIC.  We probably wouldn't want boot_clock even if it
   did, since it doesn't make sense to consider the time a device was
   suspending in the timeout for waiting for a property to change.
2) The init tokenizer has been essentially unchanged for a decade,
   there's no motivation to 'fix' it to not require a trailing
   newline.
3) The ueventd TODO regarding moving vendor specific ueventd.rc
   entries out of rootdir has been fixed.

Test: n/a
Change-Id: I3b68e3d2f25cbd539f9f8ff526669b8af04d833d
2020-04-10 10:15:30 -07:00
Josh Gao
c40a7515eb debuggerd: don't leave a zombie child if crash_dump is killed.
If crash_dump dies before it gets a chance to write to the pipe we use
to let the debugged-process know that it successfully started, we
weren't cleaning up the child we fork to start it, leaving a zombie
child.

Bug: http://b/152119184
Test: debuggerd_test
Change-Id: Id01cc05f693995e9998941774f74ab8e3d8b4d8a
2020-04-10 10:09:39 -07:00
Tom Cherry
3f67fb8e45 init: fix todo in a test
Structured bindings with templated containers work now, so no need for
the workaround or TODO.

Test: init unit tests
Change-Id: I6a286de9859d8a97df480a7ac2862a3a10bd9fb3
2020-04-10 10:08:24 -07:00
Tom Cherry
ad7d6b210d Revert "logd: iterator corruption paranoia"
This reverts commit 3614a0c5d4.

The original commit was added to check if what should be impossible
cases were happening.  In the years after it was added, it doesn't
appear that these cases have happened.  Recent reverts removed the
commits that caused the paranoia in the first place, making these
cases even more impossible.

Test: logging unit tests
Change-Id: I687c4d7876a38485e940f004dbd5ae6a1e15fb4c
2020-04-10 09:38:51 -07:00
Tom Cherry
7ef143fc84 Merge "liblog: support extended logger_entry headers" 2020-04-10 15:18:03 +00:00
Yurii Zubrytskyi
6fc26dff7c [adb] Don't copy features set on each get()
The features are already cached in a static and don't change.
Let's return the cached set instead of copying it every time.

Bug: 150183149
Test: manual
Change-Id: Ifdca852cc3b32e09e50ea4771f7878987c46cce8
2020-04-09 22:26:48 -07:00
Yurii Zubrytskyi
83c7ad22a1 Merge "[zip] Stop calculating crc if it's not checked" 2020-04-10 05:07:30 +00:00
Jiyong Park
49c52979ba Merge changes I8fd2a3c9,Id08058f3
* changes:
  Set apex_available property
  Set apex_available property
2020-04-10 01:14:55 +00:00
Tom Cherry
d3ecc66b9c liblog: support extended logger_entry headers
logger_entry has a hdr_size field meant for backwards compatibility,
however there are a few checks that expect it to be a specific size.
More problematically, it has a variable length array element, msg[0]
at the end, that would be incorrect if the header size was not kept
static.

This change fixes up those issues to facilitate future additions.

Bug: 119867234
Test: logging works with extended size headers, logging unit tests
Test: newly added unit tests with extended size header
Change-Id: I14b2b0855d219d11f374b53a5aa8e05cd6a65eef
2020-04-09 15:48:44 -07:00
Steven Moreland
90540ad53a Merge "Note selinux trans error happens in permissive." 2020-04-09 21:52:08 +00:00
Yifan Hong
559270448d Merge "BatteryMonitor: report current_now in uA" 2020-04-09 21:40:01 +00:00
Steven Moreland
9e987cbb1a Note selinux trans error happens in permissive.
There was an email thread about this recently, and I've been asked many
times.

For instance, if this error wasn't attributed, denials a service is
hitting would be attributed to init, and that's a recipe for disaster.
Secondarily, thinking about SELinux whenever you write a new service is
good.

Bug: N/A
Test: N/A
Change-Id: Ib9d2c5d8947375a0d4c33ecf3d075caef6b41f70
2020-04-09 12:48:46 -07:00
Tom Cherry
56cd920ff8 Merge changes If1a62a90,Ibce79cf1,Ia2bbf01a,I1763be56,I56762747, ...
* changes:
  logd: don't send logs before the start time on the first flushTo()
  Revert "logd: drop mSequence from LogBufferElement"
  Revert "logd: regression in handling watermark boundary."
  Revert "logd: logcat --clear respect pruneMargin"
  logd: wait for timeout via CLOCK_MONOTONIC
  Revert "logd: wakeup wrap timeout if realtime changes drastically"
  logd: do not attempt to sort log messages by time
2020-04-09 17:24:12 +00:00
Tom Cherry
65ab7fed70 logd: don't send logs before the start time on the first flushTo()
Logs in logd's buffer are not in time order.

If a client connects and requests logs from a given timestamp, we
start at the beginning of the buffer and find the first entry that has
happened since that timestamp and use its sequence number to flush
logs from.  This ensures that we get all logs accumulated in the
buffer since that time stamp and not just the most recent.

However there may be other logs in the buffer that happened before the
timestamp and have likely been already served to the client, therefore
we do not flush those.

We only do this for the first flush, since once we have flushed all of
the logs in the buffer, if another log comes in with a timestamp
earlier than the requested timestamp, it must be out of order and not
seen yet, since it is new even to logd.

Note! This is still broken.  There is a race that logs before the
timestamp may come in out of order since the last time the client
disconnected and before it reconnects.  The *only* solution to this
problem is that clients need to request logs after a given sequence
number.  That will be done as a separate liblog API change, while
these changes put in the ground work to make that possible.

Note 2: the security log implementation, which is one of the most
important users of this, already captures logs from seconds before the
last previous log to work around issues with timestamps.  That
workaround mitigates the above issue.

Test: logs work with logcat -t
Change-Id: If1a62a90c082d98c4cf2eb5c92ae3b7e89850cf2
2020-04-09 17:23:52 +00:00
Tom Cherry
10d086e26e Revert "logd: drop mSequence from LogBufferElement"
This reverts commit 5a34d6ea43.

There is a long standing bug that logd will leak memory during its
prune process if the time on the device changes significantly forwards
then backwards.  This is due to using the timestamp of each log
message to determine what log messages are yet to be processed by a
reader thread.

Various attempts have been made to rectify this, but the only solution
that safely fixes this issue is to go back to using sequence numbers
on the log messages.

Bug: 64675203
Bug: 77971811
Bug: 149340579
Bug: 150923384
Test: logcat output looks sane
Change-Id: Ibce79cf184eb29a4914f3e42a8cb2868d04dc165
2020-04-09 17:23:45 +00:00
Tom Cherry
7514558b81 Revert "logd: regression in handling watermark boundary."
This reverts commit 5836379b21.

Bug: 149340579
Test: logcat output looks sane
Change-Id: Ia2bbf01a20fec59b989d206a089d8e65062816ef
2020-04-09 17:23:34 +00:00
Tom Cherry
5e2665500f Revert "logd: logcat --clear respect pruneMargin"
This reverts commit 0878a7c167.

This is a partial revert of the above commit.  It simply removes
pruneMargin from these calculations since it is going away.

Bug: 149340579
Test: --clear works well
Change-Id: I1763be56fae7052058a800fad3b295c73cdcadf6
2020-04-09 17:22:25 +00:00
Steven Moreland
1ec8c39c3f Merge "init_kill_services_test: reboot device first." 2020-04-09 00:23:20 +00:00
Yifan Hong
e5bd5f914f BatteryMonitor: report current_now in uA
/sys/class/power_supply/*/current_now should return uA and the HAL
expects uA too.

Test: VtsHalHealthV2_0TargetTest
Bug: 136717180
Change-Id: I675be1ae645413b9494af4a5d49955aad5bd4f2e
2020-04-08 16:24:17 -07:00
Yurii Zubrytskyi
8d8f637ee5 [zip] Stop calculating crc if it's not checked
Crc calculation shows up in the profiler in 2-5% range, and is
never currently validated. Let's disable it for good.
For a well-compressible test data the difference is even nicer:

Benchmark                       Time          CPU        Iteration
------------------------------------------------------------------
ziparchive-benchmarks:
before:
  #ExtractEntry/2            1943244 ns    1926758 ns          375
  #ExtractEntry/16           1877295 ns    1867049 ns          375
  #ExtractEntry/1024         1888772 ns    1879976 ns          373
after:
  #ExtractEntry/2             817003 ns     812870 ns          874
  #ExtractEntry/16            814029 ns     809813 ns          875
  #ExtractEntry/1024          804904 ns     800972 ns          879

Bug: 153392568
Test: atest, manual
Change-Id: I917abecab01301f1d09a5bf3b542d24b3875e359
2020-04-08 13:55:54 -07:00
Steven Moreland
32876f356d init_kill_services_test: reboot device first.
This test is killing critical device services, and if it runs
repeatedly or some of the critical services have already died, it'll
force the device to reboot again and potentially consider the test a
failure.

This forces the test to reboot first, so that it is in a fresh state and
we can avoid this type of flake on the device.

Bug: 153444614
Test: atest init_kill_services_test
Change-Id: Ia81a319af1d209f58e70f824bb8eb7f11973637c
2020-04-08 20:23:18 +00:00
Christopher Ferris
e1948bf744 Merge "Avoid re-mapping dex file that's in local memory." 2020-04-08 19:27:25 +00:00
Tom Cherry
c9fa42c0b8 logd: wait for timeout via CLOCK_MONOTONIC
There are well known issues with CLOCK_REALTIME jumping drastically.

Test: --wrap works successfully
Change-Id: I5676274783ac9aa9374d2b9254e0109d883cc5a8
2020-04-08 12:20:06 -07:00
Tom Cherry
cda0ee3db0 Revert "logd: wakeup wrap timeout if realtime changes drastically"
This reverts commit 5e001776f4.

The next commit will use CLOCK_MONOTONIC for the timeout, so changes
to CLOCK_REALTIME will no longer be an issue.

Test: logcat output looks sane
Change-Id: I84e5b2db3c25ea6a7024557dba7fa6cc8c9237e5
2020-04-08 12:14:08 -07:00
Treehugger Robot
51abcc5633 Merge "first_stage_init: load modules in modules.load.recovery in recovery" 2020-04-08 17:41:09 +00:00
Tom Cherry
65abf3953e logd: do not attempt to sort log messages by time
Sorting does not work in all cases:
* It only sorts messages up to 5 seconds backwards in time
* CLOCK_REALTIME, which is used as the time that is sorted, can jump
  drastically
* Buffers are not sorted if there is a reader holding a region lock

Removing sorting entirely will give more consistent behavior from
logd.

Test: logcat still seems sane
Change-Id: I0923ab2fb377cda941c1e4972689df46f395ac99
2020-04-08 10:31:29 -07:00
Jiyong Park
937b4bf173 Set apex_available property
The marked library(ies) were available to the APEXes via the
hand-written whitelist in build/soong/apex/apex.go. Trying to remove the
whitelist by adding apex_available property to the Android.bp of the
libraries.

Bug: 150999716
Test: m
Change-Id: I8fd2a3c9b69454c6018c72f5198898bc90dc4d0d
2020-04-08 23:49:40 +09:00
Jiyong Park
e3d371e319 Set apex_available property
The marked library(ies) were available to the APEXes via the
hand-written whitelist in build/soong/apex/apex.go. Trying to remove the
whitelist by adding apex_available property to the Android.bp of the
libraries.

Bug: 150999716
Test: m
Change-Id: Id08058f3105463558c6c82298344a33af0efb2d3
2020-04-08 22:37:42 +09:00
Treehugger Robot
51de894ce4 Merge "Allow ExtractToMemory to accept an empty buffer for empty entries" 2020-04-08 04:06:41 +00:00
Sim Sun
273d3f08aa Avoid re-mapping dex file that's in local memory.
If the Dex file we're trying to examine is already within the unwinder's
address space, we don't need to load it from disk or copy it across
processes.

This avoids using up virtual address space to map in dex files, and
also should be a bit faster to read since it won't go out to the file.

Patch by Chris Sarbora

Test: Ran new unit tests.
Test: Ran 137-cfi art test.
Change-Id: I949457856f051cca11b9020e9da3a41bbf6e5c8e
2020-04-07 18:07:38 -07:00
Josh Gao
89cce05891 Merge changes from topic "adbd_lz4"
* changes:
  adb: add dry-run option to push/sync.
  adb: implement LZ4 compression.
  adb: fix use of wrong union variant.
  adb: fix front_size, front_data.
  adb: add interfaces for Encoder/Decoder.
2020-04-07 21:30:30 +00:00
Josh Gao
edd7771583 Merge "adb: add option to disable kill-server." 2020-04-07 20:36:47 +00:00
Elliott Hughes
a0c191867f Merge "Add missing static for macOS inline." 2020-04-07 19:43:29 +00:00
Tianjie
088c403e23 Allow ExtractToMemory to accept an empty buffer for empty entries
We don't actually need to extract the empty entries. Since the old
code support extracting the empty entry to a empty buffer, add the
support back in ExtractToMemory.

Bug: 153393683
Test: unittests pass

Change-Id: Idb9f0f4e6e4ffd4b44b80ddd3f54069bb7cedd7b
2020-04-07 12:25:16 -07:00
Nikita Ioffe
9cd3c84dc1 Merge "Manually unmount /data_mirror mounts in the right order" 2020-04-07 17:34:52 +00:00