Commit graph

141 commits

Author SHA1 Message Date
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
Mohamad Ayyash
030ef35966 Revert "Revert "fs_mgr_verity: Add support for squashfs""
This reverts commit 7b97c7a3fa.

Change-Id: Id47e70479fe9247b7936f2e54d4dbfbb4f63f635
2015-04-08 18:08:00 -07:00
Mohamad Ayyash
e322ae1996 Merge "Revert "fs_mgr_verity: Add support for squashfs"" 2015-04-08 19:34:10 +00:00
Mohamad Ayyash
7b97c7a3fa Revert "fs_mgr_verity: Add support for squashfs"
This reverts commit 807f47004f.

Change-Id: I2d7972c0828c842b44747dd08fbe44668f2a55db
2015-04-08 19:31:00 +00:00
Mohamad Ayyash
70f81ceeeb Merge "fs_mgr_verity: Add support for squashfs" 2015-04-08 19:02:11 +00:00
Sami Tolvanen
02f1d80ae2 Merge "Restore verity state when verified partition is reflashed" 2015-04-07 08:45:34 +00:00
Sami Tolvanen
284c5cb2a1 Merge "Set verity mode as the verified property value" 2015-04-07 08:45:24 +00:00
Mohamad Ayyash
807f47004f fs_mgr_verity: Add support for squashfs
- Cleanup the code to get filesystem size in a block device
- Add support to reading size of squashfs in a block device

Change-Id: I3848a705ed4dc2fc9afad20331f0fdecfee545c5
Signed-off-by: Mohamad Ayyash <mkayyash@google.com>
2015-04-06 16:20:26 -07:00
Dan Albert
bbbc634e09 Link libc++_static into fs_mgr.
Change-Id: Ic2461d3a30dbd8a22f9800a33fac27c658340b21
2015-04-01 13:26:04 -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
6122edbac4 Restore verity state when verified partition is reflashed
Store verity state separately for each verified partition, and store
a hash of the last verity table signature for each partition. If the
signature changes, assume the partition has been reflashed and reset
verity state.

Bug: 20006638
Change-Id: I1c85fb816bfec1a54b1033c938bf1fdaf572f849
2015-03-31 18:44:37 +00: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
4d3ead9d7c Fix build
Fix build breakage in aosp_fugu-userdebug_clang (linux) caused
by Id8711f7d51dc1e4e9a4d84f9951240f64528e69d

Change-Id: Icd04aeaf131be045cf5788846ae9832e6cbbb944
2015-03-26 11:44:42 +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
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
Sami Tolvanen
9fabbbfb03 Merge "Do not call libcutils property_set in init through libfs_mgr" 2015-03-11 09:14:55 +00:00
Sami Tolvanen
86cddf4074 Do not call libcutils property_set in init through libfs_mgr
Both init and libcutils define a property_set function. The init
version sets the property directly while libcutils simply calls
__system_property_set, which sends a message to init to set the
property.

Since libfs_mgr is statically linked to libcutils, any calls to
property_set end up sending a message to init and waiting for a
response. When libfs_mgr is further statically linked to init,
this leads to init sending a message to itself when property_set
is called in fs_mgr.

Because send_prop_msg in bionic only waits for a response for
250ms, this does not cause a deadlock. However, using libcutils
to set a property in the init process is hardly a good idea.

This change removes the property_set call from fs_mgr_verity.c.
If this property is required later, it should be set elsewhere.

Change-Id: I6a28cccb1ccce960841af20a4b20c32d424b5524
2015-03-05 00:44:12 +00:00
Andreas Gampe
8c2c089ae2 am 291ce5b8: Merge "Fs_mgr: Fix format code"
* commit '291ce5b82d8a504be69132f1827e20041833c488':
  Fs_mgr: Fix format code
2015-03-04 22:44:44 +00: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
Andreas Gampe
eb69e85768 Fs_mgr: Fix format code
Suggested printing for off_t is to cast to intmax_t and print that.

Follow-up to https://android-review.googlesource.com/133111.

