Commit graph

1347 commits

Author SHA1 Message Date
Paul Lawrence
98c1a3de23 Change init sequence to support file level encryption
File level encryption must get the key between mounting userdata and
calling post_fs_data when the directories are created. This requires
access to keymaster, which in turn is found from a system property.

Split property loaded into system and data, and load in right order.

Bug: 22233063
Change-Id: I409c12e3f4a8cef474eb48818e96760fe292cc49
2015-07-06 10:44:33 -07:00
Tao Bao
7125f9594d Revert "Zero blocks before BLKDISCARD"
This reverts commit b65f0272c8.

It slows down the update too much on some devices (e.g. increased
from 8 mins to 40 mins to take a full OTA update).

Bug: 22129621
Change-Id: I4e8d4f6734967caf4f0d19c734027f7b6c107370
2015-06-30 23:10:44 -07:00
Tao Bao
c3dddce205 More accurate checking for overlapped ranges.
A RangeSet has half-closed half-open bounds. For example, "3,5" contains
blocks 3 and 4. So "3,5" and "5,7" are actually not overlapped.

Bug: 22098085
Change-Id: I362d259f8b5d62478858ad0422b635bc5068698d
(cherry picked from commit c0f56ad766)
2015-06-26 13:48:46 -07:00
caozhiyuan
cb9450e113 Use f_bavail to calculate free space
Failures are seen on devices with
Linux 3.10. And they are mainly due to this change:
https://lwn.net/Articles/546473/
The blocks reserved in this change is not the same thing as what we
think are reserved for common usage of root user. And this part is
included in free blocks but not in available blocks.

Bug: 22118089
Change-Id: I81c9531703298019a4fc11839f28d2cc8b9df34e
(cherry picked from commit 3b4977638f)
2015-06-26 11:17:02 -07:00
Elliott Hughes
c35f3ce30e Allow sideloading without authentication.
Bug: http://b/22025550
Change-Id: I20f09ae442536f924f19ede0abf6a2bcc0a5cedf
(cherry picked from commit 9813f5ba57)
2015-06-23 11:34:07 -07:00
Sami Tolvanen
d7c9bf41da Merge "Zero blocks before BLKDISCARD" into mnc-dev 2015-06-10 21:50:03 +00:00
Elliott Hughes
0005f89c31 Split WipeData into PreWipeData and PostWipeData.
Bug: http://b/21760064
Change-Id: Idde268fe4d7e27586ca4469de16783f1ffdc5069
(cherry picked from commit 945548ef7b)
2015-06-10 14:11:08 -07:00
Sami Tolvanen
b65f0272c8 Zero blocks before BLKDISCARD
Due to observed BLKDISCARD flakiness, overwrite blocks that we want
to discard with zeros first to avoid later issues with dm-verity if
BLKDISCARD is not successful.

Bug: 20614277
Bug: 20881595
Change-Id: I4f6f2db39db990879ff10468c9db41606497bd6f
(cherry picked from commit a3c75e3ea6)
2015-06-10 20:36:02 +01:00
Sami Tolvanen
6abd52f62b Revert "Zero blocks before BLKDISCARD"
This reverts commit 604c583c9d.

Change-Id: I2b0b283dc3f44bae55c5e9f7231d7c712630c2b5
2015-06-10 15:52:04 +00:00
Sami Tolvanen
604c583c9d Zero blocks before BLKDISCARD
Due to observed BLKDISCARD flakiness, overwrite blocks that we want
to discard with zeros first to avoid later issues with dm-verity if
BLKDISCARD is not successful.

Bug: 20614277
Bug: 20881595
Change-Id: I0280fe115b020dcab35f49041fb55b7f8e793da3
(cherry picked from commit 96392b97f6)
2015-06-09 22:21:44 +01:00
Tao Bao
02b6472546 Merge "uncrypt: Write status when it reboots to factory reset" into mnc-dev 2015-05-29 22:02:27 +00:00
Tao Bao
2c2cae8a4a uncrypt: Write status when it reboots to factory reset
When it reboots into recovery for a factory reset, it still needs to
write the uncrypt status (-1) to the pipe.

