Commit Graph

2228 Commits

Author SHA1 Message Date
Tianjie Xu
e4ec60e045 Add a checker for signature boundary in verifier am: 54ea136fde am: 0a34b17c8b am: fb80b4f72d am: d3d5e54a45 am: 6ea9888d51 am: a055eb93c3 am: 15ca2a4763 am: ca50d7b66a
am: 64f0de7a13

Change-Id: I3b67824479c820d06e84e6611e4aff87265dab11
2017-01-18 22:37:48 +00:00
Tianjie Xu
64f0de7a13 Add a checker for signature boundary in verifier am: 54ea136fde am: 0a34b17c8b am: fb80b4f72d am: d3d5e54a45 am: 6ea9888d51 am: a055eb93c3 am: 15ca2a4763
am: ca50d7b66a

Change-Id: Ic6e05b8812f4b765b9114149373c7a00ad9ec78d
2017-01-18 22:36:48 +00:00
Tianjie Xu
ca50d7b66a Add a checker for signature boundary in verifier am: 54ea136fde am: 0a34b17c8b am: fb80b4f72d am: d3d5e54a45 am: 6ea9888d51 am: a055eb93c3
am: 15ca2a4763

Change-Id: I5481d39f0d2fdb92c95e964d2a55512f4df3acb3
2017-01-18 22:34:18 +00:00
Tianjie Xu
15ca2a4763 Add a checker for signature boundary in verifier am: 54ea136fde am: 0a34b17c8b am: fb80b4f72d am: d3d5e54a45 am: 6ea9888d51
am: a055eb93c3

Change-Id: I8d26eefd2de6b7245a110c27d4210d5fdd2bd151
2017-01-18 22:32:47 +00:00
Tianjie Xu
a055eb93c3 Add a checker for signature boundary in verifier am: 54ea136fde am: 0a34b17c8b am: fb80b4f72d am: d3d5e54a45
am: 6ea9888d51

Change-Id: I7bbabdbe543c54f18dd42cb64030ca2174bf9bf2
2017-01-18 22:30:47 +00:00
Tianjie Xu
6ea9888d51 Add a checker for signature boundary in verifier am: 54ea136fde am: 0a34b17c8b am: fb80b4f72d
am: d3d5e54a45

Change-Id: Ib892c1745197ccb42d77c7bc8647f2e6b725a7dd
2017-01-18 22:28:46 +00:00
Tianjie Xu
d3d5e54a45 Add a checker for signature boundary in verifier am: 54ea136fde am: 0a34b17c8b
am: fb80b4f72d

Change-Id: Iba2da78981e4bd7a2b263b2f6b18ab6c176e5fc8
2017-01-18 22:26:47 +00:00
Tianjie Xu
fb80b4f72d Add a checker for signature boundary in verifier am: 54ea136fde
am: 0a34b17c8b

Change-Id: I4dbba92ea717951307dbcb6bf287edf4f6144a38
2017-01-18 22:24:16 +00:00
Tianjie Xu
0a34b17c8b Add a checker for signature boundary in verifier
am: 54ea136fde

Change-Id: Ide2da96e322c6a913b7f2e950e43c4d11278338e
2017-01-18 22:22:16 +00:00
Tianjie Xu
54ea136fde Add a checker for signature boundary in verifier
The 'signature_start' variable marks the location of the signature
from the end of a zip archive. And a boundary check is missing where
'signature_start' should be within the EOCD comment field. This causes
problems when sideloading a malicious package. Also add a corresponding
test.

Bug: 31914369
Test: Verification fails correctly when sideloading recovery_test.zip on
angler.

Change-Id: I6ea96bf04dac5d8d4d6719e678d504f957b4d5c1
(cherry-picked from f69e6a9475)
2016-12-16 16:24:09 -08:00
Andriy Naborskyy
3fdf1fd515 DO NOT MERGE ANYWHERE init: move healthd to late-init am: 195ff7f79e -s ours am: 7ceb371048 -s ours am: b8c1788e7b -s ours
am: 8837b0d25d  -s ours

Change-Id: I7ecada4bf93f79a8b308064c417e85d4e7f9ecc3
2016-10-27 16:16:55 +00:00
Andriy Naborskyy
8837b0d25d DO NOT MERGE ANYWHERE init: move healthd to late-init am: 195ff7f79e -s ours am: 7ceb371048 -s ours
am: b8c1788e7b  -s ours