Change-Id: Icff6844044c3d0fa6372c3f399453a526fd89954
2015-03-04 13:29:12 -08:00
Sami Tolvanen
a88fb24ab4 Merge "Add fs_mgr support for dm-verity modes" 2015-03-04 20:41:49 +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
Sami Tolvanen
622d44d864 am fbb3f8ca: Merge "Set underlying block device RO when enabling verity"
* commit 'fbb3f8ca499b04c82437155f87c8666cad607c6b':
  Set underlying block device RO when enabling verity
2015-02-28 00:43:58 +00:00
Sami Tolvanen
214f33b8c0 Set underlying block device RO when enabling verity
Currently, when verity is set up on a block device, the underlying
device is still accessible directly. Change the existing function
fs_set_blk_ro visible to other fs_mgr modules, change the behavior
to match the comment above the function definition, and call it to
disable write access to the block device when setting up verity.

Bug: 18609347
Change-Id: I7884175df15f9161174788d74d20a08e4cd472ca
2015-02-27 11:28:34 +00:00
Bill Yi
0cc8da0947 Merge commit '9c1bc6bbc82e3e4f005e9fcacfca94b2dd82ca31' into HEAD 2015-02-19 14:33:24 -08:00
Yabin Cui
e2d63af002 Move sprintf to snprintf.
Bug: 19340053
Change-Id: Id0d866e6195ed4752b4be6081eeb2aab8b1dbe9a
2015-02-17 19:27:51 -08:00
Paul Lawrence
a173891532 am 317b4024: Revert "Make encryption configurable"
* commit '317b4024a2a46b8c57abfa08f2a649df13572bd3':
  Revert "Make encryption configurable"
2015-02-07 00:11:12 +00:00
Nick Kralevich
846c8e0d34 am 17b5b352: Merge "fs_mgr: error check umount calls / add retry logic"
* commit '17b5b3520094de679c9e43a872c02d15758c83b8':
  fs_mgr: error check umount calls / add retry logic
2015-02-06 20:34:57 +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
Nick Kralevich
7294eb6cae fs_mgr: error check umount calls / add retry logic
Don't silently ignore umount errors. At a minimum, log them.

Add strerror(errno) to another umount call, to make sure we get
some actionable data.

check_fs: try 5 times umounting the filesystem. It appears that
the umount is failing, perhaps because some service is opening
the file on the device or other error. Try unmounting it multiple
times in case it's a transient problem and we can recover.

Bug: 19199624
Bug: 19156134
Change-Id: I7213eb52d55116fb2419a36494d26d5e159981a7
2015-02-05 20:50:22 -08: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
2f7ee6b7dd Provide a way to select force encryption from vendor partition
This allows a vendor to force encryption on devices via a vendor
partition flag:

ro.vold.forceencryption 1

Bug: 18764230
Change-Id: Id0049ce64e34e4f6f96e593aadd70c277ac131c8
2015-01-28 11:41:35 -08:00
Paul Lawrence
7e890a4d32 am bda62724: Make encryption configurable
* commit 'bda6272446454886339841a62daaa1b66c07ad60':
  Make encryption configurable
2015-01-26 16:22:49 +00:00
Elliott Hughes
0944e305ff am 4e0bdd10: Merge "fs_mgr: Support filesystem labels in fstab"
* commit '4e0bdd1034ffcf55f4ebcbd547cf4aad59c05f03':
  fs_mgr: Support filesystem labels in fstab
2015-01-23 18:20:50 +00:00
Christoffer Dall
8298234847 fs_mgr: Support filesystem labels in fstab
When mounting fstab entries it is practical to be able to specify
for example LABEL=data instead of a specific block device.

This is particularly important for the new Android Emulator code base,
which uses virtio block devices for the various partitions
(system,data,cache), because there is no defined ordering between the
way the filesystems are specified to the emulator and how they are
enumerated by the android kernel as /dev/vdX.

