Commit graph

58913 commits

Author SHA1 Message Date
Greg Kaiser
8ad3957d76 libsnapshot: Fix uninitialized variables
We fix two separate instances of classes not initializing members
in their constructors.

Test: TreeHugger
Change-Id: If1b7a7625572c9b005f9b8331b282ed11ceb6e97
2020-08-27 08:09:14 -07:00
Gavin Corkery
c0d11aa73a Merge "Store userspace reboot info in /metadata" 2020-08-26 21:47:19 +00:00
Treehugger Robot
58c10b7730 Merge "libsnapshot: Off-line tool for converting OTA payloads to COWs." 2020-08-26 19:59:31 +00:00
David Anderson
ad35dcc5b8 libsnapshot: Off-line tool for converting OTA payloads to COWs.
The A/B version of this tool takes in a payload.bin file (from an OTA
package), and converts it into COWs in the new format. It uses the
CowWriter API to do this. This tool can be used to precisely see the
size of a COW relative to an OTA. Since there is one COW per partition,
it also takes an output folder:

    make_cow_from_ab_ota payload.bin ./ota-cows/

If the payload is incremental, a source target-files package is needed.
It must be the exact package used to build the OTA, otherwise, the
conversion is likely to fail. Example:

    make_cow_from_ab_ota -source_tf target-files-XYZ.zip \
                         payload.bin ./ota-cows/

Bug: 162274240
Test: manual tests
Change-Id: I8cb1554e71384625c8073f1c351a976b5ae00a36
2020-08-26 11:39:01 -07:00
Ankit Goyal
77ea69e9a7 Merge "Revert "libsnapshot: Off-line tool for converting OTA payloads t..."" 2020-08-26 07:24:08 +00:00
Ankit Goyal
4dd34114de Revert "libsnapshot: Off-line tool for converting OTA payloads t..."
Revert submission 1405248-vab-offline-cow

Reason for revert: Reason for revert: Droidcop-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?branch=git_master-without-vendor&target=sdk_mac&lkgb=6790614&lkbb=6791107&fkbb=6791107, bug 166383275
Reverted Changes:
If8a1bbf99:Expose extent_ranges for libsnapshot to use in res...
I22c86546f:libsnapshot: Off-line tool for converting OTA payl...

Change-Id: I7f85fb24a350c610d0837886716c22c2742ab144
2020-08-26 07:01:26 +00:00
Treehugger Robot
35d0ddbc8e Merge "Assume UNSUPPORTED if the battery capacity level sysfs node does not exist." 2020-08-26 00:01:03 +00:00
Treehugger Robot
909219ccc2 Merge "Fix API for C compatibility" am: 6f3e974ab5
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1408797

Change-Id: I0aaa7ab7ceb9e0397fdd18b4802d8239e39ad174
2020-08-24 20:27:10 +00:00
Treehugger Robot
6f3e974ab5 Merge "Fix API for C compatibility" 2020-08-24 19:49:37 +00:00
Christopher Ferris
7efed535c8 Merge "libunwindstack: don't save pseudoregisters while evaluating Dwarf" am: e5c9bbd453
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1403667

Change-Id: I8b25673da5b71fd3f40f34acaa6a78cae2bbe14f
2020-08-24 18:27:55 +00:00
Christopher Ferris
e5c9bbd453 Merge "libunwindstack: don't save pseudoregisters while evaluating Dwarf" 2020-08-24 17:40:56 +00:00
Greg Kaiser
b473061c5a Fix API for C compatibility
In https://android-review.googlesource.com/c/platform/system/core/+/1224544
when we introduced a default argument to androidSetThreadPriority(),
we broke C compatibility with this API, and with the header file
in general.

We fix this up by instead introducing a new method that takes
three arguments.  This gets this header file compiling for C again,
and keeps this particular API C compatible.

Any C++ callers of the three argument version of
androidSetThreadPriority() will need to switch to using
androidSetThreadPriorityAndPolicy().  Although since this was
a recent change, we believe there is only one such user, which
we are fixing at the same time.

Test: TreeHugger
Bug: 165009705
Merged-In: Iab0b7e6c91a8e32a17ba1b186fd0c2fe96b601e4
Change-Id: Iab0b7e6c91a8e32a17ba1b186fd0c2fe96b601e4
2020-08-24 17:29:25 +00:00
David Anderson
6eab53e0e7 Merge "libsnapshot: Off-line tool for converting OTA payloads to COWs." am: 5b940dc7f9
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1405248

