Commit graph

44544 commits

Author SHA1 Message Date
David Anderson
0664f31dd0 Create /metadata/password_slots during boot.
This directory is used to store the Weaver/GateKeeper slot map so GSIs
do not overwrite host keys in secure storage.

Bug: 123716647
Test: /metadata/password_slots exists after boot
Change-Id: Ib0ca13edec38e68cba1fc2124465571feedc4be7
2019-03-05 22:18:14 -08:00
Treehugger Robot
924eec9518 Merge "libmeminfo: librank optimization using maps instead of vectors" 2019-03-02 03:58:28 +00:00
David Anderson
42294631a7 Merge "Fix double-accounting bug in liblp." 2019-03-02 03:16:10 +00:00
David Anderson
88e36c1514 Fix double-accounting bug in liblp.
When flashing in fastbootd, we create a new MetadataBuilder using the
given super_empty.img and attempt to import the existing partition
table. This will fail if there is some incompatibility in the partition
layout or partition quotas.

This import code was accidentally double-accounting partitions when
determining if they could fit within the group quota, preventing
"fastboot flashall" once partitions reached a certain size.

Bug: 126930319
Test: liblp_test gtest
Change-Id: I89a69cba110b62719197c9a4885cfc5bcf8f009f
2019-03-01 16:17:27 -08:00
Erick Reyes
5a744684c3 libmeminfo: librank optimization using maps instead of vectors
librank was calling std::vector::find_if in nested loops when iterating
through processes and maps.

Changed the implementation to use std::map::insert, this resulted in
a significant improvement to execution speed.

Test: time librank on crosshatch

Before:  1m22.57s real     1m15.87s user     0m05.79s system
After:   0m03.85s real     0m00.88s user     0m02.92s system

Bug: 124523194

Change-Id: I2b519d0bfd7f7929c6c4c6c2374794cb1a744585
Signed-off-by: Erick Reyes <erickreyes@google.com>
2019-03-01 16:17:20 -08:00
David Anderson
b1f97f9d1b Merge "Remove the block size alignment restriction." 2019-03-01 22:48:25 +00:00
Treehugger Robot
8dcd839158 Merge "Reduce log spam from libprocessgroup" 2019-03-01 22:11:15 +00:00
Suren Baghdasaryan
6ad4eb3519 Merge "libprocessgroup: convert Json::Value to const refs" 2019-03-01 18:02:22 +00:00
Suren Baghdasaryan
3af39f36cc Merge "Add vendor cgroups and task_profiles support" 2019-03-01 18:01:39 +00:00
David Anderson
47f7420366 Remove the block size alignment restriction.
Rather than require block-size alignment, instead bump the requested
file size to the necessary alignment. This ensures that the final block
is usable without placing onerous restrictions on the caller to figure
out the file system's block size.

This will require callers (namely, gsid) to track the actual desired
image size separately from the flie size.

This patch also updates tests to use the actual filesize of the
filesystem, rather than hardcoded 4096.

Bug: 126230649
Test: fiemap_writer_test gtest
Change-Id: I000cca274718c3ceac526d7c3392fe3a23bb42bc
2019-03-01 09:52:52 -08:00
Mark Salyzyn
8da7a1e6fd Merge "bootstat: add salyzyn as owner" 2019-03-01 17:48:56 +00:00
Treehugger Robot
c8964edb7e Merge "fs_mgr: fix fs_mgr avb_keys parsing problem" 2019-03-01 15:31:47 +00:00
Josh Gao
b530537d46 Merge "adbd: fix a case where we can fail to join a thread." 2019-03-01 10:16:46 +00:00
Josh Gao
7669ea5a44 Merge changes I4d351f56,Ib9e91157
* changes:
  adbd: tune USB read/write sizes and queue depths.
  adb: add benchmarks for sink/source.
2019-03-01 10:15:54 +00:00
Dima Zavin
83d9b680f5 Merge changes Ia3bba21c,I0ffc159b
* changes:
  fastboot: reset timeout if INFO is received during long commands
  fastboot: switch the timeout clock source to steady_clock
