Commit graph

67438 commits

Author SHA1 Message Date
Yo Chiang
f0b8ebc9e9 fs_mgr: Harden adb-remount-test.sh by ERR trap handler
Exit immediately if any unexpected error.

Bug: 165925766
Test: adb-remount-test.sh
Change-Id: I5e9e796f61be21d4b130640949432c1f531de5a4
2021-01-30 00:03:03 +08:00
Julien Desprez
a28b67e9b6 Merge "Attempt to make libavb test working in CI" 2021-01-26 02:00:03 +00:00
David Anderson
ea1f0fa006 Merge changes I2db0e626,Ic69fc2f5
* changes:
  libsnapshot: Only mount snapshots in MapAllSnapshots().
  libsnapshot: Do not attempt compression features in recovery.
2021-01-26 00:35:58 +00:00
Akilesh Kailash
1d9a7adc67 Merge "libsnapshot: Add unit test to simulate merge-resume" 2021-01-26 00:09:36 +00:00
Josh Gao
baa2ffe2fd Merge "Fix build breakage." 2021-01-25 23:16:49 +00:00
Josh Gao
675cb30f05 Fix build breakage.
Test: mma
Test: treehugger
Change-Id: I2d08c9b6e7776e69ca1e7f0d83838830f3c9b15c
2021-01-25 15:11:49 -08:00
Josh Gao
6bf6a9fc61 Merge changes from topic "tombstone_proto"
* changes:
  libdebuggerd: add protobuf implementation.
  tombstoned: support for protobuf fds.
  tombstoned: make it easier to add more types of outputs.
  tombstoned: switch from goto to RAII.
2021-01-25 22:18:48 +00:00
David Anderson
5283ae4a86 libsnapshot: Only mount snapshots in MapAllSnapshots().
By accident, this was mounting partitions as well, which caused
conflicts in partial updates where some partitions don't have snapshots.

Test: update_device.py with partial OTA
Change-Id: I2db0e6269f0a02cbe8164fa2a72b887c352f56d8
2021-01-25 13:55:59 -08:00
David Anderson
71ab9dbeba libsnapshot: Do not attempt compression features in recovery.
Test: adb sideload
Change-Id: Ic69fc2f5c37a5d4fc0fcd0819ebf58e0249f7773
2021-01-25 13:54:45 -08:00
David Anderson
ad7d1d13a4 Merge changes I82b7d77b,I6b77690c
* changes:
  first_stage_mount: Create snapshot devices before launching first_stage_console
  first_stage_mount: Move CreateLogicalPartitions to DoFirstStageMount
2021-01-25 21:28:55 +00:00
David Anderson
291a5058cb Merge "libsnapshot: Only enable compression when the corresponding bit is set in DeltaArchiveManifest." 2021-01-25 21:00:40 +00:00
Julien Desprez
f8d9765e0a Attempt to make libavb test working in CI
Test: presubmit
Bug: 178215452
Change-Id: I82d847e05a2fddf3037a8f97793e24a593230ba7
2021-01-25 18:02:12 +00:00
Elliot Berman
9583e92257 first_stage_mount: Create snapshot devices before launching first_stage_console
During device bringup, dynamic partitions may not be properly
configured by some sort of build or load misconfiguration. Diagnosing
such issues can be difficult without being able to see which partitions
are available and what they contain.

Aditionally, making logical partitions available to first stage console
permits early mounting of vendor partition and allows primitive
validation of vendor scripts without requiring full Android
environment. For instance, vendor_dlkm partition and modules can be
probed needing to have a full Android bootup.

Creation of logical partitions is done only when first_stage_console is
requested in order to have minimal impact on normal boot. Thus, only a
small refactor is required to split CreateLogicalPartitions out of
MountPartitions.

Bug: 174685384
Bug: 173732805
Change-Id: I82b7d77b9dc75af59b5e18b574e3eb99c8aff9e2
Signed-off-by: Elliot Berman <eberman@quicinc.com>
2021-01-25 09:53:36 -08:00
Elliot Berman
a619f22e37 first_stage_mount: Move CreateLogicalPartitions to DoFirstStageMount
In preparation for later commit:
   first_stage_mount: Create snapshot devices before launching
first_stage_console

