Commit graph

61 commits

Author SHA1 Message Date
Jeff Sharkey
6d89610d1a Add fs_mgr option to enable/disable quotas.
To support upcoming disk usage calculation optimizations, this change
adds a new 'quota' mount flag.  As part of mounting an ext4 device,
we now enable/disable the quota feature using tune2fs to match the
requested value in the fstab.

When changing the quota status, we force a fsck pass on the device
before actually mounting it to prime the quota data structures which
are stored in hidden inodes.

Changing quota state and priming the data structures needs to happen
before we actually mount the device, so fs_mgr is the best place to
place this logic.

Test: builds, boots, enables and disables quota
Bug: 27948817
Change-Id: I7ccbf97cbc4a679bdd7a31a77be4b99aa9a88e66
2016-12-15 16:35:50 -07:00
liminghao
9a0fd1d5d3 fs_mgr: support to reserved some blocks for an ext2/3/4 partition.
These reserved blocks used to root or claim to CAP_SYS_RESOURCES process.

Change-Id: I4893bdb08399bf31a7640d4a63f4952cd636576f
Merged-In: I4893bdb08399bf31a7640d4a63f4952cd636576f

Signed-off-by: liminghao <liminghao@xiaomi.com>
2016-12-15 16:26:53 -07:00
Peter Enderborg
3c4dfb6fc4 Merge "Add support for max_comp_streams option for zram"
am: a9ea1e4d99

Change-Id: I0ef7127e1352b7dc9ae226bee7fe340d864f97ab
2016-11-18 23:25:21 +00:00
Peter Enderborg
4d217f02d3 Add support for max_comp_streams option for zram
With this option the fstab can include a parameter for zram
the enables more streams for kernels that does not have
dynamic stream task handling.

Test: Made sure max_comp_streams is set according to fstab.
Change-Id: I22e158a075a8a86b4e80d3b13989896929c0d223
2016-11-18 21:19:25 +00:00
Jin Qian
905948ed74 fs_mgr: fix clang static analyzer warning
Pointer from strdup is lost hence triggers mem leak warning from
clang, since ptr returned from basename may not point to start of
duplicated string any more.

Switch to use gnu version of basename which doesn't modify input
string so that strdup is no longer necessary.

Bug: 27126348

Change-Id: Iadb5cf343437a1e27e588ee067b084897633ea07
Merged-In: I937a68c01c223230932c932bffdd35da6503c3c4
2016-11-08 20:07:31 +00:00
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
Wei Wang
254f44363b Split fstab mount into 2 phases
This will make it possible to start some key services before mounting
data partition

(cherry picked from commit abfbec342f)

Bug: 30118894
Change-Id: Ia9f8cc035de6cc0df9a61605864915efa0266d7f
2016-09-06 11:39:05 -07: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
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
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
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
4e898a01fd Make file encryption type available
Bug: 28905864
Change-Id: I5f59f824fd92c32ff87aa730dc5c0f250564c0a9
2016-05-27 09:38:29 -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
Paul Lawrence
5b8a108ef5 Add fileencrypted=software/ice to fstab options
Bug: 28616054
Change-Id: If9dd4a17641412607ca4e4fed7f7dbf661ff0d25
2016-05-11 07:34:47 -07: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
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
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
Paul Lawrence
69080180ce Remove code to handle non-default file encryption
Change-Id: I6d986853929c0237c0d958329b8e9aab47907a00
2016-02-02 10:34:40 -08:00
Paul Lawrence
b262d6864e Add developer option to convert from FDE to FBE
This set of changes adds the screen that offers this conversion,
and the plumbing so the option is only available on suitable
devices.

It does not implement the conversion mechanism.

Change-Id: Idbe5ef5d5fad197cc8187e1b288c57feef2c2c0b
2015-11-04 05:09:32 -08:00
Ed Tam
e498c7ca2c resolved conflicts for merge of d0b6de41 to master
Change-Id: I1d1f6b1cdbd7ee441682c4258a11fb3198ca7d94
2015-04-13 18:01:33 -07:00
Ed Tam
438443e742 resolved conflicts for merge of 79f33846 to lmp-mr1-dev-plus-aosp
Change-Id: I24c60a2747931917a3ea09b953905ce0f4145280
2015-04-13 16:29:05 -07:00
Chris Fries
79f3384652 fs_mgr: introduce fs_mgr_format to format wiped partitions
Move fastboot's format logic into fs_mgr, to consolidate the knowledge
about how to do this (and when to wipe metadata).