2019-03-01 10:12:39 +00:00
Suren Baghdasaryan
e681df44eb libprocessgroup: convert Json::Value to const refs
Convert Json::Value to const refs to prevent creation of a null member
if specified element does not exist. Fix variable naming in the parser
while we are at it.

Change-Id: I7dabfd1c73983b465984dd6c411c9fe48743a348
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-03-01 00:29:49 +00:00
Suren Baghdasaryan
05da67c390 Add vendor cgroups and task_profiles support
Vendors should be able to specify additional cgroups and task profiles
without changing system files. Add support for /vendor/etc/cgroups.json
and /vendor/etc/task_profiles.json files which will augment cgroups and
task profiles specified in /etc/cgroups.json and /etc/task_profiles.json
system files.

Bug: 124960615
Change-Id: I548c2e866b65c19856a3617d75b75dcd06f7d5b7
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-03-01 00:29:37 +00:00
Josh Gao
5841a96afc adbd: tune USB read/write sizes and queue depths.
Reduce the operation sizes to sizes that are small enough that the
kernel will run the OOM killer to try to make them succeed. Compensate
for the smaller operation sizes by increasing the queue depth.

Bug: http://b/126582877
Test: benchmark_device.py
Change-Id: I4d351f56c8f83fea882614238cc3fec8ba1e9bf9
2019-02-28 15:53:48 -08:00
Josh Gao
b416f2252e adb: add benchmarks for sink/source.
Test: ./benchmark_device.py
Change-Id: Ib9e911574be3afa94efcfd9bc5be0a5cf7b9e2c0
2019-02-28 15:53:48 -08:00
Dima Zavin
6d46a4975e fastboot: reset timeout if INFO is received during long commands
As part of a refactor, commit db511207ed
added a timeout for receving responses for commands. Unfortunately,
the timeout is optimistic as to how quickly target devices can complete
such operations. Flash and erase commands can be quite slow on devices
with traditional flash chips. The fastboot protocol is already adept
at handling such cases because it allows for sending INFO packets during
these periods. We may receive one or more INFO packets during tehse long
operations. Every time we receive an INFO packet, it proves the remote
end is alive, but busy, which should reset our timeout timer.

Change-Id: Ia3bba21c497b22639b626d89711ecd4eb02504ed
Signed-off-by: Dima Zavin <dmitriyz@waymo.com>
2019-02-28 14:55:49 -08:00
Dima Zavin
a5b85a431e fastboot: switch the timeout clock source to steady_clock
Previously, system_clock was used for remote command timeouts
which can get disturbed by NTP adjustments (jumps).

Change-Id: I0ffc159bf34d12e8d3713044524114d60a6a45ca
Signed-off-by: Dima Zavin <dmitriyz@waymo.com>
2019-02-28 14:55:48 -08:00
Mark Salyzyn
fe85df1c0d bootstat: add salyzyn as owner
Test: none
Change-Id: I1d8874dfb5cc9efaed5ad85702a054f1c2a7766f
2019-02-28 14:10:34 -08:00
Josh Gao
e778b3ad71 adbd: fix a case where we can fail to join a thread.
Bug: http://b/126703621
Change-Id: I3061d24bbdc154ebf1f9e3f5a903f01382fa518f
2019-02-28 13:53:24 -08:00
Treehugger Robot
949a561cfa Merge "libfs_avb: Pass const string by reference" 2019-02-28 18:53:27 +00:00
Treehugger Robot
51eba0944a Merge "Unify some text format in task_profiles.json" 2019-02-28 15:15:20 +00:00
Greg Kaiser
4d6f4cc4fe libfs_avb: Pass const string by reference
Minor performance improvement for ValidatePublicKeyBlob().

