Commit graph

57126 commits

Author SHA1 Message Date
Nikita Ioffe
a3be996673 Cleanup logic in KillZramBackingDevice
Since this function is used in userspace reboot, we need to be more
diligent with error handling, e.g.:

* If init fails to read /sys/block/zram0/backing_dev, then fail and
fallback to hard reboot.
* Always call swapoff.
* Always reset zram.
* Tear down loop device only if zram is backed by a loop device.

Test: adb reboot userspace
Bug: 153917129
Change-Id: I4709da1d08cf427ad9c898cfb2506b6a29f1d680
Merged-In: I4709da1d08cf427ad9c898cfb2506b6a29f1d680
(cherry picked from commit a840d405eb)
2020-04-17 12:28:25 +01:00
Josh Gao
10f8f5e363 Merge "adb: fix feature sets on devices that don't have them." 2020-04-17 04:43:16 +00:00
Josh Gao
fb4616b200 adb: fix feature sets on devices that don't have them.
Previously, we weren't distinguishing between nonexistent devices and
devices that don't support features, resulting in lots of stuff being
broken for pre-N devices.

Bug: http://b/154272158
Test: adb shell on a JB emulator
Change-Id: I0058b2a60678e1ad0503f5abac30157be976c9c4
2020-04-16 19:39:05 -07:00
Yifan Hong
7b28054c05 Merge "libsnapshot clients: Add missing dep." 2020-04-16 23:57:06 +00:00
David Srbecky
a17c2b694c Optimize Memory::ReadString
This function is responsible for majority of CPU time in prefetto.