Change-Id: I8416a633114ab35102d7a1a626598dfe28091fa8
2020-08-21 23:15:46 +00:00
David Anderson
5b940dc7f9 Merge "libsnapshot: Off-line tool for converting OTA payloads to COWs." 2020-08-21 23:05:36 +00:00
Treehugger Robot
56a0602e4a Merge "Allow shell to write to /sdcard/Android/data and /sdcard/Android/obb." am: 0297fef2f9
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1404487

Change-Id: I1d0223b551f1444e7259459982cfcdc034004904
2020-08-21 22:57:39 +00:00
Treehugger Robot
0297fef2f9 Merge "Allow shell to write to /sdcard/Android/data and /sdcard/Android/obb." 2020-08-21 22:25:37 +00:00
Elliott Hughes
d40cb2ae55 Merge "Fix logd's implicit dependency on libsysutils." am: ad0614b855
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1407074

Change-Id: I94e78d01b18030942b5c3c84cdf06646afb93fd5
2020-08-21 20:52:52 +00:00
Elliott Hughes
ad0614b855 Merge "Fix logd's implicit dependency on libsysutils." 2020-08-21 20:31:07 +00:00
Elliott Hughes
6998894440 Merge "libcrypto_utils: switch to C++." am: 73bfaa2745
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1407076

Change-Id: Ibc774502d31d1d0e725e6dc5aaa72e96a6a85373
2020-08-21 19:38:22 +00:00
Elliott Hughes
73bfaa2745 Merge "libcrypto_utils: switch to C++." 2020-08-21 19:23:15 +00:00
Marco Ballesio
ff0a789f8f Merge changes from topic "cgroup v2 freezer" am: 8b0b53a913
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1407073

Change-Id: I1a092f58c8ec513cc29cdda6a07c0d7cc10426ee
2020-08-21 18:51:27 +00:00
Marco Ballesio
8b0b53a913 Merge changes from topic "cgroup v2 freezer"
* changes:
  init.rc: remove initializations to cg2_bpf path
  libprocessgroup: json prototype for cgroups v2
  libprocessgroup: switch freezer to cgroup v2
  freezer: allow dynamic changes to freezer.state
2020-08-21 18:41:11 +00:00
Elliott Hughes
91784040db libcrypto_utils: switch to C++.
brillo is long gone, so no one should care about being C any more, and
this will let future janitorial work take advantage of RAII.

Test: treehugger
Change-Id: I06acd01e8b30247bed6e971ab3e8660d3e599cce
2020-08-21 10:34:56 -07:00
Gavin Corkery
8c92256df5 Store userspace reboot info in /metadata
Store pertinent information about userspace reboot events in the case
of failure. This information is any services which failed to stop
cleanly, the output of the default fstab and /proc/mounts, and
a list of mounts which failed to unmount. This information is only
stored as necessary (i.e. mount information will not be stored if
everything unmounted, even if some services failed to stop).

Added new /metadata/userspacereboot directory to persist this
information. Information older than 3 days will be deleted.

Test: adb reboot userspace with sigterm/sigkill timeouts set to
      very low values
Test: Manual test of storing all other information
Bug: 151820675
Change-Id: I6cfbfae92a7fc6f6c984475cad2c50c559924866
2020-08-21 17:32:34 +01:00
Marco Ballesio
fdc03350f4 init.rc: remove initializations to cg2_bpf path
https://r.android.com/c/1324649/5 moves the cgroup folder to its sysfs
path. Directory access rights are defined by kernel code and sepolicy,
so remove the initialization lines from init.rc.

Test: manually booted the device and verified access rights for
/sys/fs/cgroup
Bug: 154548692

Change-Id: I67284dc651ed529cae69e413b66c6e1292a2d970
2020-08-21 09:18:58 -07:00
Treehugger Robot
9dc6804d96 Merge "libcrypto_utils: Use accessors to manipulate RSA keys." am: cdfef7fe9e
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1405369