Bug: 173732805
Bug: 174685384
Change-Id: I6b77690c7cf68f6235c99bf4ff897b0ee41c4d0e
Signed-off-by: Elliot Berman <eberman@quicinc.com>
2021-01-25 09:53:35 -08:00
Mitch Phillips
1d792bf90a Merge "[MTE] Cleanup tagged si_addr refs to fix mappings OOB bug." 2021-01-25 17:20:40 +00:00
Bowgo Tsai
38de3ba65f Merge "libfs_avb: Fix unit test failures" 2021-01-25 10:13:25 +00:00
Bowgo Tsai
8d84d08da6 Merge "Mark libvbmeta_test as not unit tests" 2021-01-25 08:43:18 +00:00
Bowgo Tsai
708d962795 libfs_avb: Fix unit test failures
There more output lines of `avbtool` now, adjusts the expected
output of `avbtool info_image --image test.img` in the test
cases.

Bug: 178215452
Test: atest libfs_avb_test
Test: atest libfs_avb_internal_test
Change-Id: I924d6d97ef0a4c19c93017c2491bf251dfc51cae
2021-01-25 16:19:03 +08:00
Seigo Nonaka
4356f6e98d Merge "Set up /data/fonts directory for updatable system fonts" 2021-01-25 05:47:03 +00:00
Akilesh Kailash
21afdd4d7e libsnapshot: Add unit test to simulate merge-resume
Simulate merge interruption and merge restart and
validate the data once entire merge is completed.

Bug: 167409187
Test: cow_snapuserd_test
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: Ia940d5fbd2426bdf13347ffb6637d753b2228de6
2021-01-25 01:18:05 +00:00
Yo Chiang
8d60fefae8 Merge "adb remount -R should enable DSU if suitable" 2021-01-24 23:38:28 +00:00
Linzhao Ye
5a9b8577c9 Merge "Allow system server to access sysfs node of led lights." 2021-01-23 17:08:46 +00:00
Woody Lin
81bf17ce0f Merge "Add init.svc_debug.no_fatal.<svc_name> to skip SVC_CRITICAL" 2021-01-23 00:34:06 +00:00
Elliott Hughes
ad5b717c5b Merge "libadf: delete libadf & libadfhwc" 2021-01-22 23:37:48 +00:00
Marissa Wall
254d753f34 libadf: delete libadf & libadfhwc
libadf is a helper library for adf (android display framework)
kernel drivers. The last Android Common Kernel to support adf was
4.4. Delete this helper library since we do not support any kernels
that can use it.

If a vendor needs this library, they can fork it.

If you have any concerns, please contact adelva@google.com.

Bug: 150467766
Test: Compiles
Change-Id: Ib6e1ce2db016e97a165a59b28b9fab5e3ef8f255
Merged-In: Ib6e1ce2db016e97a165a59b28b9fab5e3ef8f255
2021-01-22 19:30:47 +00:00
Julien Desprez
3123fd8930 Mark libvbmeta_test as not unit tests
Test: presubmit
Bug: 177906739
Change-Id: I6b49a0af19a652fbe507df2a3f82502a70bec988
2021-01-22 09:04:42 -08:00
Yo Chiang
d542910553 adb remount -R should enable DSU if suitable
If executing `adb remount -R` and DSU is running but disabled, then
enable the DSU (one-shot mode) so that the reboot afterwards would stay
within the DSU guest system.
Normally reboot within a DSU guest system would bring the device back to
the host system. However when doing adb remount -R, we actually doesn't
want to exit DSU, but wish to reboot back into DSU guest system again
with remount machinery (overlayfs) properly set up.

Also sort the header include order.

Bug: 165925766
Test: Within a DSU guest system, DSU disabled, adb remount -R
  => After reboot, system is DSU and overlayfs is mounted
Test: adb-remount-test.sh within DSU guest system
Change-Id: I72a7a568e985b183d357ae6e1a7d0113e9921200
2021-01-22 22:15:10 +08:00
I-Chih Lu
e0826c75df Merge "Secure DPU: add folder for common headers" 2021-01-22 08:13:42 +00:00
Woody Lin
ef9d460ea8 Add init.svc_debug.no_fatal.<svc_name> to skip SVC_CRITICAL
For user who would like to retain the crash symptom and avoid device
from power cycle for live debugging, set
init.svc_debug.no_fatal.<svc_name> to "true" to skip FATAL reboot.