Bug: 21511893
Change-Id: I1a725820f1e1875146e49b5a6f28af2fbf284fc7
2015-05-29 14:24:02 -07:00
Elliott Hughes
b5dabd25e1 Really don't use TEMP_FAILURE_RETRY with close in recovery.
I missed one last time.

Bug: http://b/20501816
Change-Id: I9896ee2704237d61ee169f898680761e946e0a56
(cherry picked from commit b3ac676192)
2015-05-29 11:03:44 -07:00
Sami Tolvanen
92eea1bc41 Handle BLKDISCARD failures
In the block updater, if BLKDISCARD fails, the error is silently
ignored and some of the blocks may not be erased. This means the
target partition will have inconsistent contents.

If the ioctl fails, return an error and abort the update.

Bug: 20614277
Change-Id: I33867ba9337c514de8ffae59f28584b285324067
(cherry picked from commit cc2428c818)
2015-05-29 09:02:14 +01:00
Tao Bao
158e11d673 Separate uncrypt into two modes
uncrypt needs to be triggered to prepare the OTA package before
rebooting into the recovery. Separate uncrypt into two modes. In
mode 1, it uncrypts the OTA package, but will not reboot the
device. In mode 2, it wipes the /misc partition and reboots.

Needs matching changes in frameworks/base, system/core and
external/sepolicy to work properly.

Bug: 20012567
Bug: 20949086
Change-Id: I14d25cb62770dd405cb56824d05d649c3a94f315
2015-05-28 14:44:52 -07:00
Elliott Hughes
1857a7f579 Don't use TEMP_FAILURE_RETRY on close in recovery.
Bug: http://b/20501816
Change-Id: I35efcd8dcec7a6492ba70602d380d9980cdda31f
(cherry picked from commit b47afedb42)
2015-05-15 18:09:33 -07:00
Elliott Hughes
df52e1e119 Add an alternate screen for viewing recovery logs.
This makes it easier to go back and forth without losing current output.

Also make the display more like regular more(1).

Bug: http://b/20834540
Change-Id: Icc5703e9c8a378cc7072d8ebb79e34451267ee1b
(cherry picked from commit c049163234)
2015-05-06 21:20:10 -07:00
Tao Bao
3e8d28b547 uncrypt: Switch to C++
Also apply some trivial changes like int -> bool and clean-ups.

Change-Id: I5c6c42d34965305c394f4f2de78487bd1174992a
(cherry picked from commit 381f455cac)
2015-05-06 12:23:41 -07:00
Tao Bao
8853cb2f29 uncrypt: package on non-data partition should follow the right path
Fix the accidental change of behavior in [1]. OTA packages not on /data
partition should still go through the path that has validity checks and
wipe_misc() steps.

[1]: commit eaf33654c1.

Change-Id: I3e86e19f06603bfe6ecc691c9aa66a8a8a79c5fb
(cherry picked from commit fb4ccef1df)
2015-05-05 18:22:03 -07:00
Tao Bao
93cec9a0c4 Keep multiple kernel logs
Currently we are keeping one copy of the kernel log (LAST_KMSG_FILE).
This CL changes to keep up to KEEP_LOG_COUNT copies for kernel logs.

Bug: http://b/18092237
Change-Id: Ied862b5b70cbbae7775f59c78c32ec62aeeca655
(cherry picked from commit bef39710ff)
2015-05-05 14:23:41 -07:00
Tao Bao
6d820f2c91 Turn on text display for debuggable builds
For userdebug and eng builds, turn on the text display automatically
if no command is specified.

(cherry-pick of 785d22c88cda46972331c04ebc9df97371a696da.)

Bug: http://b/17489952
Change-Id: I38377c45f2a8e45ca788e5506695aa88c769cbcf
2015-05-04 10:21:54 -07:00
Elliott Hughes
4cf34d5d29 Fix mips64 minadbd_test build.
Looks like the mips64 linker isn't as good as the others at GCing
unused stuff, which means it needs libcutils.