Test: TreeHugger
Change-Id: I3498b529abedb8169d2488a2dc04cbd42cdb6f7d
2019-02-28 06:34:25 -08:00
Josh Gao
50cb647e7d Merge "adbd: limit the sizes of aio writes." 2019-02-28 07:25:21 +00:00
Bowgo Tsai
d214b40685 fs_mgr: fix fs_mgr avb_keys parsing problem
We should check if the fs_mgr option starts with "avb_keys" before
"avb". Otherwise, it will treat "avb_keys" as "avb" fs_mgr option.

Bug: 112103720
Test: atest fs_mgr_unit_test

Change-Id: I88446222fa88e8ecfcd6f96d30ad4336ebe146a8
2019-02-28 10:37:37 +08:00
Treehugger Robot
33f344cb36 Merge "libfs_avb: support key rotation for standalone partitions" 2019-02-28 01:13:20 +00:00
Josh Gao
86b33be035 adbd: limit the sizes of aio writes.
The kernel does a kmalloc of the write size for each write during
io_submit, which can lead to failure if the kernel's heap is fragmented
such that it can't allocate a contiguous 1MB chunk. Partition writes
into 16 page chunks which are much more likely to succeed.

Bug: http://b/126582877
Test: test_device.py
Change-Id: Ib2d48561594e1d81f1a2f62e34eaa40265ac47c4
2019-02-27 15:45:59 -08:00
Treehugger Robot
c620f4a1b8 Merge changes I7a2dd830,I6ce43725,I5fc2f370,Ibc2e14bd,Idf213800, ...
* changes:
  fs_mgr_remount: support legacy devices (marlin)
  fs_mgr: remount: add -R argument
  fs_mgr: remount: add -T fstab argument
  fs_mgr: remount: log to stderr and logd
  fs_mgr: add remount command
  fs_mgr: overlayfs: test: add inRecovery check
2019-02-27 23:14:43 +00:00
Mark Salyzyn
4469fb1c06 fs_mgr_remount: support legacy devices (marlin)
Deal with first version of verity for legacy products.

Test: system/core/fs_mgr/tests/adb-remount-test.sh
Bug: 120448575
Bug: 123079041
Change-Id: I7a2dd8309cbb19751fdbb05d4efc30c486615e04
2019-02-27 13:03:13 -08:00
Mark Salyzyn
1188ce4e1d fs_mgr: remount: add -R argument
The -R flag tells remount it can reboot to disable verity or to
run fsck on an ext4 deduped filesystem, or both.

Testing may include a manual component because adb-remount-test.sh
needs to run from a device in an enable-verity state to test this.

Only recognizes chained avb.

Test: adb-remount-test.sh
Bug: 122602260
Change-Id: I6ce4372532d9b933dcca9e2bec544d525b76c4d9
2019-02-27 13:03:13 -08:00
Mark Salyzyn
8c07db6a6b fs_mgr: remount: add -T fstab argument
Allow selection of an fstab file.  This is to mirror the built-in
functionality associated with init mount_all <fstab> command.

Test: adb-remount-test.sh
Bug: 122602260
Change-Id: I5fc2f3707c1dafd687c826eaccbaab03a408035b
2019-02-27 13:03:13 -08:00
Mark Salyzyn
75941f2c9c fs_mgr: remount: log to stderr and logd
Logging normally goes to stderr, also send output redirected to the
Android Logger.  Required if command is exec'd, useful if commanded
from shell.

Test: manual confirmation of both outputs.
Bug: 122602260
Change-Id: Ibc2e14bd4fad561514c0c33741da8ca6f00af3f3
2019-02-27 13:03:13 -08:00
Mark Salyzyn
6b3f587ac7 fs_mgr: add remount command
There is currently no good option for callers to setup overlayfs
on-device, it is automated as part of the adb services.  Add a
remount command that does what is needed that simulates the salient
behaviors of the adb remount command.

Clean up some noise restoring device to original state when done.