Bug: 177593855
Change-Id: I0bdb6191e5963c08e1ea301a60060acf916dd49b
2021-01-22 15:01:36 +08:00
ichihlu
9ee8a75e6b Secure DPU: add folder for common headers
The header SecureDPU.h is moved out from the device specific folder as
it can be shared for different devices.

Bug: 176508588
Test: Pass TUI VTS test on the emulator.
Change-Id: I7695b49c4f7a247b570ced61145471efef3d0a3d
2021-01-22 06:31:37 +00:00
Mitch Phillips
e4adff0721 [MTE] Cleanup tagged si_addr refs to fix mappings OOB bug.
Currently, all MTE failures end up displaying 'Fault address falls at
0x<addr> after any mapped regions'. Clearly when scanning, we should use
the untagged address to figure out which ranges it's in.

I've taken the liberty of removing all si_addr parsing and moving it
into the common ProcessInfo, as well as making it really explicit
whether you want the (possibly tagged) original si_addr, or whether you
want the untagged variant (for scanning /proc/maps or whatever).

This is not particularly easily testable, as ReadCrashInfo isn't easily
injectable and `dump_all_maps` should already be passed the untagged
pointer to scan for. I've tested this locally on FVP under SYNC MTE with
a simple UaF binary and noted the problem is fixed. Given that this is
making the code more clear, I'm hoping the owners see no need for a
regression test :).

Bug: 135772972
Test: On FVP, run 'adb shell MEMTAG_OPTIONS=sync sanitizer-status' and
      check that the use-after-free test ends up with the /proc/maps
      desription in the right place.
Change-Id: I220e4200c75a72474a95a67e5bbc36173a438dd2
2021-01-21 20:49:06 -08:00
Yo Chiang
f5835fa714 Merge "adb-remount-test.sh: Filter out administrative mount: securityfs" 2021-01-22 03:15:18 +00:00
Yo Chiang
ec8f9dd1f1 adb-remount-test.sh: Filter out administrative mount: securityfs
securityfs /sys/kernel/security securityfs rw,relatime 0 0

is causing the noatime check in adb-remount-test.sh to fail.

Bug: 165925766
Test: Create an aosp_cf_x86_phone-userdebug AVD && adb-remount-test.sh
Test: Use DSU to install GSI on the AVD && adb-remount-test.sh
Change-Id: Ibae0d4bbbbc78fb74f4ad82f2313251598c77f72
2021-01-22 03:15:10 +00:00
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
David Anderson
3ee2475061 libsnapshot: Only enable compression when the corresponding bit is set in DeltaArchiveManifest.
Test: vts_libsnapshot_test
Change-Id: I43bab4a823d61c56596e1fd5b1522de08b9674f2
2021-01-21 15:15:40 -08:00
David Anderson
4787c1fa28 Merge changes I06043f8e,I872f271c
* changes:
  libsnapshot: Use a two-phase merge for VABC.
  libsnapshot: Pass the correct source device to snapuserd.
2021-01-21 21:10:38 +00:00
David Anderson
531e15e38c Merge "libsnapshot: Removed the unused "linear" optimization." 2021-01-21 20:49:42 +00:00
Treehugger Robot
1433d42cea Merge "trusty: keymaster-hal: Reconnect on failed VERSION" 2021-01-21 20:36:45 +00:00
Akilesh Kailash
c7e586a7bf Merge "libsnapshot: Merge completion for sector 0" 2021-01-21 16:25:15 +00:00
Akilesh Kailash
ae0783f4c7 libsnapshot: Merge completion for sector 0
Snapuserd daemon parses the merge completion request based on
how the dm-snapshot merge is done. dm-snapshot marks the merge as
complete by zeroing out the metadata viz old-chunk and new-chunk id's.

If we have a sector 0 operation such as copy/replace op,
then old-chunk id will be 0 and new-chunk id will be a non-zero
pseudo number. Once the merge is complete, then old-chunk and new-chunk will be 0.

The problem is that daemon used to track the merge completion just by checking
if old-chunk was non-zero. This check is not sufficient and ends up
tripping the assert in the daemon.

Bug: 178061207
Test: Modify cow_snapuserd_test to test this case and validate the
      IO path.