Change-Id: I5f768e44514350fb81e5360351db3e9cc4201702
(cherry picked from commit dbb20c4863)
2015-05-01 22:40:06 -07:00
Elliott Hughes
15931924e1 Move minadb over to new API.
Change-Id: I889bcf2222245c7665287513669cae8831e37081
(cherry picked from commit 4039933c62)
2015-05-01 17:35:06 -07:00
Elliott Hughes
87ec73a264 Fix minadb_test build breakage.
Change-Id: I98bb900debb7d7dd57d3f8f84d605163ec192b03
(cherry picked from commit 3e7d82c621)
2015-05-01 17:26:45 -07:00
Elliott Hughes
2f5feedf1d Check all lseek calls succeed.
Also add missing TEMP_FAILURE_RETRYs on read, write, and lseek.

Bug: http://b/20625546
Change-Id: I03b198e11c1921b35518ee2dd005a7cfcf4fd94b
(cherry picked from commit 7bad7c4646)
2015-04-29 21:14:56 -07:00
Elliott Hughes
f7466f9f23 Stop using adb_strtok, and check argument validity.
(cherry picked from commit ba45ddf37c)

Change-Id: Iba4f77f7db54ca0184437bd8ea96abfadabc72a3
2015-04-28 10:52:52 -07:00
Andres Morales
5c025ac5c8 am 599fc2c0: (-s ours) am c94fa0b0: (-s ours) DO NOT MERGE Revert "Erase PST partition if its marked to be erased."
* commit '599fc2c0edbeb2ce8f38905fd770dbd7f43e647c':
  DO NOT MERGE Revert "Erase PST partition if its marked to be erased."
2015-04-27 07:18:50 +00:00
Andres Morales
599fc2c0ed am c94fa0b0: (-s ours) DO NOT MERGE Revert "Erase PST partition if its marked to be erased."
* commit 'c94fa0b01b43709531dfbcdb94abb2a1cc23be3d':
  DO NOT MERGE Revert "Erase PST partition if its marked to be erased."
2015-04-26 17:37:21 +00:00
Elliott Hughes
774f8f695a am 5a95719b: am 6725ebc7: Merge "Revert "Revert "init re-execs to set its security context now."""
* commit '5a95719bd9ac27d573388e6aa4b48715d9aa3d9e':
  Revert "Revert "init re-execs to set its security context now.""
2015-04-24 21:27:22 +00:00
Elliott Hughes
5a95719bd9 am 6725ebc7: Merge "Revert "Revert "init re-execs to set its security context now."""
* commit '6725ebc7b41ae0702adb28d9b40fbd392c6bfb9a':
  Revert "Revert "init re-execs to set its security context now.""
2015-04-24 20:39:15 +00:00
Elliott Hughes
6725ebc7b4 Merge "Revert "Revert "init re-execs to set its security context now.""" 2015-04-24 20:29:34 +00:00
Elliott Hughes
6f76dd58f4 Revert "Revert "init re-execs to set its security context now.""
This reverts commit c819dbe95b.

Bug: http://b/19702273
Change-Id: I5c75b148a12e644dd247a4df4f67dc9b4b9ff8cf
2015-04-24 12:42:46 -07:00
Nick Kralevich
daa9391ede am f6c03a80: am c690332c: Merge "Revert "init re-execs to set its security context now.""
* commit 'f6c03a80f08542afc82780f3b7cafe994d7a41e4':
  Revert "init re-execs to set its security context now."
2015-04-24 17:41:57 +00:00
Nick Kralevich
f6c03a80f0 am c690332c: Merge "Revert "init re-execs to set its security context now.""
* commit 'c690332c5e4008d0f58d7a356311a821ef07d0cf':
  Revert "init re-execs to set its security context now."
2015-04-24 17:05:48 +00:00
Nick Kralevich
c690332c5e Merge "Revert "init re-execs to set its security context now."" 2015-04-24 16:59:11 +00:00
Nick Kralevich
c819dbe95b Revert "init re-execs to set its security context now."
shamu isn't booting now