Change-Id: I7aef95f12e8f7b02ac2e33804ba7897fdcb9ad7f
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
2015-01-23 17:47:39 +00:00
Elliott Hughes
1fdd4dc0bc am 4083ed7d: Merge "Revert "fs_mgr: Support filesystem labels in fstab""
* commit '4083ed7dff6e1dd8e20bec04f9451061951394f5':
  Revert "fs_mgr: Support filesystem labels in fstab"
2015-01-23 00:50:46 +00:00
JP Abgrall
253b9cfba5 am f9e23395: Merge "fs_mgr: Support filesystem labels in fstab"
* commit 'f9e2339553f70aebdd170e96ab9332b28c3851b4':
  fs_mgr: Support filesystem labels in fstab
2015-01-23 00:50:36 +00:00
Elliott Hughes
4083ed7dff Merge "Revert "fs_mgr: Support filesystem labels in fstab"" 2015-01-23 00:34:08 +00:00
Elliott Hughes
572226c25c Revert "fs_mgr: Support filesystem labels in fstab"
This reverts commit 69407ccb02.

Change-Id: I537a3b4257b7bc2a69f1f4d62b4e18e91f2dc713
2015-01-23 00:33:43 +00:00
JP Abgrall
f9e2339553 Merge "fs_mgr: Support filesystem labels in fstab" 2015-01-22 23:59:05 +00: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
Christoffer Dall
69407ccb02 fs_mgr: Support filesystem labels in fstab
When mounting fstab entries it is practical to be able to specify
for example LABEL=data instead of a specific block device.

This is particularly important for the new Android Emulator code base,
which uses virtio block devices for the various partitions
(system,data,cache), because there is no defined ordering between the
way the filesystems are specified to the emulator and how they are
enumerated by the android kernel as /dev/vdX.

Change-Id: I12c3db0ba6a515dc8e917e0349afd257888d3aef
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
2015-01-17 21:05:39 +01:00
Leo Wang
8e9407506f am f2bd3fdd: Merge "Provide a way to select force encryption from vendor partition" into lmp-mr1-dev
* commit 'f2bd3fdd190fc1234913febfe254f8bcc4e675da':
  Provide a way to select force encryption from vendor partition
2015-01-09 02:01:31 +00:00
Paul Lawrence
703b87de5b Provide a way to select force encryption from vendor partition
This allows a vendor to force encryption on devices via a vendor
partition flag:

ro.vold.forceencryption 1

Bug: 18764230
Change-Id: Id0049ce64e34e4f6f96e593aadd70c277ac131c8
2015-01-07 11:44:51 -08:00
Elliott Hughes
9ccf0cbaf1 am a97c1075: Merge "Fix Nick\'s nits"
* commit 'a97c10755442e3800c0b1011d986d554ce2096db':
  Fix Nick's nits
2014-12-10 03:48:42 +00:00
Elliott Hughes
603c7d0d95 am 294e610f: Merge "Fix verity on system partitions larger than 2G"
* commit '294e610f886eeb839d16172bb5b98559a6a7434d':
  Fix verity on system partitions larger than 2G
2014-12-10 03:48:41 +00:00
Paul Lawrence
88a12fb381 Fix Nick's nits
(cherry-pick of 97e487311b1cb780dfd3b0994917c72047d6188f.)

Change-Id: Ide7925e7ad328f0343d444d63ff72f1a26206d4c
2014-12-09 19:38:23 -08:00
Sami Tolvanen
02c698d93f Fix verity on system partitions larger than 2G
If the system partition is larger than 2G, the device fails to read
verity metadata, because fseek accepts only a 32-bit signed offset.
Switch from fseek to lseek64 to allow seeking using a 64-bit offset,
which solves the problem. At the same time, move away from stdio in
the function.

(cherry-pick of 4cafe2ff89b49329e0e880900195d8e061bd3750.)

Bug: 17705619
Change-Id: I226320498dcb750ec6cde84411c7fe0774c9cab7
2014-12-09 19:34:08 -08:00
Elliott Hughes
32e9163b2a resolved conflicts for merge of b471f524 to lmp-mr1-dev-plus-aosp
Change-Id: I6efd0d4a0ece0b065d02796916355ad5ae8b4eea
2014-12-09 19:12:21 -08:00