Commit graph

67347 commits

Author SHA1 Message Date
Josh Gao
92317d82c9 libdebuggerd: add protobuf implementation.
This commit implements protobuf output for tombstones, along with a
translator that should emit bytewise identical output to the existing
tombstone dumping code, except for ancillary data from GWP-ASan and
Scudo, which haven't been implemented yet.

Test: setprop debug.debuggerd.translate.translate_proto_to_text 1 &&
        /data/nativetest64/debuggerd_test/debuggerd_test
Test: for TOMBSTONE in /data/tombstones/tombstone_??; do
        pbtombstone $TOMBSTONE.pb | diff $TOMBSTONE -
      done
Change-Id: Ieeece6e6d1c26eb608b00ec24e2e725e161c8c92
2021-01-21 15:40:23 -08:00
Josh Gao
1091d24c16 tombstoned: support for protobuf fds.
Test: debuggerd_test
Change-Id: Id0f0fa2856e4b8e57d7dc0e1495134e943b289da
2021-01-13 13:35:45 -08:00
Josh Gao
e2aa621c83 tombstoned: make it easier to add more types of outputs.
While we're at it, switch to unlinkat.

Test: debuggerd_test
Change-Id: I8d285c4b4e94effa1acb8f69ac3af4ff8c37defb
2021-01-13 13:35:45 -08:00
Josh Gao
9a61f685d8 tombstoned: switch from goto to RAII.
Test: debuggerd_test
Change-Id: Ide6811297bf59776619aac6ed96653ae5cc84040
2021-01-13 13:35:45 -08:00
Wenhao Wang
1ee38ede4c Merge "trusty: Adapt to Confirmationui Corpus Format" 2021-01-13 20:17:31 +00:00
David Anderson
c6b6c08f95 Merge "libsnapshot: Fix a race condition in WaitForDelete." 2021-01-13 17:22:28 +00:00
Hridya Valsaraju
0db7ccaf99 Merge "Setup ueventd to support DMA-BUF system-secure heap" 2021-01-13 16:23:52 +00:00
David Anderson
cadab3b844 libsnapshot: Fix a race condition in WaitForDelete.
WaitForDelete is supposed to block until close() has been called on the
COW image. However, it could race with the destructor for Snapuserd
since nothing guaranteed it was freed within the global lock.

This patch fixes the bug and refactors the surrounding code to make the
responsibilities of each thread clearer.

Bug: N/A
Test: vts_libsnapshot_test
Change-Id: Icfc264e6dff378db585c81cde381cc24269f4800
2021-01-12 23:21:57 -08:00
Treehugger Robot
8376d87e2d Merge "Let init mount/unmount debugfs for non-user builds" 2021-01-13 04:24:22 +00:00
SzuWei Lin
bedae3910c Merge "Deprecate /factory" 2021-01-13 01:11:43 +00:00
Hridya Valsaraju
fb921a1c4e Let init mount/unmount debugfs for non-user builds
This change will help non-user builds with keeping debugfs
disabled during run time. Instead, debugfs will be mounted by init
to enable boot time initializations to set up vendor debug data
collection and unmounted after boot. It will be also be mounted by
dumpstate for bug report generation and unmounted after.

This change is only intended to help vendors (who depend on debugfs to
collect debug information from userdebug/eng builds) keep debugfs
disabled during runtime. Platform code must not depend on debugfs at all.

Test: manual
Bug: 176936478
Change-Id: I2e89d5b9540e3de094976563682d4b8c5c125876
2021-01-12 14:41:53 -08:00
Wenhao Wang
dc45de0553 trusty: Adapt to Confirmationui Corpus Format
The corpus of Confirmationui usually contains multiple data packets
to be transfered from Android side to Trusty side.
Therefore we adjust the Confirmationui fuzzer so that it can send
data to Confirmationui TA several times through a same tipc channel.

Bug: 174402999
Bug: 171750250
Test: /data/fuzz/arm64/trusty_confirmationui_fuzzer/trusty_confirmationui_fuzzer
Change-Id: Ib6ae831e6a19c98eb62a1c75f77eb00f914e2f5c
2021-01-12 12:54:27 -08:00
Hridya Valsaraju
f7c0f3d830 Setup ueventd to support DMA-BUF system-secure heap
Memory allocated from this heap will be used for secure playback.

