Commit Graph

282 Commits

Author SHA1 Message Date
Hung-ying Tyan 46bfc918d0 Merge "Mount /vendor and /odm early"
am: 35569e9d68

Change-Id: I9b5360bf3036fa88e770d686ab06b8f4cff80d7c
2016-08-18 05:04:43 +00:00
Hung-ying Tyan 99c4a8a6b3 Mount /vendor and /odm early
Right now these two partitions are mounted in the fs stage of the init
process. As a result, many vendor/ODM files needed earlier in the boot
process (e.g., init.<hardware>.rc, fstab.<hardware>.rc,
uevent.<hardware>.rc, SELinux policy files etc) can only live on the root
partition.

To prevent vendors/ODMs from polluting the root partition, this patch makes
it possible to mount the vendor and ODM partitions in the first stage of the
init process. The fstab info of both partitions to be mounted early is
composed from new kernel cmdline arguments android.early.prefix and
android.early.fstab.

For example, with:
android.early.prefix=/sys/devices/1010000.msdc0/mmc_host/mmc0/mmc0:0001/block/mmcblk0/
android.early.fstab=mmcblk0p10+/odm+ext4+ro+verify\nmmcblk0p09+/vendor+ext4+ro+verify

the final fstab string will be:
/sys/devices/1010000.msdc0/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p10 /odm ext4 ro verify
/sys/devices/1010000.msdc0/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p09 /vendor ext4 ro verify

The android.early.prefix is optional. When it is missing, the final fstab
string will be directly converted from android.early.fstab.

This patch also makes sure that the early mounted partitions are dm-verity
enabled so that they are trust worthy to store system files.

BUG=27805372

Change-Id: I3cf32482a5ec65445ba3aedab2164c7ba8f12694
2016-08-17 17:21:35 +08:00
Josh Gao 87ef590bc1 Merge "libcrypto_utils: convert to Soong."
am: c1a9a21ffe

Change-Id: I9cf76646d4537750c4d4080234d3384fb307e610
2016-08-08 18:33:49 +00:00
Josh Gao 47763c3a09 libcrypto_utils: convert to Soong.
Bug: http://b/30708454
Change-Id: Iaad64272ced766f87e67f2877e990afccc558065
2016-08-05 18:07:36 -07:00
Chih-Hung Hsieh be25035ddb Merge \"Fix clang-tidy performance warnings in fs_mgr.\"
am: 44c909d467

Change-Id: Iff90e929bfb2cf1335e5764b99454601eb6316ef
2016-07-28 17:18:36 +00:00
Chih-Hung Hsieh 73da05d354 Fix clang-tidy performance warnings in fs_mgr.
* Use const reference type for for-loop index variables
  to avoid unnecessary copy.

Bug: 30413223
Change-Id: I5514384ef3af77c00aa3e8417acd8d70981e0afb
Test: build with WITH_TIDY=1
2016-07-27 16:12:54 -07:00
Elliott Hughes 73d363bbc1 Merge \"Make klog_fd thread-safe and make klog_init a no-op.\"
am: 588b770063

Change-Id: I884276a8f8b8209f6e956c5fb410e8265184e1b5
2016-07-08 17:05:25 +00:00
Elliott Hughes 171a829c39 Make klog_fd thread-safe and make klog_init a no-op.
I'll come back and remove klog_init when I've removed other calls to it.

Change-Id: Iad7fd26d853b4ddc54e9abd44516b6f138cbbfcb
Test: booted N9, looked at "adb shell dmesg" output.
2016-06-29 16:16:41 -07:00
Tao Bao e96a44e26c Merge \\"fs_mgr: Track the bootloader_message struct change.\\" am: 4d34653720
am: 6f110854ce

Change-Id: I45831ba35a17b68afd3adda55120e78f6a10779d
2016-06-14 16:22:59 +00:00
Tao Bao 4d34653720 Merge "fs_mgr: Track the bootloader_message struct change." 2016-06-14 16:09:16 +00:00
Tao Bao 96c9f2d047 fs_mgr: Track the bootloader_message struct change.
A/B-specific info (slot_suffix) has been moved into struct
bootloader_message_ab.

Bug: 29193360
Change-Id: Ic655e23a2d74366e713807add15a6e9d04535cf5
2016-06-09 15:13:15 -07:00
Sami Tolvanen 98f1ea00e5 fs_mgr: validate corrected signatures
If signature verification fails and we have an error corrected
signature available, attempt to verify that instead.