Try to format these formattable paritions if they are wiped.

If formatting fails, we will fall out to let recovery mode handle it.

Bug: 20082763
Change-Id: I397cc197550e78d932e8a154fd234695c46dbe7b
2015-04-10 15:01:16 -07:00
Sami Tolvanen
856006047b am 93c4b6c8: am ddaebb24: am 284c5cb2: Merge "Set verity mode as the verified property value"
* commit '93c4b6c85ac4350029e1a78c16663f61c777ac14':
  Set verity mode as the verified property value
2015-04-07 10:02:26 +00:00
Sami Tolvanen
284c5cb2a1 Merge "Set verity mode as the verified property value" 2015-04-07 08:45:24 +00:00
Paul Lawrence
c410b3bd63 Revert "Revert "Adding e4crypt support""
Fix build break caused by original change

This reverts commit 84b0bab58f.

(cherry picked from commit bbb4c85bdcc9a1bce315ed9d61a228bb1b992a1c)

Change-Id: If0ead0f2656b69f33f72c64b03a05784455a4143
2015-04-01 13:48:06 -07:00
Paul Lawrence
b8c9d273a0 Revert "Revert "Adding e4crypt support""
Fix build break caused by original change

This reverts commit 84b0bab58f.

Change-Id: I99fbd7c3d1ed92db1f546033c8493bb71a327924
2015-03-31 13:02:13 -07:00
Sami Tolvanen
454742392f Set verity mode as the verified property value
Set the verity mode as the value for partition.%s.verified to make it
easier for userspace to determine in which mode dm-verity was started.

Change-Id: Icc635515f8a8ede941277aed196867351d8387cb
2015-03-31 09:12:00 +01:00
Sami Tolvanen
b042a2e8bd am c28e2598: am 3fdc2f2b: am d33c6c0e: Merge "Use structured format for verity metadata"
* commit 'c28e2598af394834dbf6532f1cf252705fabd76b':
  Use structured format for verity metadata
2015-03-26 16:27:46 +00:00
Paul Lawrence
84b0bab58f Revert "Adding e4crypt support"
This reverts commit 6095afc115.

Change-Id: Icedfe0036223d7f42eaaefc4a35ad0f2efb14e4e
2015-03-26 14:53:19 +00:00
Sami Tolvanen
946a0f3e19 Use structured format for verity metadata
Specify the location of verity metadata in fstab, and use a
type-length-value format for the metadata that allows other
data to be stored in the same location in an extensible way.

Change-Id: Id8711f7d51dc1e4e9a4d84f9951240f64528e69d
2015-03-24 09:02:47 +00:00
Paul Lawrence
6095afc115 Adding e4crypt support
Add file encryption flag to fstab.

If file encryption flag set in fstab, handle identically to block
encrypted volumes.

Requires matching change:
  https://googleplex-android-review.git.corp.google.com/#/c/642778/

Change-Id: I28c236959f2d7d5f0dccc8ea45c325ea0cf871fc
2015-03-23 14:16:43 -07:00
Sami Tolvanen
ef0947479a am 54bac178: am ddd0639e: Merge "Add init command to set verified properties"
* commit '54bac178ce0ee9d243bfbfc9c18dafbb14cd3f92':
  Add init command to set verified properties
2015-03-20 16:14:55 +00:00
Sami Tolvanen
acbf9bef43 Add init command to set verified properties
Add a command that updates dm-verity state and sets partition.%.verified
properties used by adb remount.

This is needed in init since fs_mgr cannot set properties:
    I6a28cccb1ccce960841af20a4b20c32d424b5524

Change-Id: I0fdf5bc29c56690dcadff9d0eb216d3c68483538
2015-03-19 10:11:17 +00:00
JP Abgrall
fe6fcc4cc1 fs_mgr: recognize a notrim mountpoint flag
Some partitions don't need trimming.
Needs a vold:fstrim change

Bug: 19624276
Change-Id: I8df715bd18688d7921afa2f3743f7d2a68760699
2015-03-05 17:30:53 -08:00
Sami Tolvanen
6904e0c263 am a88fb24a: Merge "Add fs_mgr support for dm-verity modes"
* commit 'a88fb24ab43eec9710a0d4d15aedb6d4bc51a2ec':
  Add fs_mgr support for dm-verity modes