This reverts commit c57453d537.

Change-Id: I8efbf6260f5fcf983e5056fac6d03916415b944e
2015-04-24 16:58:33 +00:00
Elliott Hughes
352f9b60e5 am 7058b89f: am 38a82cac: Merge "init re-execs to set its security context now."
* commit '7058b89f02bc367bc2cd4e9c3ee70404e71cf48c':
  init re-execs to set its security context now.
2015-04-24 04:07:38 +00:00
Elliott Hughes
7058b89f02 am 38a82cac: Merge "init re-execs to set its security context now."
* commit '38a82cace581a888c5bc475754a20d8e92992fb2':
  init re-execs to set its security context now.
2015-04-24 03:34:40 +00:00
Elliott Hughes
38a82cace5 Merge "init re-execs to set its security context now." 2015-04-24 03:27:53 +00:00
Elliott Hughes
c57453d537 init re-execs to set its security context now.
Change-Id: I0a014f8dddfe775159903b5d6fa632733fef692c
2015-04-23 20:26:56 -07:00
Sami Tolvanen
5f40ad936f am 0391820c: am 0de2351e: Merge "Don\'t remove existing explicitly stashed blocks"
* commit '0391820cde1f27515e9fc8f556b72c3922af9d45':
  Don't remove existing explicitly stashed blocks
2015-04-17 17:32:21 +00:00
Sami Tolvanen
0391820cde am 0de2351e: Merge "Don\'t remove existing explicitly stashed blocks"
* commit '0de2351e6a6be685e1d68661dcf5f4902898cacd':
  Don't remove existing explicitly stashed blocks
2015-04-17 17:02:43 +00:00
Sami Tolvanen
0de2351e6a Merge "Don't remove existing explicitly stashed blocks" 2015-04-17 16:54:34 +00:00
Sami Tolvanen
43b748f254 Don't remove existing explicitly stashed blocks
When automatically stashing overlapping blocks, should the stash
file already exist due to an explicit stash command, it's not safe
to remove the stash file after the command has completed.

Note that it is safe to assume that the stash file will remain in
place during the execution of the next command, so we don't have
take other measures to preserve overlapping blocks.

The stash file itself will be removed by a free command when it's
no longer needed.

Bug: 20297065
Change-Id: I8ff1a798b94086adff183c5aac03260eb947ae2c
2015-04-17 13:07:08 +01:00
Tao Bao
9ac3dffe18 am 51f42b2d: am 4381767a: Merge "imgdiff: Avoid infinite loop if inflate fails"
* commit '51f42b2d20349490c62b9187bde317f25765e9b3':
  imgdiff: Avoid infinite loop if inflate fails
2015-04-16 21:39:52 +00:00
Tao Bao
51f42b2d20 am 4381767a: Merge "imgdiff: Avoid infinite loop if inflate fails"
* commit '4381767aa6410902e07376f62f66bbef83ebf2c4':
  imgdiff: Avoid infinite loop if inflate fails
2015-04-16 21:06:00 +00:00
Tao Bao
4381767aa6 Merge "imgdiff: Avoid infinite loop if inflate fails" 2015-04-16 20:55:38 +00:00
Elliott Hughes
a441133871 am 0a557b6b: am 7176a617: Merge "Don\'t use typedefs that hide *s."
* commit '0a557b6bc2a26afd3cb3a2e3dd2fdaf175b09cce':
  Don't use typedefs that hide *s.
2015-04-15 19:22:52 +00:00
Elliott Hughes
0a557b6bc2 am 7176a617: Merge "Don\'t use typedefs that hide *s."
* commit '7176a61718e7b45a8fde3a25eada0c9425d1dece':
  Don't use typedefs that hide *s.
2015-04-15 18:36:32 +00:00
Elliott Hughes
7176a61718 Merge "Don't use typedefs that hide *s." 2015-04-15 18:26:37 +00:00