Needs changes from
  Ie913c21ba1d07d6df4c6feeb7226b2ec963f4d19

Bug: 28943429
Change-Id: I7d48701916fe430b17aa05acb120f22a1802733d
(cherry picked from commit 830126637a)
2016-06-08 09:42:59 -07:00
Mattias Nissler 725ca56851 Merge "fs_mgr: Remove incorrect free() on error paths in load_key()" am: 35d84096e9
am: 6f29ec0197

* commit '6f29ec0197a1b146d302b3e158c258bfef4566f7':
  fs_mgr: Remove incorrect free() on error paths in load_key()

Change-Id: Ic01cbaf499e494f4edcc3e4261139d2b365d3a59
2016-06-07 21:15:08 +00:00
Mattias Nissler 35d84096e9 Merge "fs_mgr: Remove incorrect free() on error paths in load_key()" 2016-06-07 21:00:03 +00:00
Chuanxiao Dong aa0318c9e9 Merge "fs_mgr: fix encryptable=footer support" am: b67fed557f
am: 7f06a23414

* commit '7f06a234140a1dc5c0160fca03b7fcf0fd35939a':
  fs_mgr: fix encryptable=footer support

Change-Id: Iea56bd3856a241100bd23b3a06c3284c47bff5c0
2016-06-07 17:00:16 +00:00
Treehugger Robot b67fed557f Merge "fs_mgr: fix encryptable=footer support" 2016-06-07 16:49:39 +00:00
Mattias Nissler 31404e58e9 fs_mgr: Remove incorrect free() on error paths in load_key()
This fixes a bug introduced by
https://android-review.googlesource.com/#/c/212781/ which would make
fs_mgr crash when hitting one of the error paths.

Bug: 28585197
Change-Id: I40e6612e2eb3e6f584e70c608afc6d4378d73c4f
2016-06-07 16:37:48 +02:00
Sami Tolvanen 4171b2b724 resolve merge conflicts of eacbb82 to nyc-dev-plus-aosp
Change-Id: Ia3077f826c1d422932b62684ae0d53935abfe807
2016-06-06 22:56:23 -07:00
Sami Tolvanen 830126637a fs_mgr: validate corrected signatures
If signature verification fails and we have an error corrected
signature available, attempt to verify that instead.

Needs changes from
  Ie913c21ba1d07d6df4c6feeb7226b2ec963f4d19

Bug: 28943429
Change-Id: I7d48701916fe430b17aa05acb120f22a1802733d
2016-06-06 13:54:00 -07:00
Jeff Vander Stoep c1b985435f resolve merge conflicts of adadb7d to nyc-dev-plus-aosp
Change-Id: I03bcd3f68f49160ccaa820b3983ca9a88adf6c57
2016-06-01 11:46:42 -07:00
Treehugger Robot 58ea31cc90 Merge "fs_mgr: pass sehandle to ext4 format routine" 2016-06-01 17:30:09 +00:00
Chih-Hung Hsieh 5fb629a212 resolve merge conflicts of e845c04 to nyc-dev-plus-aosp
Change-Id: I423f722dcc3821b9be52613d68640b49cbac70a6
2016-05-27 16:04:21 -07:00
Chih-Hung Hsieh c713bce901 Fix misc-macro-parentheses warnings in init and other core modules.
Bug: 28705665
Change-Id: Ice67cebb8c42538f8fb9cf1756678f41a9d68a31
2016-05-18 18:11:49 -07:00
Badhri Jagan Sridharan 348f3590f0 Merge "fs_mgr: update block device reference in verity metadata" am: 4cefb91611
am: 30c9aed0be

* commit '30c9aed0becc77a31a2b86b8683db5630fc95024':
  fs_mgr: update block device reference in verity metadata

Change-Id: I2d024cefaa15b62cb6b0ffa6fe57c904304c5160
2016-05-16 18:13:45 +00:00
Jeremy Compostella dfd2478bd1 fs_mgr: update block device reference in verity metadata
The dm-verity metadata contains the block device path that is given to
the dm-android-verity driver.  If the device is using slot A/B, this
path is missing the slot suffix.

This patch makes fs_mgr replace all the block device path reference
with the one including the active slot suffix.