Reported-by: Kelvin Zhang <zhangkelvin@google.com>
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I6603af1c7b55e487dc3aec0c30c0a9dea0fedb56
2021-01-21 06:27:55 +00:00
Treehugger Robot
5e9fb35ba8 Merge "Fix failure of libvbmeta_test" 2021-01-21 02:17:44 +00:00
David Anderson
86ba14be16 libsnapshot: Use a two-phase merge for VABC.
If a partition shrinks in an update, it must be merged before any other
partitions. Otherwise, a copy operation may source from the tail of the
shrunk partition, which could be overwritten by a merge operation in
another partition.

This patch adds a "MergePhase" indicator to the update status that is
valid only when the state is MERGING. Partitions that shrink are merged
first, and the phase will be FIRST_PHASE. Once ProcessUpdateState() has
determined that all first-phase snapshots are merged, it will switch to
SECOND_PHASE and remaining snapshots can start merging.

Otherwise, there is no change to the merge algorithm. The phase split is
an implementation detail and not exposed to update_engine.

Bug: 177935716
Test: vts_libsnapshot_test
Change-Id: I06043f8e3b81bdecefb6a4b5944a97b7086eeb49
2021-01-20 18:17:08 -08:00
David Anderson
91c9f56d30 libsnapshot: Pass the correct source device to snapuserd.
When a partition shrinks, it is not correct to use the base device as
the "source" device for the new COW format, because we may need to read
blocks that do not exist in the new partition.

To resolve this, we store a copy of the old partition layout in /metadata,
and use it to create a "source" view of the old partition. The new
stacking looks as follows:

  partition_b (dm-snapshot):
   - partition_b-base (partition_b dm-linear)
   - partition_b-cow-user (dm-user + snapuserd):
      - partition_b-cow (COW image)
      - partition_b-src (partition_a dm-linear)

Bug: 177935716
Test: vts_libsnapshot_test
Change-Id: I872f271cc1f25cc796b94188fdde247cdc4050b4
2021-01-20 18:17:08 -08:00
David Anderson
dc73581e53 libsnapshot: Removed the unused "linear" optimization.
VAB has an unused optimization that allows bypassing snapshots for the
area of a partition that grows during an OTA. The code for this is
entirely unused since the optimization was never enabled. The benefits
are marginal, and making it safe is quite complicated. The "new" region
cannot overlap with any region being relinquished by a shrink operation,
without snapshotting the region that would be overwritten. This would be
burdensome to implement and would minimize space savings.

Let's remove the code related to this optimization until we are
confident we can implement it safely in VABC.

Bug: 177935716
Test: vts_libsnapshot_test
Change-Id: I7d6a68dce57c8a4389ea6bff9f31971276a20db4
2021-01-20 18:17:07 -08:00
Matthew Maurer
c4abbe6427 trusty: keymaster-hal: Reconnect on failed VERSION
Trusty Keymaster will currently disconnect the client on an invalid
message. This includes the newly introduced GET_VERSION2 message.

While in the future we could change this behavior, this is a backcompat
path and so we can't assume a changed Trusty. Reconnect on failed
GET_VERSION2 before attempting version negotiation.

Bug: 177843218
Test: Set PIN on device using older Trusty
Change-Id: Ie60e4aaafa43e375797e6288b97834cac42413f4
2021-01-20 13:21:37 -08:00
Treehugger Robot
da0f466da2 Merge "Remove unnecessary #includes." 2021-01-20 19:44:03 +00:00
Bowgo Tsai
5346093a19 Fix failure of libvbmeta_test
The test uses 'external/avb/test/data/testkey_rsa2048.pem' from the
source tree, which is not available when running the test. Copy
the test key with the test case in Android.bp to fix the issue.

Bug: 177906739
Test: atest libvbmeta_test

Change-Id: I528dcdc5b48ed4af36ddd360380eb39631ff4317
2021-01-20 15:41:21 +08:00
Howard Chen
79f7e3f1fc Merge "Fix the MapWithLoopDevice" 2021-01-20 02:45:23 +00:00
Pirama Arumuga Nainar
a1d04e4de4 Merge "Allow fchmod syscalls on code-coverage builds" 2021-01-20 00:17:42 +00:00
Janis Danisevskis
8e24de53c8 Merge "Integrate IKeystoreAuthorization aidl's addAuthToken with gatekeeperd." 2021-01-19 21:11:47 +00:00