Change-Id: I14de8cfdef94dfcb2d3f0760daf519537fa796d5
2016-10-27 16:11:55 +00:00
Andriy Naborskyy
b8c1788e7b DO NOT MERGE ANYWHERE init: move healthd to late-init am: 195ff7f79e -s ours
am: 7ceb371048  -s ours

Change-Id: I5c36f2e8ee5e410e9027376c32e86baa7fa2e65a
2016-10-27 16:07:25 +00:00
Andriy Naborskyy
7ceb371048 DO NOT MERGE ANYWHERE init: move healthd to late-init
am: 195ff7f79e  -s ours

Change-Id: Ibf16373a783458fd91284254156d5a9a0d70252d
2016-10-27 16:02:24 +00:00
Andriy Naborskyy
195ff7f79e DO NOT MERGE ANYWHERE init: move healthd to late-init
Starting healthd in early-init can cause SELinux denials if healthd
or any device-specific libraries try to log.

Now healthd is starting at boot as usual service.

Bug: 30292927
Change-Id: I367d022f5885122da49181db3db536012e83f564
2016-10-25 19:49:57 +00:00
Tianjie Xu
37d7d67ca2 DO NOT MERGE Report uncrypt errors in details
Add the error codes for uncrypt and report the failure details in
uncrypt_status.

Test: uncrypt_error logs correctly in last_install
Bug: 31603820
Change-Id: I8e0de845ce1707b6f8f5ae84564c5e93fd5f5ef5
(cherry picked from commit da44cf18f3)
2016-09-29 18:06:04 +00:00
Tao Bao
a8c0d0b43a DO NOT MERGE Duplicate the last_install content into last_log.
Currently we save the OTA metrics in last_install, which keeps the data
for the _last_ install only. This CL logs the same content into last_log
so that we keep the metrics for every install.

Bug: 31607469
Test: Apply an update (via OTA and sideload) and check last_log and last_install.

Change-Id: Id8f174d79534fddc9f06d72a4e69b2b1d8ab186c
(cherry picked from commit f4885adc18)
2016-09-26 22:10:07 -07:00
Tianjie Xu
41a3fd4e20 Check corruption when reading uncrypt_status file
Bug: 31383361
Change-Id: I0de920916da213528d73b742e4823b4a98c63ea1
(cherry picked from commit 1c1864f321)
2016-09-13 14:04:55 -07:00
Tianjie Xu
e16e799dfd save uncrypt status to last_install
Save the uncrypt time cost to /cache/recovery/uncrypt_status. Recovery
reads the file and saves its contents to last_install.

Bug: 31383361
Test: Tested on angler and uncrypt_time reports correctly.

(cherry picked from commit fe16b5ccaf)

Change-Id: Id69681a35c7eb2f0eb21b48e3616dcda82ce41b8
2016-09-12 16:59:48 -07:00
Tianjie Xu
62ab2a0fbc "view recovery logs" will show /tmp/recovery.log
For A/B devices, "view recovery logs" doesn't work due to the lack
of cache partition. To help debugging, we'll show /tmp/recovery.log
instead if /cache is not found.

Change-Id: Idb77c3a4c30388148a210b38d732a7b27e757bba
Test: Tested on an A/B device and /tmp/recovery.log showed up.
Bug: 30905700
(cherry picked from commit a54f75ede8)
2016-08-17 15:07:50 -07:00
Alex Deymo
53c107f068 Add inttypes.h for PRIu64.
This missing header is needed to use PRIu64 macros.

Bug: 27178350
TEST=`mma bootable/recovery` on the failing branch.

Change-Id: I165701e8019256426d3f6a4168db52c6a0197c4d
2016-08-12 13:46:17 -07:00
Alex Deymo
4344d636d4 Call update_engine_sideload from recovery.
This patch enables sideloading an OTA on A/B devices while running from
recovery. Recovery accepts the same OTA package format as recent
versions of GMS, which consists of .zip file with the payload in it.

Bug: 27178350
TEST=`adb sideload` successfully a full OTA (*)
TEST=Failed to take several invalid payloads (wrong product,
fingerprint, update type, serial, etc).

<small>(*) with no postinstall script.</small>