Change-Id: I2bd01de4f23ce1fd29b20587fd793fac13a34788
2020-08-21 16:02:42 +00:00
Treehugger Robot
cdfef7fe9e Merge "libcrypto_utils: Use accessors to manipulate RSA keys." 2020-08-21 15:49:09 +00:00
Treehugger Robot
6263c29cb1 Merge "Add systrace tag for system property" am: 59ca901218
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1404427

Change-Id: I983e217ec9c608b53fd0bf1489c70e156f55f361
2020-08-21 10:06:14 +00:00
Treehugger Robot
59ca901218 Merge "Add systrace tag for system property" 2020-08-21 09:33:53 +00:00
Yo Chiang
6b1a164e58 Merge "Improve ImageManager error message" am: 5ca85a05e3
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1404667

Change-Id: I5ea2586e32af118978446a42a5d801ca763a419a
2020-08-21 08:39:39 +00:00
Yo Chiang
5ca85a05e3 Merge "Improve ImageManager error message" 2020-08-21 08:01:21 +00:00
Marco Ballesio
43050baa7f libprocessgroup: json prototype for cgroups v2
cgroups v2 support introduces new fields in the json format. Adapt the
proto file accordingly

Bug: 154548692
Test: atest libprocessgroup_proto_test --
Change-Id: I40f8757a8f4e6a0b839caa7faa976dfebf3aac98
2020-08-20 15:53:48 -07:00
Elliott Hughes
0fe3b67024 Fix logd's implicit dependency on libsysutils.
We're trying to remove the implicit dependency on libsysutils that *all*
code has via the symlink in system/core/include/, but netd and logd have
code that #includes the headers without declaring the dependency (which
works out in the end because their executables declare the dependency).

Bug: http://b/165825252
Test: treehugger
Change-Id: I8c582e427d9dbe7d9f8172c445f38ae2737a9049
2020-08-20 15:40:57 -07:00
Marco Ballesio
1c755e22c8 libprocessgroup: switch freezer to cgroup v2
remove cgroup v1 freezer entries from init.rc, add a new cgroup v2
controller and modify plists to properly interact with it.

Bug: 154548692
Test: manually verified the the cgroup v1 freezer controller isn't
created and a new controller for cgroup v2 is created under the correct
sysfs directory.

Change-Id: I1b811300ade486f88fdbd157255a7f37750cc54d
2020-08-20 15:11:41 -07:00
Yo Chiang
792650d4e4 Merge "TranformFstabForDsu adds missing partition entries to fstab" am: 36a21704e0
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1404428

Change-Id: I0f202009cd662e94b2aa4e966568255716384571
2020-08-20 07:04:43 +00:00
Yo Chiang
36a21704e0 Merge "TranformFstabForDsu adds missing partition entries to fstab" 2020-08-20 06:38:44 +00:00
David Anderson
00138ea64f Merge "Initial prototype of COW format and API." am: 34dda54411
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1378463

Change-Id: Icf966adfe58d647ca6ec56c85448ed05960d4c2a
2020-08-19 23:25:03 +00:00
David Anderson
34dda54411 Merge "Initial prototype of COW format and API." 2020-08-19 23:13:38 +00:00
David Benjamin
40ea8bc1eb libcrypto_utils: Use accessors to manipulate RSA keys.
This removes a blocker to BoringSSL marking the RSA struct opaque.
Sadly, OpenSSL's RSA_set0_key setter is a little tedious to use
correctly with error-handling, but it works.

Along the way, replace the byte reversing code with BoringSSL's native
little-endian BIGNUM conversion functions.

Test: libcrypto_utils_test passes
Change-Id: I298a6360d76fc7793462cd55bd57bc673c4975b3
2020-08-19 17:41:44 -04:00
David Anderson
a258293a97 libsnapshot: Off-line tool for converting OTA payloads to COWs.
The A/B version of this tool takes in a payload.bin file (from an OTA
package), and converts it into COWs in the new format. It uses the
CowWriter API to do this. This tool can be used to precisely see the
size of a COW relative to an OTA. Since there is one COW per partition,
it also takes an output folder:

    make_cow_from_ab_ota payload.bin ./ota-cows/

If the payload is incremental, a source target-files package is needed.
It must be the exact package used to build the OTA, otherwise, the
conversion is likely to fail. Example:

    make_cow_from_ab_ota -source_tf target-files-XYZ.zip \
                         payload.bin ./ota-cows/