Test: manual
Bug: 175697666
Change-Id: I16275ef0cef39b7b56cdce7c3545622712d438dc
2021-01-12 12:49:24 -08:00
David Anderson
270c98f190 Merge changes from topic "snapuserd-selinux"
* changes:
  libsnapshot: Fix tests that depend on PrepareOneSnapshot().
  libsnapshot: Ensure dm-user devices are destroyed after a merge.
  libsnapshot: Fix tests for mapping snapshots in first-stage init.
  init: Add an selinux transition for snapuserd.
2021-01-12 19:01:01 +00:00
David Anderson
8302b875a0 libsnapshot: Fix tests that depend on PrepareOneSnapshot().
PrepareOneSnapshot was hardcoded in a way that only worked with
pre-compression devices. This patch makes it use the public API and
supported update flow.

One test, SnapshotTest.Merge, now uses OpenSnapshotWriter instead of
MapUpdateSnapshot. There are still other tests using the old API call.

Bug: N/A
Test: vts_libsnapshot_test
Change-Id: Iec4bf6efe6a82e1f90b81fa4211201845ebabe62
2021-01-11 23:37:32 -08:00
Akilesh Kailash
06ee6f1753 Merge "libsnapshot:snapuserd: Handle un-aligned IO request" 2021-01-12 06:51:47 +00:00
David Anderson
4067c7e1a7 libsnapshot: Ensure dm-user devices are destroyed after a merge.
Also, make sure snapuserd has closed its references. This is preventing
the merge from completing until a reboot.

Bug: N/A
Test: vts_libsnapshot_test
Change-Id: Iba18f887bdb262c630ec44461871e19fe64dbf3c
2021-01-11 22:42:11 -08:00
David Anderson
2147cc5675 libsnapshot: Fix tests for mapping snapshots in first-stage init.
These tests are failing due to a missing WaitForFile call. Simplify
setting this up by adding a helper.

Bug: N/A
Test: vts_libsnapshot_test
Change-Id: Ic2afa74f72c7e364695233120b2327bae904882a
2021-01-11 22:42:09 -08:00
SzuWei Lin
478868826f Deprecate /factory
After Treblized, AOSP do not handle /factory folder. Also, AOSP
does not mount any partition to /factory. /factory has no possibility
to have any content. For factory purpose, it can be implemented in
vendor.

Bug: 177280838
Test: na
Change-Id: I0a2537336c2ef1efbad3e4f9e876aeaa607bc737
2021-01-12 12:18:39 +08:00
Akilesh Kailash
d2ad50103e libsnapshot:snapuserd: Handle un-aligned IO request
If the requested IO is not 4k aligned and spans
between two COW Operations, then we will have
to split the IO as we need to read the partial
buffers from two COW operations.

BUG: 176918488
Test: cow_snapuserd_test - Data verification with unaligned IO
      Full OTA on cuttlefish
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: Icf6801e1767112b92cb7991808860f119adebda2
2021-01-12 01:09:21 +00:00
Peter Collingbourne
942e5eef44 Merge "Remove ANDROID_EXPERIMENTAL_MTE." 2021-01-11 20:42:44 +00:00
Matthew Maurer
b026acb71e Merge changes I595cb4ee,Ie8623a70
* changes:
  trusty: tipc-test: Use dma_buf rather than memfd
  trusty: tipc-test: Test multi-page support
2021-01-11 20:12:22 +00:00
Peter Collingbourne
cd27807bfe Remove ANDROID_EXPERIMENTAL_MTE.
Now that the feature guarded by this flag has landed in Linux 5.10
we no longer need the flag, so we can remove it.

Bug: 135772972
Change-Id: I02fa50848cbd0486c23c8a229bb8f1ab5dd5a56f
2021-01-11 10:55:51 -08:00
Matthew Maurer
8ca6ab0161 trusty: tipc-test: Use dma_buf rather than memfd
Test: tipc-test -t send-fd
Bug: 117221195
Change-Id: I595cb4ee5fc24d8cafc9a3e706346139a974d674
2021-01-11 10:23:46 -08:00
Matthew Maurer
b6e795513b trusty: tipc-test: Test multi-page support
Test: tipc-test -t send-fd
Bug: 117221195
Change-Id: Ie8623a70f6935ede6bb5e9dd1a7945a7e356d854
2021-01-11 10:23:30 -08:00
David Anderson
491e4da372 init: Add an selinux transition for snapuserd.
With compressed VAB updates, it is not possible to mount /system without
first running snapuserd, which is the userspace component to the dm-user
kernel module. This poses a problem because as soon as selinux
enforcement is enabled, snapuserd (running in a kernel context) does not
have access to read and decompress the underlying system partition.