Reduce the number of memory reads (don't read strings byte-by-byte).

Update all calls of ReadString to include the third parameter to have
a max read.

Add an Elf creation benchmark since this function is on the elf
creation path.

Test: libunwindstack_unit_test
Change-Id: Ia36e1f1a5ba76c9e9f13c43fb9e3691dde7897f2
2020-04-16 15:03:19 -07:00
Tom Cherry
6b76de04f7 Merge "liblog: return -EPERM if a log_is_loggable() returns false" 2020-04-16 20:13:04 +00:00
Yifan Hong
2dcca52457 libsnapshot: Add MockSnapshotManager and MockDeviceInfo.
For testing.

Bug: 153555889
Test: vts_libsnapshot_test
Test: update_engine_unittests
Change-Id: Id92f7372ef408625f2ef1120c99d0b4058ed488c
2020-04-16 13:12:41 -07:00
Yifan Hong
66f0115b05 libsnapshot clients: Add missing dep.
libsnapshot* uses update_metadata-protos. This
used to be optimized out, but now that SnapshotManager is
virtual, CreateUpdateSnapshots can no longer be optimized out.

Bug: 148956645
Test: compiles
Change-Id: Ib67cafd156308bf5a477996ec32eb786f8e896db
2020-04-16 13:12:41 -07:00
Yifan Hong
ee5032a436 libsnapshot: Add GetSnapshotMergeStatsInstance
This is preferred over SnapshotMergeStats::GetInstance because
the latter needs a concrete SnapshotManager, not the ISnapshotManager
interface.

SnapshotManagerStub::GetSnapshotMergeStatsInstance returns
a SnapshotMergeStatsStub instance.

Test: vts_libsnapshot_test
Bug: 148956645
Change-Id: Ife0ad6d3ce85333cbf395d07f74dedc9ca3fe675
2020-04-16 13:12:41 -07:00
Yifan Hong
fedb270908 libsnapshot: Add SnapshotManagerStub.
Avoid crashes in update_engine. When SnapshotManager
should not be used (e.g. Virtual A/B is not enabled),
use the stub instead.

Bug: 148956645
Test: update_engine_unittests
Change-Id: Id524a1dfe5d085d439fc5492d4b7f72ee583c17e
2020-04-16 13:12:41 -07:00
Yifan Hong
8129dda1f9 libsnapshot: Add ISnapshotManager.
This is the public interface of SnapshotManager.
SnapshotManager then inherits from it.

Test: compiles
Test: vts_libsnapshot_test
Test: update_engine_unittests
Bug: 148956645
Bug: 153555889
Change-Id: Ib19c038f9bb41dd8d27f72ff6a24c231cd4c5a76
2020-04-16 13:12:41 -07:00
Tom Cherry
1ff17fcebb liblog: return -EPERM if a log_is_loggable() returns false
This was the previous behavior, so retain it.

Bug: 119867234
Test: logging unit tests
Change-Id: I088f760cc274a4a42d72477eb4e2e8d23c613a8a
2020-04-16 12:55:30 -07:00
Treehugger Robot
8c6d5bf83c Merge "Re-enable libsnapshot ImageManagerTest" 2020-04-16 17:20:41 +00:00
David Srbecky
af41960acb Create minimal remap table for symbol binary search.
ELF symbols are not sorted by address. Create remap table
which reshuffles the indices into sorted-by-address order.

This saves over 6x of memory (the remap table needs just
uint32_t per entry, as opposed the FuncInfo cache entry).

ART symbols are sorted.  Make use of that fact.

Bug: 110133331
Test: libunwindstack_test
Test: art/test.py -b --host -r -t 137-cfi
Change-Id: I1812d2dd3ad6a69ae93ed50ca387749c649289b9
2020-04-16 18:17:45 +01:00
Tom Cherry
f0dafccb38 Merge "liblog: cleanup log_read.h header" 2020-04-16 15:19:29 +00:00
Martijn Coenen
f0122aa14d Merge "Rename external storage properties." 2020-04-16 08:06:52 +00:00
Peter Collingbourne
c71e0a652c libunwindstack: Add Memory::ReadTag() function for reading memory tags.
This uses an experimental Linux kernel API for reading the tags across
processes using ptrace.

Bug: 135772972

Test: Unit tests pass.
Change-Id: Ib1a09d9219166011de80cf250b756bb8a4bcdb0a
2020-04-16 00:23:45 -07:00
Tianjie Xu
585ff01946 Merge "Handle the invalid timestamp in zipfile" 2020-04-16 04:33:35 +00:00
Christopher Ferris
9be6d30cc0 Merge "Add benchmarks for symbol reading." 2020-04-16 01:25:29 +00:00
Alessio Balsini
42a608162d Re-enable libsnapshot ImageManagerTest
ImageManagerTest had been temporarily disabled because flaky.
This test looks stable now, re-enable it.

Bug: 148889015
Test: atest vts_libsnapshot_test [-- --abi x86]
Signed-off-by: Alessio Balsini <balsini@google.com>
Change-Id: I858661fed7f58d1e2857ed88f5d8e0f5220bf8c2
2020-04-16 00:11:55 +00:00
Treehugger Robot
8fbb0d8de0 Merge "macOS build fix: no SOCK_CLOEXEC on darwin." 2020-04-15 23:38:53 +00:00
Tianjie
426bf3a1f1 Handle the invalid timestamp in zipfile
The month field is one based in the zipfile modification time. And
it causes an overflow converting it to struct tm. Switch to type to
signed integer to suppress the sub-overflow.

Bug: 153882979
Test: parse the problematic zipfile
Change-Id: Iaf47bcc7f83d61b18c9e7a98bb6ab3936c9257e3
2020-04-15 16:32:42 -07:00
Treehugger Robot
a010dd7b50 Merge "Documented range of event logtags used by Android Automotive." 2020-04-15 23:22:28 +00:00
David Anderson
0bd13b7be9 Merge "libsnapshot: Add a simple script and gtest to simulate power failures during snapshot-merge." 2020-04-15 22:51:20 +00:00
Treehugger Robot
63f2be8f56 Merge "macOS build fix: no off64_t on darwin." 2020-04-15 22:24:03 +00:00
Felipe Leme
76024d755a Documented range of event logtags used by Android Automotive.
Test: N/A
Bug: 153900032

Change-Id: I2e35d56f89becea33c4a4b7fb6af8de3ccbb087a
2020-04-15 14:40:21 -07:00
Elliott Hughes
cbe30fb952 macOS build fix: no SOCK_CLOEXEC on darwin.
We can't use the sysdeps.h copy of this code, so for now add yet
another copy & paste. We should come up with something better in
libbase, but let's get the macOS build fixed first.

Test: builds on mac
Change-Id: Ifb059990d7091f3d91b54e684f4ee14afe69c28b
2020-04-15 21:28:01 +00:00
Christopher Ferris
a9e19097ed Add benchmarks for symbol reading.
Add a number of benchmarks to time how long it takes to look
up symbols.

Test: Ran benchmarks on device.
Change-Id: Iab7aab3f60c2c7056395beca3d36263420bcb5dc
2020-04-15 14:03:21 -07:00
Treehugger Robot
00c2625fd1 Merge "first_stage_init: add hook to exec a shell script" 2020-04-15 19:56:56 +00:00
Treehugger Robot
0919f10fa2 Merge "first_stage_init: increase serial console tries to 50" 2020-04-15 18:47:56 +00:00
Steve Muckle
a4bf2cee04 first_stage_init: add hook to exec a shell script
If the first stage console is being used, attempt to run /first_stage.sh
immediately before the console is created.

Bug: 154126020
Change-Id: I8b7431e7b8219afea295b120d7ea91751804bda6
2020-04-15 10:59:30 -07:00
Will McVicker
c4793572f3 first_stage_init: increase serial console tries to 50
tl,dr;
Increase the attempts to 50 to reduce the chances of failing
to load the serial console. This will only happen if the cmdline
parameter "androidboot.first_stage_console=1" is enabled.

Details:
10 attempts only amounts to about 1 second of trying to open the serial
console. I tested booting an ACK GKI image 5x with 20 vendor modules and
found the serial console loaded on attempt 17 for all five boot
tests.

Bug: 153354917
Test: boot ACK image 5x and verify serial console comes up
Change-Id: I161a4176b2c6cf7b0bc1eefe072ff38b894add5d
Merged-In: I161a4176b2c6cf7b0bc1eefe072ff38b894add5d
2020-04-15 10:57:46 -07:00
Treehugger Robot
0b708cba86 Merge "Remove host_supported from libadb_pairing_server." 2020-04-15 17:16:28 +00:00
David Anderson
f3c8e3036c Merge "fs_mgr: Fix executable path in clean_scratch_files." 2020-04-15 16:35:31 +00:00
Martijn Coenen
ea751d94dd Rename external storage properties.
According to property naming guidelines.

Bug: 152170470
Bug: 153525566
Test: N/A
Change-Id: Ia5ce2a95e43724f8d0a7abf6782bc177dedb18a8
2020-04-15 17:32:28 +02:00
Joshua Duong
5e32d2f8de Remove host_supported from libadb_pairing_server.
To fix mac build error. Shouldn't be building this for the host.

Bug: N/A

Test: mma in system/core/adb on mac.
Change-Id: I8b86d265ef9b91eeaf7a4e5d6623a5399403ecaf
2020-04-15 06:53:38 +00:00
David Anderson
a441612fae fs_mgr: Fix executable path in clean_scratch_files.
Bug: 154071877
Test: no error log on startup
Change-Id: I84c627011992eed6952697e7260051006b1c10d0
2020-04-14 23:47:38 -07:00
David Anderson
f4d58b483e libsnapshot: Add a simple script and gtest to simulate power failures during snapshot-merge.
This test is pretty straight forward: create two large files, then merge
one into the other while injecting kernel crashes. At the end,
block-by-block validation is performed against both the snapshot-merge target
and the file written to disk.

Bug: 139092356
Test: instructions in PowerTest.md
Change-Id: I28cc88160cf824039966abff4e61382090a354c5
2020-04-14 23:32:38 -07:00
Treehugger Robot
8b4ed5f6b6 Merge "macOS build fix: don't build libadbconnection." 2020-04-15 02:12:09 +00:00
Kenny Root
0a1670ab15 Merge "Use <fqname> to avoid conflicts" 2020-04-15 00:44:49 +00:00
Elliott Hughes
729f58e0b7 macOS build fix: don't build libadbconnection.
Test: builds on mac
Change-Id: I91e3bf6b06f31edf542f8f8d6529787b0bf3a6ed
2020-04-14 16:33:16 -07:00
Elliott Hughes
7d9a7a3b6e macOS build fix: no off64_t on darwin.
Darwin has always had a 64-bit off_t, and never added an off64_t.

Test: builds on mac
Change-Id: I4b244dda94c67da76c9e0f47b333c2734f5a94af
2020-04-14 15:34:01 -07:00
Nikita Ioffe
9c898802ed Merge "Add RootTargetPreparer for CtsInitTestCases and CtsFsMgrTestCases" 2020-04-14 21:53:50 +00:00
Kenny Root
15351dcf60 Use <fqname> to avoid conflicts
The newer way of specifying the interface is using <fqname> and it also
has the handy side-effect of not causing conflicts when we add the
strongbox implementation to devices.

Test: make # check $OUT for the correct manifest
Change-Id: If8333814723261c4f3de375861ee19a6d922d55f
2020-04-14 14:37:24 -07:00
Tianjie Xu
83208f0833 Merge "Fix the boundary check when parsing sizes in zip64 extended field" 2020-04-14 21:03:45 +00:00
Tianjie
d9bc8fd639 Fix the boundary check when parsing sizes in zip64 extended field
We should check if the data to read resides within the boundary of
the extended field. Also check OOB when reading bytes from the
zipfile.

Bug: 153828925
Test: parse the poc with hwasan build
Change-Id: I54b58a287b9ae4ca0e5cc563086c1ed8051fb72a
2020-04-14 11:26:42 -07:00
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
Tom Cherry
715a58e24d liblog: cleanup log_read.h header
There's no need to pull in <fcntl.h> to get O_NONBLOCK, since the
ANDROID_LOG_* macros are better standalone.

Also note that 0x00000003 should be reserved since these corresponded
to previously used values.

Test: build
Change-Id: Icaee6ee0250fe97d8324b3b340f7e196767b2711
2020-04-14 08:59:41 -07: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