Change-Id: Ib624d0d18b12a8a287cac7f15605a2e0fb7c97c6
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
2016-05-16 16:37:24 +00:00
William Roberts 875476d8ed fs_mgr: pass sehandle to ext4 format routine
When fs_mgr_do_format() is executed, fs_mgr creates a new
blank data file system. However, that filesystem is not
labeled and causes some unlabeled denials on early boot.

Example Denial:
avc: denied { search } for pid=2535 comm="logd" name="/" dev="mmcblk0p9" ino=2 scontext=u:r:logd:s0 tcontext=u:object_r:unlabeled:s0 tclass=dir permissive=1

To correct this, pass sehandle to the internal ext4 routine.
This way the ext4 filesystem will be labeled at creation and
the root inode will have a label.

Change-Id: Ieeecaa8bbc258e6d743d281dd956bdaca98b365f
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2016-05-13 11:28:24 -07:00
Matthew Bouyack 2e7620594e Merge "If we fail to format a blank partition, try recovery" into nyc-dev
am: 6846d22629

* commit '6846d22629e7bf9d53006d4f40c9c5f81b2b45f0':
  If we fail to format a blank partition, try recovery

Change-Id: I6879f99f6901b24a3a51a35c3fc629c49bb64091
2016-05-03 23:22:58 +00:00
Matthew Bouyack 9c59cbcf37 If we fail to format a blank partition, try recovery
Bug: 28303663

Change-Id: Iab802997dcd2a4416417228c92362518c7f1a82f
2016-05-03 10:01:03 -07:00
Daniel Rosenberg e99283103b Merge "Add nofail fstab option" 2016-04-14 00:12:44 +00:00
Elliott Hughes 9c4a0e0216 Merge changes from topic \'boringssl_conversion\' am: 52eb93c
am: 0781351

* commit '07813516502d12cfeabef94838e916c0cf4f3b46':
  Switch fs_mgr and adb to libcrypto_utils.
  Add libcrypto_utils.

Change-Id: Ib50abd66d546a2b2c7a1249043e1b39c2147c674
2016-04-12 23:22:11 +00:00
Mattias Nissler 097b6bbc76 Switch fs_mgr and adb to libcrypto_utils.
Update code and dependencies to use BoringSSL + libcrypto_utils
instead of mincrypt.

Change-Id: Ic75164bd50c84b81b6310e27a67d4b3c174984f9
2016-04-12 23:04:11 +00:00
Daniel Rosenberg dde4e5a071 resolve merge conflicts of 2857bd1 to nyc-dev
am: e3a3288

* commit 'e3a3288dddcde8c180dfe2935335ca3c475e37a2':
  Add nofail fstab option

Change-Id: I42d1d4862f9f630999f2479b9a9b9e14431fe8bf
2016-04-12 22:46:28 +00:00
Daniel Rosenberg e3a3288ddd resolve merge conflicts of 2857bd1 to nyc-dev
Change-Id: I3dc666cd44deb3e8438c2a482328f79e7a67e81e
2016-04-12 14:28:09 -07:00
Daniel Rosenberg de551ffee9 Add nofail fstab option
This option allows fs_mgr to ignore mount errors on an optional
partition to allow booting to continue.

Bug: 28071890
Change-Id: I71a2b3c1c573297cab18884b4c4bd7c27ced2901
2016-04-12 14:06:25 -07:00
Daniel Rosenberg d38e3c522c Add nofail fstab option
This option allows fs_mgr to ignore mount errors on an optional
partition to allow booting to continue.

Bug: 28071890
Change-Id: I71a2b3c1c573297cab18884b4c4bd7c27ced2901
2016-04-07 20:37:31 -07:00
Robb Glasser 2f5d1da43e Merge "Revert "Revert "HACK: Run e2fsck with -f""" into nyc-dev
am: a1a8a82

* commit 'a1a8a82e5dd177b84ab78cbb1630c10057bab80c':
  Revert "Revert "HACK: Run e2fsck with -f""

Change-Id: Ifc6b20404e5057093dbe5aa5f1bf82d0d6f568a7
2016-04-05 20:00:46 +00:00
Robb Glasser 3fb176cb46 Revert "Revert "HACK: Run e2fsck with -f""
bug:28013112

This reverts commit 07068de789.

Change-Id: I1e507f2244a2960e79524ef2aef427f25d79f905
2016-04-05 18:43:37 +00:00
Paul Lawrence 131aabdf0e Merge "Revert "HACK: Run e2fsck with -f"" into nyc-dev
am: dc6893c