To account for this, we split SelinuxInitialize into multiple steps:

First, sepolicy is read into an in-memory string.

Second, the device-mapper tables for all snapshots are rebuilt. This
flushes any pending reads and creates new dm-user devices. The original
kernel-privileged snapuserd is then killed.

Third, sepolicy is loaded from the in-memory string.

Fourth, we re-launch snapuserd and connect it to the newly created
dm-user devices. As part of this step we restorecon device-mapper
devices and /dev/block/by-name/super, since the new snapuserd is in a
limited context.

Finally, we set enforcing mode.

This sequence ensures that snapuserd has appropriate privileges with a
minimal number of permissive audits.

Bug: 173476209
Test: full OTA with VABC applies and boots
Change-Id: Ie4e0f5166b01c31a6f337afc26fc58b96217604e
2021-01-08 16:39:51 -08:00
Gavin Corkery
09494764ae Merge "Add /metadata/watchdog" 2021-01-08 08:20:45 +00:00
Gavin Corkery
badf3962bc Add /metadata/watchdog
This directory will be used to store the mitigation count
from Package Watchdog in the case of a boot loop, in
order to persist the value across fs-checkpointing
rollbacks. One integer will be stored in a file in this
directory, which will be read and then deleted at the
next boot. No userdata is stored.

See go/rescue-party-reboot for more context.

Test: Manual test using debug.crash_sysui property
      and inspecting file
Bug: 171951174
Change-Id: I2bd5e1ebe14d7e9e4f0e0dbeb90cf76b8400752e
2021-01-07 19:41:07 +00:00
Nicolas Geoffray
5266e041ef Merge "Add boot animation progress system property." 2021-01-07 09:23:35 +00:00
Shawn Willden
e3e5ae9eae Merge "Revert^2 "Revise KeymasterMessage versioning system"" 2021-01-06 22:58:32 +00:00
Shawn Willden
9323f4113b Revert^2 "Revise KeymasterMessage versioning system"
24d46bd512

Change-Id: I4edcfdada8321ff181db70002a2661b821f6b33f
Bug: 176867651
Merged-In: Idefcdd64afa7977f6dc2c4299e69cc5065dcc20d
2021-01-06 19:54:24 +00:00
Jaegeuk Kim
7ef01c913f Merge "Pass wiped and fs_type to vold to format encrypted partition" 2021-01-06 19:12:34 +00:00
Treehugger Robot
f24141175a Merge "Revert "Revise KeymasterMessage versioning system"" 2021-01-06 09:24:43 +00:00
Bonian Chen
24d46bd512 Revert "Revise KeymasterMessage versioning system"
Revert "Revise KeymasterMessage versioning system"

Revert "Revise KeymasterMessage versioning system"

Revert "Add new message versioning protocol"

Revert submission 1533821-new_km_versioning

Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?branch=git_master&target=adt3-userdebug&lkgb=7064747&lkbb=7064769&fkbb=7064769, bug 176867651
Reverted Changes:
I040fe7f62:Revise KeymasterMessage versioning system
Ibea104c39:Revise KeymasterMessage versioning system
Ibea104c39:Revise KeymasterMessage versioning system
I425fb45fc:Add new message versioning protocol

Change-Id: I1569334c59cb62be6aae4a42ce999f40c7a472de
BUG: 176867651
2021-01-06 06:42:21 +00:00
Treehugger Robot
208cad671d Merge "Adding Car GSI public key" 2021-01-06 01:05:43 +00:00
Treehugger Robot
bd11a5c73a Merge "Add assemble_cvd to com.android.virt" 2021-01-06 00:07:44 +00:00
Treehugger Robot
bde5350eed Merge "Revert "libprocessgroup: move freezer to uid/pid hierarchy"" 2021-01-05 23:33:12 +00:00
Treehugger Robot
936557b6f0 Merge "Revise KeymasterMessage versioning system" 2021-01-05 22:40:06 +00:00
Marco Ballesio
b01aa99408 Revert "libprocessgroup: move freezer to uid/pid hierarchy"
This reverts commit 1414a0d4d8.