Change-Id: I951869340100feb5a37e41fac0ee59c10095659e
2016-08-11 18:55:11 -07:00
Bill Yi
e49c0d6406 Import translations. DO NOT MERGE
Change-Id: If24c94c20f8e4c37c119dcaff765e9ee59e48ef4
Auto-generated-cl: translation import
2016-07-20 19:24:24 -07:00
Tianjie Xu
da654af606 Skip update verification if care_map is not found
Recently flashed devices may not have care_map.txt in /data/ota_package.
This leads to a failure of update-verifier and prevents boot
success flag from being set. So, we need to skip verification
in case the file is not found.

Error message:
... I update_verifier: Started with arg 1: nonencrypted
... I update_verifier: Booting slot 1: isSlotMarkedSuccessful=0
... E update_verifier: Care map /data/ota_package/care_map.txt not found.
... E update_verifier: Failed to verify all blocks in care map file

Bug: 30156449
Change-Id: Ia15f5f3e7ca2ea6981d49678e799b9f70d134faa
2016-07-15 16:30:12 -07:00
Tianjie Xu
4bbe0c93c8 Fix a typo when comparing the verity mode
The veritymode string used by the bootloader should be lowercase 'eio'
instead of 'EIO'. Fix the typo and change to strcasecmp.

Bug: 27175949
Change-Id: I376dacc70eef7364e2b9931a7c940adedcdb1929
2016-07-14 23:57:43 +00:00
Tianjie Xu
13f44939b1 Merge "Touch blocks in care_map in update_verifier" into nyc-mr1-dev 2016-07-14 22:27:09 +00:00
Tianjie Xu
03ca853a1c Touch blocks in care_map in update_verifier
Read all blocks in system and vendor partition during boot time
so that dm-verity could verify this partition is properly flashed.

Bug: 27175949
Change-Id: I38ff7b18ee4f2733e639b89633d36f5ed551c989
2016-07-14 14:31:39 -07:00
Tianjie Xu
27b9fc8a36 Skip update-on-boot for bootreason in blacklist
Skip the OTA installation when bootreason is 'kernel_panic',
'Panic' etc.

Change-Id: Ic1202492bffefa1a9d8d0e691b5af979285e552c
Test: On angler, ota installation skips for one bootreason in the blacklist.
Bug: 29978689
2016-07-11 18:37:34 -07:00
Elliott Hughes
6d089a955f Support landscape layouts.
Add support for landscape layouts to the existing portrait support.

Bug: http://b/29418855
Test: tested manually with "Run graphics test" on flounder/fugu/ryu.
Change-Id: Ib4a62bf5f2b8a1cef6028a01f05145104660560a
2016-07-08 18:21:45 -07:00
Yabin Cui
9da04d595f Fix bootloader_message.
Bug: 29945717
Change-Id: I934fd6c52b0111937fa75455de2fa4157fb30f6f
2016-07-06 11:47:23 -07:00
Tao Bao
ccb0ba908a updater: Fix the broken ReadFileFn.
Was accidentally broken by the CL in [1].

[1]: commit d6c93afcc2

Bug: 29767315
Change-Id: I851e13ccea6f5be6fcd47f712cc95867245f9934
(cherry picked from commit efacd80364)
2016-06-30 17:04:12 -07:00
Yabin Cui
2f272c0551 Create bootloader_message static library.
bootloader_messages merges bootloader_message_writer
and bootloader.cpp, so we can use the same library to
manage bootloader_message in normal boot and recovery mode.

Bug: 29582118

Change-Id: I9efdf776ef8f02b53911ff43a518e035e0c29618
2016-06-30 11:02:38 -07:00
Tianjie Xu
6074099cb9 Increase EIO retry count
am: c37c5c3410

Change-Id: I163541137bf8c421276383855d36ab127d2ddf95
2016-06-24 00:26:51 +00:00
Tianjie Xu
c37c5c3410 Increase EIO retry count
Increase the number of attempts of an OTA update from 3 to 5 in case
an I/O error happened. This should increase the success rate of the
update.

Bug: 29619468
Change-Id: I88a067d9debd55a07be22ed981f395f6e47ec28f
2016-06-23 17:15:25 -07:00
Yabin Cui
ed4c49c199 Merge "Verify wipe package when wiping A/B device in recovery." into nyc-mr1-dev 2016-06-21 17:10:49 +00:00
Yabin Cui
6faf0265c9 Verify wipe package when wiping A/B device in recovery.
To increase the security of wiping A/B devices, let uncrypt write
wipe package in misc partition. Then recovery verifies the wipe
package before wiping the device.