* commit 'dc6893ce9fda33740e7c59b6a49433e03da9a66b':
  Revert "HACK: Run e2fsck with -f"

Change-Id: I8943c573dea631e4324b3b6a621dc791c55f667b
2016-03-30 20:55:19 +00:00
Paul Lawrence 07068de789 Revert "HACK: Run e2fsck with -f"
This reverts commit 2cd762d932.

This change adds 12 seconds or so to boot times - we need to revert it
and see if we can find a proper fix to the original problem if it is
still occurring.

Bug: 27849759
Change-Id: Ib3692e436c08468a51529f256f2ce5e9ccd2d35d
2016-03-29 18:02:33 +00:00
Chuanxiao Dong d78dff1622 fs_mgr: fix encryptable=footer support
If the userdata partition has the encryptable=footer fstab option,
fs_mgr must leave room for the crypt footer.

Change-Id: Id07818c5d93aafc27577f72fb0a780f26db51b16
Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
2016-03-08 17:20:26 +01:00
George Burgess IV 02f689e11a Merge "Cleanup uses of sprintf so we can deprecate it." am: 2c5b89a64a
am: 3368bdebba

* commit '3368bdebba02316710bafc5bce120eec388365fb':
  Cleanup uses of sprintf so we can deprecate it.
2016-03-08 07:41:39 +00:00
George Burgess IV e7aa2b2c83 Cleanup uses of sprintf so we can deprecate it.
Also cleans up two instances of open() with useless mode params, and
changes a few uses of snprintf to use sizeof(buffer) instead of
hardcoded buffer sizes.

Change-Id: If11591003d910c995e72ad8f75afd072c255a3c5
2016-03-07 18:40:40 -08:00
Paul Lawrence bdd5908766 Merge "Distinguish between unencrypted and unencryptable" into nyc-dev
am: 72d2e06f4e

* commit '72d2e06f4e10d0d11526eb9bb09a3ef23302729c':
  Distinguish between unencrypted and unencryptable
2016-03-07 16:56:51 +00:00
Paul Lawrence 1098aacde4 Distinguish between unencrypted and unencryptable
Set ro.crypto.state flag to unencrypted and unsupported accordingly

Bug: 18002358
Change-Id: I1f88ce9704c5505d7b63256e2ebe5f8441c79ad0
2016-03-04 15:52:33 -08:00
Mohamad Ayyash 70c04ec218 Merge "Revert "Revert "Update make_ext4fs_internal param-list to match new implementation""" into nyc-dev
am: 5dac46ac94

* commit '5dac46ac944da477c1abcba70cf424064ca233fe':
  Revert "Revert "Update make_ext4fs_internal param-list to match new implementation""
2016-02-23 23:13:46 +00:00
Mohamad Ayyash 73b64aa8f8 Revert "Revert "Update make_ext4fs_internal param-list to match new implementation""
This reverts commit 527cc0b7a4.

Change-Id: I0c5705ae6e0188797b910df3ada614cacf1d835e
Signed-off-by: Mohamad Ayyash <mkayyash@google.com>
2016-02-19 20:40:22 -08:00
Mohamad Ayyash 33748928da Revert "Update make_ext4fs_internal param-list to match new implementation"
am: 527cc0b7a4

* commit '527cc0b7a4d2a72f38d6f956a03864391f5562f1':
  Revert "Update make_ext4fs_internal param-list to match new implementation"
2016-02-19 21:23:33 +00:00
Mohamad Ayyash 527cc0b7a4 Revert "Update make_ext4fs_internal param-list to match new implementation"
This reverts commit 6d94dfee45.

Change-Id: Iec0832740e321e31a78a31d5358542d2ed4455fa
2016-02-19 21:16:38 +00:00
Mohamad Ayyash 8e9878f3e6 Update make_ext4fs_internal param-list to match new implementation
am: 6d94dfee45

* commit '6d94dfee451dccc07c9c158da97f9393ac4e0a83':
  Update make_ext4fs_internal param-list to match new implementation
2016-02-19 19:38:48 +00:00
Mohamad Ayyash 6d94dfee45 Update make_ext4fs_internal param-list to match new implementation
BUG: 26839493
Change-Id: I4cd316ebc91457e2ec31c0e8b116798d9f94a223
Signed-off-by: Mohamad Ayyash <mkayyash@google.com>
2016-02-19 18:34:59 +00:00