Reason for revert: reversions of CLs from http://b/174776875 removed dependencies for this CL, and made the freezer non-functional. This CL has to be reverted as well

Bug:174776875
Change-Id: Idbd9532374bb661330b3c7546bbdf086a046aba3
2021-01-05 21:36:44 +00:00
Yifan Hong
8995b50b80 Merge "LRAP->DAP" 2021-01-05 19:29:25 +00:00
Treehugger Robot
d3ba0e28cd Merge "Reland "Create a pool of 20 measurement files per library for coverage."" 2021-01-05 19:16:50 +00:00
Jiyong Park
3ed3d4cd94 Add assemble_cvd to com.android.virt
assemble_cvd directly or indirectly depends on these modules. To add
assemble_cvd to the com.anroid.virt APEX, these modules are marked as
being available to the APEX.

Bug: 174639526
Test: m com.android.virt
Change-Id: Id3b2989a9f038a1cdc769a2021a116cf09ab1b15
2021-01-05 14:46:01 +09:00
Jiyong Park
0f2c5417c3 Merge "init: Sort the list of flattened APEX folders to avoid variations" 2020-12-31 03:51:03 +00:00
Adrian DC
9449583bc3 init: Sort the list of flattened APEX folders to avoid variations
* In 'ActivateFlattenedApexesFrom', the 'readdir' detects
   the APEX folders in a random way that depends on filesystems,
   built packages and order of the build chain

 * In normal cases, this is not an issue, however when building
   with Go configurations, we have a case where the package
   'com.android.tethering.inprocess' is built along the
   'com.android.tethering' overriden binary, and depending on
   the 'readdir' output, the mounts break the Tethering service

Change-Id: I8ac4a0284d8d885f732c71e846933869cf16a0bd
Signed-off-by: Adrian DC <radian.dc@gmail.com>
2020-12-30 22:41:33 +01:00
Treehugger Robot
da1264206c Merge "snapuserd: Enable in recovery." 2020-12-30 08:27:43 +00:00
Jaegeuk Kim
8e944335a4 Merge "fastboot: f2fs: handle return code correctly" 2020-12-30 02:54:32 +00:00
Daniel Rosenberg
ff5f4cc734 Merge "libsnapshot: Add decompression check to Inspect_Cow" 2020-12-30 00:04:04 +00:00
Jaegeuk Kim
58d10c209a fastboot: f2fs: handle return code correctly
The f2fs shares the fsck return code for sload.f2fs, since it calls fsck after
loading files.

enum {
	FSCK_SUCCESS                 = 0,
	FSCK_ERROR_CORRECTED         = 1 << 0,
	FSCK_SYSTEM_SHOULD_REBOOT    = 1 << 1,
	FSCK_ERRORS_LEFT_UNCORRECTED = 1 << 2,
	FSCK_OPERATIONAL_ERROR       = 1 << 3,
	FSCK_USAGE_OR_SYNTAX_ERROR   = 1 << 4,
	FSCK_USER_CANCELLED          = 1 << 5,
	FSCK_SHARED_LIB_ERROR        = 1 << 7,
};

Bug: 176471360
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: I06289670834f29a59e704e772791f12328a073f8
2020-12-29 19:56:36 +00:00
Jaegeuk Kim
a7635718c4 Pass wiped and fs_type to vold to format encrypted partition
Bug: 172378121
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: I358380fc47fe9d4d75337323c772ca1af122d2c6
2020-12-29 11:13:35 -08:00
Daniel Rosenberg
71a642689c libsnapshot: Add decompression check to Inspect_Cow
This adds the -d option to Inspect_Cow, which will cause it to attempt
to decompress all data blocks, reporting any errors it encounters.
Useful for detecting corruption in Cow files.

Bug: 172026020
Test: Inspect_Cow -d [cow_file]
Change-Id: Iebf5f7f485b33b36daab4ab07005ca37e51d692f
2020-12-28 18:20:19 -08:00