Test: adb-remount-test.sh
Bug: 122602260
Change-Id: Idf213800a8182cb1c51600c8f574df8a8cd68d4a
2019-02-27 13:03:13 -08:00
Mark Salyzyn
6dc0dfe785 fs_mgr: overlayfs: test: add inRecovery check
Handle a device in recovery mode gracefully.  Handle a device
that fails to boot into a commanded state more gracefully.

Deal with regression where die() calls restore(), and we can not
have this under the conditions where we are ignoring the error
in a subshell.

Test: adb-remount-test.sh
Bug: 118225373
Bug: 123079041
Change-Id: Ie37beb245d0ec55eb00757cdb93da34ff9c42827
2019-02-27 13:03:08 -08:00
David Anderson
2c32a6cf24 Merge "libfiemap_writer: Allow callers to query the block device of a file." 2019-02-27 19:48:14 +00:00
Dario Freni
455f12446e Merge "Support splitAPK in install-multi-package." 2019-02-27 19:00:14 +00:00
Rick Yiu
e9d149fd7e Unify some text format in task_profiles.json
Bug: 111307099
Test: cgroup function is normal
Change-Id: Id992b875720ff67a5d1a2b052072ee7ea7b16a9a
2019-02-27 21:08:19 +08:00
Treehugger Robot
d5345f58fd Merge "Add blkio cgroup to libprocessgroup" 2019-02-27 13:04:00 +00:00
Treehugger Robot
55d36240dc Merge "Fix string reference usage" 2019-02-27 11:04:30 +00:00
Wei Wang
1770566de6 Fix string reference usage
Bug: 124774415
Test: Build
Change-Id: Ic0e5ee4f3375c2fa21fbc2ce3796b7368e9e289c
2019-02-27 06:04:13 +00:00
Bowgo Tsai
f3e28e1682 libfs_avb: support key rotation for standalone partitions
The FstabEntry.avb_key is renamed to FstabEntry.avb_keys, to
allow specifying multiple avb keys, separated by ':'
(because ',' is already used by fstab parsing).

Bug: 124013032
Test: boot live GSI with multiple allowed AVB keys
Change-Id: Iacd3472a1d5a659dfecf09ea6074d622658f4d0b
2019-02-27 04:13:21 +00:00
Rick Yiu
2b3bf84373 Add blkio cgroup to libprocessgroup
To differentiate IO priority for different groups.

Bug: 111422845
Bug: 117857342
Test: tasks are assigned to the group as expected
Change-Id: Ibb108d1b8e0f720f7ac4cab248b3c33d35e5483d
2019-02-27 11:23:14 +08:00
Treehugger Robot
df3f38f6c9 Merge "fs_mgr: overlayfs: requires override_creds patch for 4.4+ kernels (taimen)" 2019-02-27 01:18:23 +00:00
Elliott Hughes
bc94667e8e Merge "Add test_suites to libutils_test." 2019-02-26 22:31:26 +00:00
Josh Gao
c2970282cb Merge "Revert "adbd: switch the default USB implementation."" 2019-02-26 22:15:40 +00:00
Josh Gao
0d780391a1 Revert "adbd: switch the default USB implementation."
This reverts commit 12f328489b.

Reason for revert: possibly causing b/126388431

Change-Id: Ida7c30a92f552f923f3bcb153d945d58ebbc4257
2019-02-26 22:10:33 +00:00
Josh Gao
216d158daf Merge changes I86c3ec0f,I57d1a30a,Ib50d289b,I791a4f82,I316a8799, ...
* changes:
  adb: switch sockets.cpp to ConsumePrefix.
  adbd: switch abb to ConsumePrefix.
  adb: increment server version.
  adb: wait for device to disconnect upon `adb root`.
  adb: implement wait-for-disconnect.
  adb: tell the client what transport it received.
  adbd: switch daemon/services to ConsumePrefix.
  adb: switch host_service_to_socket to string_view.
  adb: switch handle_host_request to string_view.
  adb: switch adb_io.h to string_view.
  adb: add helper to consume a prefix on a string_view.
  adb: make ParseUint reject garbage at the end by default.
2019-02-26 20:55:19 +00:00