Commit Graph

304 Commits

Author SHA1 Message Date
Wei Wang d61a7e2da4 Split fstab mount into 2 phases
This will make it possible to start some key services before mounting
data partition

Bug: 30118894
Change-Id: Ia9f8cc035de6cc0df9a61605864915efa0266d7f
(cherry picked from commit abfbec342f)
2016-09-06 21:04:26 +00:00
Hung-ying Tyan 1263097328 Merge "Mount /vendor and /odm early" am: 35569e9d68 am: 46bfc918d0
am: d1f49a43fd

Change-Id: I6dc53f60771ad0e660e248efdc1b13734fba3061
2016-08-18 05:10:41 +00:00
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 7480771909 Merge "libcrypto_utils: convert to Soong." am: c1a9a21ffe am: 87ef590bc1
am: a1da027a3c

Change-Id: Ie693d3de13b0df24ea83e70af3fa385a77ed8b33
2016-08-08 18:39:23 +00: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 3afa5a9afa Merge \\\"Fix clang-tidy performance warnings in fs_mgr.\\\" am: 44c909d467 am: be25035ddb
am: aa0628ec50

Change-Id: I28c0f3cf75c1e225b3d24b77934d055dd9edf854
2016-07-28 17:24:29 +00: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 6605b0b23a Merge \\\"Make klog_fd thread-safe and make klog_init a no-op.\\\" am: 588b770063 am: 73d363bbc1
am: 7288ac3982

Change-Id: I46bbcb64eecc01ec7bd8bb502237c1b9057befc4
2016-07-08 17:12:48 +00: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
Sami Tolvanen 6de58ac5d7 fs_mgr_verity: fix verity_update_state for A/B devices
am: 9af867e7bd

Change-Id: I676d0ece31d3cc23701923e5cda2be2155d0c00e
2016-06-20 19:38:50 +00:00
Sami Tolvanen 9af867e7bd fs_mgr_verity: fix verity_update_state for A/B devices
Use the correct device name when system is mounted as root, and
validate dm-verity status to avoid confusing it with dm-linear.

Bug: 29277442
Change-Id: I36e115189f9a9430bad4bf89f26a376bcb8e8168
2016-06-17 17:17:04 -07:00
Tao Bao df4a278398 Merge \\\"fs_mgr: Track the bootloader_message struct change.\\\" am: 4d34653720 am: 6f110854ce
am: e96a44e26c

Change-Id: Icbd6307328440c7c615e6af51a6e9ea4945e3d7d
2016-06-14 16:27:37 +00: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 1d89cfa31c Merge "fs_mgr: Remove incorrect free() on error paths in load_key()" am: 35d84096e9 am: 6f29ec0197
am: 725ca56851

* commit '725ca56851b9a54c4baa07e22ac42587124af085':
  fs_mgr: Remove incorrect free() on error paths in load_key()

Change-Id: I1101606fbb8abfc012442cb52952d1377240956d
2016-06-07 21:17:40 +00: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 8b1707ec3a Merge "fs_mgr: fix encryptable=footer support" am: b67fed557f am: 7f06a23414
am: aa0318c9e9

* commit 'aa0318c9e9b97b2644c7428313fbeec4f86d12fd':
  fs_mgr: fix encryptable=footer support

Change-Id: Ic8d662bd960a4e40f0a3073ff2442b5d1eb20d99
2016-06-07 17:03:02 +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 b04dbbcd1e resolve merge conflicts of d6f5af3 to nyc-mr1-dev-plus-aosp
Change-Id: Ie579411df1d4f04a7f5f29457fbcf7b47c9d09ec
2016-06-06 23:07:54 -07: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 d6f5af35d5 Merge "fs_mgr: validate corrected signatures" into nyc-dev
am: eacbb824c9

* commit 'eacbb824c9ee2ccec9e1de641d03e7370888eabc':
  fs_mgr: validate corrected signatures

Change-Id: I3986a59d498a22769611216f5ed475f31332b2c9
2016-06-07 00:05:41 +00: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
William Roberts cc575f5955 resolve merge conflicts of adadb7d to nyc-dev-plus-aosp
am: c1b985435f

* commit 'c1b985435f3a4515534921f6b3b763d0868c3403':
  fs_mgr: pass sehandle to ext4 format routine

Change-Id: I64de82853d2ad29909a0d3d327c6b4271b882f5a
2016-06-01 19:17:11 +00: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
Stephen Hines 496e073864 resolve merge conflicts of 5fb629a to nyc-mr1-dev-plus-aosp
Change-Id: I6424b08182637e7885b57119bc5eb6d5e3708c45
2016-05-27 17:01:44 -07:00
TreeHugger Robot 8024f8f9ea Merge "fs_mgr: update block device reference in verity metadata" into nyc-mr1-dev 2016-05-27 23:14:16 +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
Paul Lawrence 7c198d3eef Make file encryption type available
am: 4e898a01fd

* commit '4e898a01fd4df477f079a6140590f5ec8535102b':
  Make file encryption type available

Change-Id: I72de48f819ab957f4e87a194b714ae667798f136
2016-05-27 17:13:29 +00:00
Paul Lawrence 4e898a01fd Make file encryption type available
Bug: 28905864
Change-Id: I5f59f824fd92c32ff87aa730dc5c0f250564c0a9
2016-05-27 09:38:29 -07:00
Jeremy Compostella 32cabf25aa 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>

Bug: 28845874
2016-05-26 15:37:37 -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
Jeremy Compostella 981925e6d2 Merge "fs_mgr: update block device reference in verity metadata" am: 4cefb91611 am: 30c9aed0be
am: 348f3590f0

* commit '348f3590f0c758916f7c27d47b00d40e609baf63':
  fs_mgr: update block device reference in verity metadata

Change-Id: Ie8dcf633b193afd63803d8a0390cf203bda8857d
2016-05-16 18:16:38 +00: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
Paul Lawrence c27d99aea2 Add fileencrypted=software/ice to fstab options
am: 5b8a108ef5

* commit '5b8a108ef5c9ec2a11a1b7afd4e9d4a4d8444854':
  Add fileencrypted=software/ice to fstab options

Change-Id: I5bc87bb273fed4316a5991e91ce97647ae44c500
2016-05-11 22:20:39 +00:00
Paul Lawrence 5b8a108ef5 Add fileencrypted=software/ice to fstab options
Bug: 28616054
Change-Id: If9dd4a17641412607ca4e4fed7f7dbf661ff0d25
2016-05-11 07:34:47 -07:00
Matthew Bouyack 0697fbddb3 Merge "If we fail to format a blank partition, try recovery" into nyc-dev am: 6846d22629
am: 654174e2af

* commit '654174e2af9deba47c3e421638b2ae9407270d15':
  If we fail to format a blank partition, try recovery

Change-Id: I03c7be4559c8168579edbb40f98b927c4902deb5
2016-05-03 23:25:20 +00: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