Bug: 162274240
Test: manual tests
Change-Id: I22c86546f4166ee9df99165399646b7daa3519d5
2020-08-19 13:58:09 -07:00
David Anderson
0324725548 Initial prototype of COW format and API.
This is an initial prototype of the new COW format. It does not have
support for merge sequencing or merge state tracking.

The reader and writer APIs have pure virtual interfaces to support
mocking. The writer implementation performs compression, but the reader
interface does not (yet), it only supports iterating over metadata and
performing basic validation.

Bug: 162274240
Test: manual tests
      cow_api_test gtest
Change-Id: Ib9fddc1f210700688e6786917b023dfabd5fb3d9
2020-08-19 13:56:57 -07:00
Marco Ballesio
76eca5b4c1 freezer: allow dynamic changes to freezer.state
create new profiles to allowing thawing and freezing back the freezer
cgroup

Bug: 151225245
Test: Manually verified that using the SetTaskProfiles method on the
profiles thaws and freezes back the freezer cgroup.

Change-Id: I7f3e193ebe79b49c1f6ac52b6138ff4ec26fc570
2020-08-19 13:18:28 -07:00
Yo Chiang
93c78c243d Improve ImageManager error message
Print more helpful error messages to logcat.

Bug: 165471299
Test: Observe logcat
Change-Id: I3dca834a7cd3f653b038fc3a4020e96f500e1d1f
2020-08-19 19:31:15 +08:00
Martijn Coenen
4da604ba4e Allow shell to write to /sdcard/Android/data and /sdcard/Android/obb.
On devices without sdcardfs, these are only writable by the owning UID,
and/or the ext_data_rw/ext_obb_rw groups respectively.

Bug: 161134565
Bug: 162810387
Test: try to write to /sdcard/Android/data/ from shell uid
Change-Id: Idb4e07f967c8e888d95afa6c4a71595e0910ba0e
2020-08-19 09:04:52 +02:00
Yo Chiang
e48dbc2004 TranformFstabForDsu adds missing partition entries to fstab
Fix odd bug that TranformFstabForDsu doesn't emplace entry to fstab.

.avb_keys should be set to "/avb", the directory that stores all DSU
avbpubkeys, instead of appending.

Bug: 165471299
Test: Boot a multipartition DSU package
Change-Id: I62ee2f8bf7113f6d2af8cc34ef19c9743029ea0a
2020-08-19 14:17:37 +08:00
Bowgo Tsai
f4bf7f3a94 Add systrace tag for system property
Introduce a new systrace tag, TRACE_TAG_SYSPROP, for use with
system property.

Bug: 147275573
Test: build
Change-Id: I6f85f3f52f6580bab4ff43fc1dc0e87c689b054e
Merged-In: I6f85f3f52f6580bab4ff43fc1dc0e87c689b054e
(cherry picked from commit 573fc58bad)
2020-08-19 12:48:07 +08:00
Tamas Zsoldos
f30a46f100 libunwindstack: don't save pseudoregisters while evaluating Dwarf
Currently, while evaluating a Dwarf section, even pseudoregisters are
saved in regs_info. Since pseudoregisters are stored separately from
ordinary registers, trying to read them the usual way will result in
an out-of-bounds read. There's no memory corruption as regs_info is
big enough to store all existing pseudoregisters.

With this patch, pseudoregisters are simply not saved in regs_info.

Added new unit tests to cover the pseudo register cases.

Test: libunwindstack_test

Change-Id: If21b2a79f2fcca85644eec430f3d22e354b001ec
2020-08-18 18:08:28 -07:00
Treehugger Robot
cb54d93584 Merge "Revert "Fix non-existent module error"" am: d7cb6e1fd0
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1398410

Change-Id: I4903d5491e8e1106d486b0fdcc561f669dfe76e6
2020-08-18 08:02:29 +00:00
Treehugger Robot
d7cb6e1fd0 Merge "Revert "Fix non-existent module error"" 2020-08-18 07:41:01 +00:00
Elliott Hughes
f2587f3698 Merge "Deprecate <utils/Debug.h>." am: 5d0eb66590
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1402847

Change-Id: I38d2a1f664c6ef126a83b273d4d044a9664a3ea8
2020-08-17 20:48:09 +00:00