2015-03-04 22:44:37 +00:00
Sami Tolvanen
51bf11ad95 Add fs_mgr support for dm-verity modes
Add support for dm-verity modes and storing persistent state in
a location specified by the following properties:

  ro.verity.state.location
  ro.verity.state.offset

If these properties do not exist, dm-verity is always loaded in
EIO mode. If the properties do exist, but the location does not
have valid state data, dm-verity is loaded in RESTART mode. The
mode is updated to LOGGING if a dm-verity triggered restart has
occurred.

Change-Id: Ibb82953594d234f81ad21c40f524190b88e4ac8f
2015-03-04 03:07:35 +00:00
Paul Lawrence
317b4024a2 Revert "Make encryption configurable"
This reverts commit bda6272446.

The original fix seems to have led to boot failures in QA. Rather than
risk shipping, revert the change. Bug 18764230 reopened.

Requires change
    https://googleplex-android-review.git.corp.google.com/#/c/629764/

Bug: 19278390
Bug: 19199624

Change-Id: I8b6ab585666f2b0f585ffb2a5f61ac2e3462e06e
2015-02-06 17:32:09 +00:00
Paul Lawrence
36d0eaecd7 Make encryption configurable
Delay mounting encryptable but unencrypted volumes until we can
check the ro.vold.forceencrypt flag, then optionally encrypt.

Requires matching vold change from
    https://googleplex-android-review.git.corp.google.com/#/c/615309/

Bug: 18764230
Change-Id: If22008be8de6a4f3216b349f81ace49be1730314
2015-01-28 11:41:53 -08:00
Paul Lawrence
bda6272446 Make encryption configurable
Delay mounting encryptable but unencrypted volumes until we can
check the ro.vold.forceencrypt flag, then optionally encrypt.

Requires matching vold change from
    https://googleplex-android-review.git.corp.google.com/#/c/615309/

Bug: 18764230
Change-Id: If22008be8de6a4f3216b349f81ace49be1730314
2015-01-21 10:03:29 -08:00
Paul Lawrence
ec900bba20 Revert "Revert "Enable verity on userdebug, and add disable-verity to adb""
This reverts commit 152d2d4234.

Fixed build error, and also fixed memory leak spotted from warning.

(cherry-pick of bbb36319119edde9377fb80015235893c30d2bc9.)

Bug: 17691572
Change-Id: I23b5ba537f7b557432041d4338b38b9be434e981
2014-12-09 17:02:17 -08:00
Paul Lawrence
bbb3631911 Revert "Revert "Enable verity on userdebug, and add disable-verity to adb""
This reverts commit 152d2d4234.

Fixed build error, and also fixed memory leak spotted from warning.

Bug: 17691572
Change-Id: I23b5ba537f7b557432041d4338b38b9be434e981
2014-10-09 09:05:36 -07:00
Nick Kralevich
152d2d4234 Revert "Enable verity on userdebug, and add disable-verity to adb"
Build is broken.

system/core/fs_mgr/fs_mgr_verity.c: In function 'fs_mgr_setup_verity':
system/core/fs_mgr/fs_mgr_verity.c:103:20: error: 'verity_table_signature' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     if (!RSA_verify(key,
                    ^
system/core/fs_mgr/fs_mgr_verity.c:374:11: note: 'verity_table_signature' was declared here
     char *verity_table_signature;
           ^
cc1: all warnings being treated as errors
make: *** [out/target/product/minnow/obj/STATIC_LIBRARIES/libfs_mgr_intermediates/fs_mgr_verity.o] Error 1
make: *** Waiting for unfinished jobs....

This reverts commit d4cea0bc16.

Change-Id: I6862cc79ef9d944a2472b6fb2e46dae514cea8ce
2014-10-08 23:55:05 +00:00
Paul Lawrence
d4cea0bc16 Enable verity on userdebug, and add disable-verity to adb
Bug: 17691572

Change-Id: I58f588f318e7952d06a41325337d946d7c007e31
2014-10-08 15:24:37 -07:00
Paul Lawrence
cf234dc7e0 Preserve errno from fsmgr_do_mount
Bug: 17358530
Change-Id: I4cd7403c0b7c4f878d6afa5199f998e6f614adb9
2014-09-11 17:31:49 -07:00