Bug: 29159185

Change-Id: I186691bab1928d3dc036bc5542abd64a81bc2168
2016-06-20 18:18:02 -07:00
Tianjie Xu
d0dcbddd31 Check the results from applypatch
am: 31f8cc84cf

Change-Id: Ie50652158b65d723346ffff18c85cbaab11820e1
2016-06-16 18:09:19 +00:00
Tianjie Xu
31f8cc84cf Check the results from applypatch
Check the results from applypatch in PerformCommandDiff; and abort the
update on failure.

Bug:29339536
Change-Id: I5087d79ba532b54250f4c17560524255c8a4fabc
2016-06-15 23:26:59 +00:00
Tao Bao
2a4386fa7b applypatch: Don\'t call inflate() when it expects zero-length output.
am: 490fad6791

Change-Id: Id4df6fd73edf70ce88d3df4a5ebaeb665f38eef3
2016-06-14 01:29:09 +00:00
Tao Bao
490fad6791 applypatch: Don't call inflate() when it expects zero-length output.
We may have expanded_len == 0 when calling inflate(). After switching to
using std::vector, it passes a nullptr buffer to inflate() and leads to
Z_STREAM_ERROR.

Bug: 29312140
Change-Id: Iab7c6c07a9e8488e844e7cdda76d02bd60d2ea98
2016-06-13 16:42:52 -07:00
Tao Bao
dc1393d09b Merge "recovery: Track the name change for wipe_ab." into nyc-mr1-dev 2016-06-13 16:43:46 +00:00
Tianjie Xu
dcf1089771 Log source/target build version to last_install
am: b0ddae55e5

Change-Id: I8be36165769d4159e4578f9fea54f332e4e77c6c
2016-06-10 17:21:40 +00:00
Tao Bao
108ab21b21 recovery: Track the name change for wipe_ab.
Bug: 27253717
Change-Id: I6e63b2a80b7b2948c16e1b57dedc856d52456ac9
2016-06-10 10:13:32 -07:00
Tianjie Xu
b0ddae55e5 Log source/target build version to last_install
Parse the build.version.incremental from the metadata of the update
package; and log it to last_install.
Example:
In metadata we read:
post-build-incremental=2951741
pre-build-incremental=2943039

In last install we log:
source_build: 2943039
target_build: 2951741

Bug: 28658632
Change-Id: I0a9cc2d01644846e18bda31f4193ff40e8924486
2016-06-09 17:29:04 -07:00
Alain Vongsouvanh
91d78acbd3 resolve merge conflicts of 6aa6ddb to nyc-dev
am: 771b6eb8d9

Change-Id: Icc7290bbdf7b7420bab34b56f4e368f93b007053
2016-06-08 15:46:40 +00:00
Alain Vongsouvanh
771b6eb8d9 resolve merge conflicts of 6aa6ddb to nyc-dev
Change-Id: I3696fe3e86e0222c7c26b0aa2bf1dd8e03ac5315
2016-06-08 08:30:48 -07:00
Alain Vongsouvanh
6aa6ddb3c5 recovery: Make wear recovery more customizable.
am: 5b00110e3d

Change-Id: I88ab75e875cea8813ab4bdc9f099c31609ace6fd
2016-06-08 15:10:54 +00:00
Alain Vongsouvanh
5b00110e3d recovery: Make wear recovery more customizable.
Making animation_fps protected and adding support for 0 frames intro.

BUG: 29085786
Change-Id: I07b44570022bad89661973178d453592c01f3f10
2016-06-07 10:05:29 -07:00
Tao Bao
1afa4d7b23 Merge "recovery: Add support to brick a device." into nyc-mr1-dev 2016-06-04 04:19:05 +00:00
Tianjie Xu
57ad046d9d Call ioctl before each write on retry
am: 7ce287d432

* commit '7ce287d432dd3a4dc8841fc59e11ee1a0b7808a1':
  Call ioctl before each write on retry

Change-Id: Iae05ceca190c253d0be3ae9e4054abf4d0dbe751
2016-06-03 22:38:11 +00:00