OSDN Git Service

android-x86/system-vold.git
8 years agominivold: Build as static library for linkage into recovery
Tom Marshall [Wed, 2 Dec 2015 23:25:27 +0000 (15:25 -0800)]
minivold: Build as static library for linkage into recovery

Change-Id: I76045b8e95534e32e1304d535cd0b7d09eeebffc

8 years agovold: Fix crash on startup
Christopher R. Palmer [Thu, 26 Nov 2015 01:53:45 +0000 (20:53 -0500)]
vold: Fix crash on startup

Change-Id: Ib4d1be706b8d9bddc46aa71140fdb89d4ac2e0d1

8 years agoDon't try to unmount ASEC and FUSE paths in recovery
Tom Marshall [Wed, 25 Nov 2015 21:49:40 +0000 (13:49 -0800)]
Don't try to unmount ASEC and FUSE paths in recovery

Change-Id: Ia693dffeb2865e9849b1c237b619777f61beca2f

8 years agoDo not overwrite existing metadata with empty values
Tom Marshall [Wed, 25 Nov 2015 21:46:25 +0000 (13:46 -0800)]
Do not overwrite existing metadata with empty values

This fixes an issue in recovery where storage descriptions go blank.

Change-Id: I8b324c49dbd1aef9a8831496b313ae8c2153bba8

8 years agovold: Honor mount options for ext4 partitions
Tom Marshall [Thu, 5 Nov 2015 19:20:54 +0000 (11:20 -0800)]
vold: Honor mount options for ext4 partitions

 * Save mount options and fstype for DiskPartition objects
 * Pass mount options and fstype to PublicVolume ctor
 * Pass mount options to Ext4::Mount
 * Use specified/default fstype if blkid fails

This is trivially extensible for other fs types.

Change-Id: Ie5dd27f26a4a7129dd9efe6a7ad0a589928282a0

8 years agovold: Support internal storage partitions
Tom Marshall [Wed, 4 Nov 2015 23:44:44 +0000 (15:44 -0800)]
vold: Support internal storage partitions

 * Support nonremovable disks and expose a nonremovable flag in the
   DiskCreated message.
 * New DiskPartition class to hold single partitions.  DiskPartition is
   used when the fs_mgr entry has a partnum (eg. when fs_mgr_flags
   contains voldmanaged=label:#).  Override disk partitioning methods
   to prevent destroying the emmc.

Change-Id: Id7ec3ea409b5c96e691730604e4b1e9cc3aa9d33

8 years agovold: add support for more filesystems for public storage
Dan Pasanen [Wed, 28 Oct 2015 03:52:37 +0000 (22:52 -0500)]
vold: add support for more filesystems for public storage

* Add exfat and ntfs support based off f2fs and ported to use
  fuse
* Add support for both along with f2fs and ext4 to PublicVolume
* Also attempt to mount any volume if it's been determined that
  the kernel supports it

Change-Id: I0a83761cefd97791e3ec84a18e199dfd27a5ed0b

8 years agovold: minivold for recovery
Tom Marshall [Wed, 4 Nov 2015 23:35:09 +0000 (15:35 -0800)]
vold: minivold for recovery

 * Build static linked minivold
 * Adjust tool paths for recovery
 * Skip ASEC and FUSE in recovery
 * Default volume label to fstab label
 * Add label "emulated" to emulated volume
 * Always send VolumeFsLabelChanged on volume creation
 * Add detach option to volume unmount

Change-Id: I1a943dd3e606caa6bee6a0ec1df54fed365f769a

8 years agofs: f2fs: only check for corruption and not entire partition
Alexander Martinz [Tue, 10 Nov 2015 16:03:58 +0000 (17:03 +0100)]
fs: f2fs: only check for corruption and not entire partition

  * checking the entire partition is unneccessary and causes boot delays
    as well as system lockups if using a F2FS partitioned sdcard

Change-Id: I735637308059877a24d7d8b3b9bf79fc2a51e39b
Signed-off-by: Alexander Martinz <eviscerationls@gmail.com>
8 years agoMerge branch 'LA.BF64.1.2.2_rb4.7' of git://codeaurora.org/platform/system/vold into...
Steve Kondik [Mon, 16 Nov 2015 22:45:24 +0000 (14:45 -0800)]
Merge branch 'LA.BF64.1.2.2_rb4.7' of git://codeaurora.org/platform/system/vold into cm-13.0

8 years agoMerge tag 'android-6.0.0_r26' into cm-13.0
Ricardo Cerqueira [Thu, 5 Nov 2015 00:50:49 +0000 (00:50 +0000)]
Merge tag 'android-6.0.0_r26' into cm-13.0

Android 6.0.0 release 26

8 years agovold: Fix password update bug with HW FDE
Dinesh K Garg [Fri, 23 Oct 2015 20:06:23 +0000 (13:06 -0700)]
vold: Fix password update bug with HW FDE

HW FDE has an issue where changing password does not work. Following
is the sequence that is broken:
1. Change the password to PIN/Password/Pattern
2. Change password to None/Swipe
3. Reboot the device
4. Change password to PIN and select "not required to boot device"
5. Reboot the device
6. Change password to None
7. Change password to PIN and select "Required to boot device"
8. Reboot the device.
9. None of password would work because previous password was not updated
   for HW FDE

Change-Id: Ibdfc2b7217abcff3eabff9ae11aa5198ee00181e

8 years agoMerge branch 'm' of git://codeaurora.org/platform/system/vold into cm-13.0
Steve Kondik [Thu, 22 Oct 2015 00:00:09 +0000 (17:00 -0700)]
Merge branch 'm' of git://codeaurora.org/platform/system/vold into cm-13.0

8 years agovold: Add linkage for fs_mgr changes
Steve Kondik [Fri, 16 Oct 2015 13:52:14 +0000 (06:52 -0700)]
vold: Add linkage for fs_mgr changes

Change-Id: Id6623ee558a43600e474ef89f318574bdc6ba25f

8 years agovold: Remove creation of new keymaster key for password update
Dinesh K Garg [Fri, 2 Oct 2015 20:38:18 +0000 (13:38 -0700)]
vold: Remove creation of new keymaster key for password update

To update user password, VOLD creates a new keymaster key which
would be used in the process to rewrap the FDE key. These already
exists a keymaster blob which contains keymaster key created for
old password. This old keymaster blob is secure and there is no
need to create new keymaster key which can take sometime long time
as well. Hence, removing the need to create a new keymaster key which
does not enhance security but sometimes take longer time to update
user password.

Change-Id: I6ce0f71353d54cb32a11d44731b30fa41df235c8

8 years agovold: Fix return value from get_keymaster_hw_fde_passwd()
Dinesh K Garg [Mon, 28 Sep 2015 17:56:00 +0000 (10:56 -0700)]
vold: Fix return value from get_keymaster_hw_fde_passwd()

get_keymaster_hw_fde_passwd() is returing wrong value when HW FDE keys
are not tied to keymaster. Fixed the return values.

Change-Id: Icc5850b0f3154ab8e685f69f02d2a9ae17048528

8 years agoAdded cypto_complete states to reflect MDTP state.
Amit Blay [Mon, 31 Aug 2015 07:16:04 +0000 (10:16 +0300)]
Added cypto_complete states to reflect MDTP state.

Also, fixed bug in the wipe option in cryptfs_enable_internal.

Change-Id: I5b441df6fd55b9c1d40797b25c4a5d6b3bfddcc8

8 years agovold: Fix HW FDE OTA support on SW FDE encrypted device
Dinesh K Garg [Fri, 18 Sep 2015 16:55:53 +0000 (09:55 -0700)]
vold: Fix HW FDE OTA support on SW FDE encrypted device

If an OTA is delivered to a device encrypted with SW FDE, an OTA
of HW FDE should not force user to switch to HW FDE and hence wipe
of all userdata. Instead, it should continue using SW FDE until user
itself perform factory reset. After factory reset, HW FDE would be
used to encrypt the data. This support somehow was broken. This
change fixes the support.

Change-Id: If31ccbd377e5a161a90b2e4a2c53dcc52712b49c

8 years agovold: Tie HW FDE keys with Root of Trust(ROT)
Dinesh K Garg [Thu, 13 Aug 2015 18:38:16 +0000 (11:38 -0700)]
vold: Tie HW FDE keys with Root of Trust(ROT)

HW FDE keys should be tied with device's ROT. Adding required changes
to address the new requirement.

Change-Id: Id2718b48140b97868bcaef90ab9357e4e0327da6

8 years agovold: Port HW FDE features
Dinesh K Garg [Thu, 6 Aug 2015 23:31:16 +0000 (16:31 -0700)]
vold: Port HW FDE features

Following changes for HW FDE are missing which needs to be ported:
- Restart Android framework after HW FDE key has been created
- Add support of Inline Cryto Engine
- Use new HW FDE apis to update password

Change-Id: I49f16867d45a8c10fe7239f600170fd636ac3eda

8 years agomerge in mnc-dr-release history after reset to mnc-dr-dev
The Android Automerger [Fri, 2 Oct 2015 12:53:16 +0000 (05:53 -0700)]
merge in mnc-dr-release history after reset to mnc-dr-dev

8 years agovold: Retry opening block device on failure when starting encryption
David Ng [Wed, 21 Jan 2015 21:55:21 +0000 (13:55 -0800)]
vold: Retry opening block device on failure when starting encryption

The device mapper storage device node can take some time to be
created; so retry.

Bug: 23024596
Change-Id: Ieeb3b697f9cef72d4ea9d106750696901f0a224d

8 years agomerge in mnc-dr-release history after reset to mnc-dr-dev
The Android Automerger [Thu, 10 Sep 2015 08:04:49 +0000 (01:04 -0700)]
merge in mnc-dr-release history after reset to mnc-dr-dev

8 years agoEnable benchmark after trim, when requested.
Jeff Sharkey [Wed, 9 Sep 2015 21:55:45 +0000 (14:55 -0700)]
Enable benchmark after trim, when requested.

The framework can request that a benchmark be run after an fstrim,
but it was disabled due to a kernel bug on certain devices.  That bug
has long been fixed, so it should be safe to enable this again.

Bug: 23942769
Change-Id: Ibe967a75856d0cbad45e2f8f3120f1970caf36d0

8 years agomerge in mnc-dr-release history after reset to mnc-dr-dev
The Android Automerger [Thu, 3 Sep 2015 08:05:33 +0000 (01:05 -0700)]
merge in mnc-dr-release history after reset to mnc-dr-dev

8 years agoSet uid/gid of newly created user dirs to system/system.
Paul Crowley [Mon, 24 Aug 2015 13:53:28 +0000 (14:53 +0100)]
Set uid/gid of newly created user dirs to system/system.

Bug: 23395513
Change-Id: I3d76b77339f995103c0aec09c6de77b3c8cdc0dd

8 years agomerge in mnc-release history after reset to mnc-dev
The Android Automerger [Thu, 13 Aug 2015 08:08:30 +0000 (01:08 -0700)]
merge in mnc-release history after reset to mnc-dev

8 years agomerge in mnc-dr-release history after reset to mnc-dr-dev
The Android Automerger [Thu, 13 Aug 2015 08:07:34 +0000 (01:07 -0700)]
merge in mnc-dr-release history after reset to mnc-dr-dev

8 years agoam eddf9bd6: Request specific tags from blkid.
Jeff Sharkey [Wed, 12 Aug 2015 23:55:26 +0000 (23:55 +0000)]
am eddf9bd6: Request specific tags from blkid.

* commit 'eddf9bd63c1f7e0f9709f7c58a1035fa43338325':
  Request specific tags from blkid.

8 years agoRequest specific tags from blkid.
Jeff Sharkey [Wed, 12 Aug 2015 23:04:35 +0000 (16:04 -0700)]
Request specific tags from blkid.

Otherwise blkid can emit tags like SEC_TYPE which mess with the value
extraction code.

Bug: 23069906
Change-Id: Id2a588ff43a538747d1e44cd8218c96ebd0192c2

8 years agomerge in mnc-release history after reset to mnc-dev
The Android Automerger [Sat, 8 Aug 2015 08:09:57 +0000 (01:09 -0700)]
merge in mnc-release history after reset to mnc-dev

8 years agomerge in mnc-dr-release history after reset to mnc-dr-dev
The Android Automerger [Sat, 8 Aug 2015 08:07:45 +0000 (01:07 -0700)]
merge in mnc-dr-release history after reset to mnc-dr-dev

8 years agoam 1bd078fa: Protect runtime storage mount points.
Jeff Sharkey [Thu, 6 Aug 2015 19:41:34 +0000 (19:41 +0000)]
am 1bd078fa: Protect runtime storage mount points.

* commit '1bd078fa7b5ca613cb3e793d67ccd86d2602787d':
  Protect runtime storage mount points.

8 years agoProtect runtime storage mount points.
Jeff Sharkey [Thu, 6 Aug 2015 18:40:00 +0000 (11:40 -0700)]
Protect runtime storage mount points.

We have a bunch of magic that mounts the correct view of storage
access based on the runtime permissions of an app, but we forgot to
protect the real underlying data sources; oops.

This series of changes just bumps the directory heirarchy one level
to give us /mnt/runtime which we can mask off as 0700 to prevent
people from jumping to the exposed internals.

Also add CTS tests to verify that we're protecting access to
internal mount points like this.

Bug: 22964288
Change-Id: I83f09f0423f4993e766273c50389dd29b1c50589

8 years agomerge in mnc-release history after reset to mnc-dev
The Android Automerger [Sat, 1 Aug 2015 08:11:11 +0000 (01:11 -0700)]
merge in mnc-release history after reset to mnc-dev

8 years agomerge in mnc-dr-release history after reset to mnc-dr-dev
The Android Automerger [Sat, 1 Aug 2015 08:08:20 +0000 (01:08 -0700)]
merge in mnc-dr-release history after reset to mnc-dr-dev

8 years agoam 8474ee32: Return useful path when not visible.
Jeff Sharkey [Fri, 31 Jul 2015 01:51:32 +0000 (01:51 +0000)]
am 8474ee32: Return useful path when not visible.

* commit '8474ee323131fdadcc17f09eab25003a7ae934e0':
  Return useful path when not visible.

8 years agoReturn useful path when not visible.
Jeff Sharkey [Thu, 30 Jul 2015 23:54:23 +0000 (16:54 -0700)]
Return useful path when not visible.

This allows apps like ExternalStorageProvider to still read/write
files on transient storage devices which aren't mounted as visible.

Bug: 22545248
Change-Id: Idacb15f2233245a8e1861d9be977535a82b218ec

8 years agomerge in mnc-release history after reset to mnc-dev
The Android Automerger [Thu, 30 Jul 2015 08:06:06 +0000 (01:06 -0700)]
merge in mnc-release history after reset to mnc-dev

8 years agomerge in mnc-dr-release history after reset to mnc-dr-dev
The Android Automerger [Thu, 30 Jul 2015 08:05:06 +0000 (01:05 -0700)]
merge in mnc-dr-release history after reset to mnc-dr-dev

8 years agoam d46687ee: Use random data for benchmark instead of zeros.
Jeff Sharkey [Wed, 29 Jul 2015 20:10:22 +0000 (20:10 +0000)]
am d46687ee: Use random data for benchmark instead of zeros.

* commit 'd46687ee5da7c9847c6188241ccc699d3a0826c2':
  Use random data for benchmark instead of zeros.

8 years agoUse random data for benchmark instead of zeros.
Jeff Sharkey [Wed, 29 Jul 2015 16:14:21 +0000 (09:14 -0700)]
Use random data for benchmark instead of zeros.

If we always write zeros, we're leaving a giant pile of known
plaintext at an almost deterministic location on newly formatted
volumes.  To avoid this, repeat a 64K chunk of random data.

Bug: 22816936
Change-Id: Iedc067a519bd676a93b9d74ea4f9f77c84c8461c

8 years agomerge in mnc-release history after reset to mnc-dev
The Android Automerger [Wed, 29 Jul 2015 08:10:14 +0000 (01:10 -0700)]
merge in mnc-release history after reset to mnc-dev

8 years agomerge in mnc-dr-release history after reset to mnc-dr-dev
The Android Automerger [Wed, 29 Jul 2015 08:07:16 +0000 (01:07 -0700)]
merge in mnc-dr-release history after reset to mnc-dr-dev

8 years agoam 20642ae7: Give secondary users read-only physical cards.
Jeff Sharkey [Wed, 29 Jul 2015 01:34:47 +0000 (01:34 +0000)]
am 20642ae7: Give secondary users read-only physical cards.

* commit '20642ae71aa93ec2658d09c92a1ffc3844f5a555':
  Give secondary users read-only physical cards.

8 years agoGive secondary users read-only physical cards.
Jeff Sharkey [Tue, 28 Jul 2015 17:57:29 +0000 (10:57 -0700)]
Give secondary users read-only physical cards.

Long ago, we mounted secondary physical cards as readable by all
users on the device, which enabled the use-case of loading media on
a card and viewing it from all users.

More recently, we started giving write access to these secondary
physical cards, but this created a one-directional channel for
communication across user boundaries; something that CDD disallows.

This change is designed to give us the best of both worlds: the
package-specific directories are writable for the user that mounted
the card, but access to those "Android" directories are blocked for
all other users.  Other users remain able to read content elsewhere
on the card.

Bug: 22787184
Change-Id: I75dbd339f11402ae774c7e4b8f2b15ee216270e8

8 years agomerge in mnc-dr-release history after reset to mnc-dr-dev
The Android Automerger [Sat, 25 Jul 2015 08:08:34 +0000 (01:08 -0700)]
merge in mnc-dr-release history after reset to mnc-dr-dev

8 years agoam 32679a82: Create user directory on emulated storage.
Jeff Sharkey [Thu, 23 Jul 2015 19:12:57 +0000 (19:12 +0000)]
am 32679a82: Create user directory on emulated storage.

* commit '32679a82d9542ec26ea8b4e32d29dd7b02202611':
  Create user directory on emulated storage.

8 years agomerge in mnc-release history after reset to mnc-dev
The Android Automerger [Thu, 23 Jul 2015 08:07:03 +0000 (01:07 -0700)]
merge in mnc-release history after reset to mnc-dev

8 years agoCreate user directory on emulated storage.
Jeff Sharkey [Tue, 21 Jul 2015 21:22:01 +0000 (14:22 -0700)]
Create user directory on emulated storage.

When mounting a primary external storage device that is multi-user
aware, ensure that the user-specific directory actually exists before
moving forward.

Bug: 22472026
Change-Id: I33c8eed261a9c0d5acedd5be6133ed9990679d08

8 years agomerge in mnc-dr-release history after reset to mnc-dr-dev
The Android Automerger [Tue, 14 Jul 2015 08:06:47 +0000 (01:06 -0700)]
merge in mnc-dr-release history after reset to mnc-dr-dev

8 years agoEvict the key before we delete it.
Paul Crowley [Tue, 7 Jul 2015 14:17:22 +0000 (15:17 +0100)]
Evict the key before we delete it.

Change-Id: I9eef440a1f406c2c73c859f5ae7cee35f6a36ca4

8 years agoFix erroneous comment in secdiscard.cpp, plus style fixes.
Paul Crowley [Mon, 22 Jun 2015 11:32:26 +0000 (12:32 +0100)]
Fix erroneous comment in secdiscard.cpp, plus style fixes.

Bug: 19706593

(cherry picked from commit 747e1f7a6d0ae43fce33217e6f0215ceeaf44617)

Change-Id: I9a605c736a2fa909cd4999e1e8d022d49a562767

8 years agoScrub the key from the disk with BLKSECDISCARD.
Paul Crowley [Tue, 19 May 2015 16:31:39 +0000 (17:31 +0100)]
Scrub the key from the disk with BLKSECDISCARD.

Bug: 19706593

(cherry-picked from commit 8d0cd7ffd903a753c6bb5c6f33987a7a66621cef)

Change-Id: Ieea73da233fe53767b5adcdb4d49f9bb00fedac1

8 years agoAdd tool for scrubbing files with BLKSECDISCARD.
Paul Crowley [Tue, 19 May 2015 16:31:39 +0000 (17:31 +0100)]
Add tool for scrubbing files with BLKSECDISCARD.

Bug: 19706593

(based on work in commit 8d0cd7ffd903a753c6bb5c6f33987a7a66621cef)

Change-Id: I9699275a63f2d0a110435bd4a725d7dfcce4ed90

8 years agoAdd "cryptfs deleteuserkey" command to vold.
Paul Crowley [Tue, 19 May 2015 11:34:09 +0000 (12:34 +0100)]
Add "cryptfs deleteuserkey" command to vold.

Bug: 19706593

(cherry-picked from commit eebf44563bf9c6f2795442e8d2bc886e4eb3bbbe)

Change-Id: I50dc4c39595c06bf0016d6a490130bbbc25de91b

8 years agoAdd vold commands for setting up per-user encrypted user
Paul Crowley [Wed, 6 May 2015 14:04:43 +0000 (15:04 +0100)]
Add vold commands for setting up per-user encrypted user
directories

Bug: 19704432

(cherry-picked from commit 75a5202d9f65747edabb1dd0ebd50a779d4142c2)

Change-Id: I733e8745ec21f8e53c2cc6d8a98313275db7d897

8 years agoBreak key installation into its own function so we can install
Paul Crowley [Wed, 6 May 2015 12:38:53 +0000 (13:38 +0100)]
Break key installation into its own function so we can install
non-master keys.

Bug: 19704432
(cherry-picked from commit 1da96dc549b86a1c7ec02d7a808a9532cdcb5fe7)

Change-Id: I762e8f6c927db3a337fa8ce6bd428262d9e05c7a

8 years agoDon't break on setting default password
Paul Lawrence [Tue, 7 Jul 2015 22:43:14 +0000 (15:43 -0700)]
Don't break on setting default password

Bug: 22329642
Change-Id: I58dac4dba8e65c7015d50ca0c3575f77f550a215

8 years agomerge in mnc-release history after reset to mnc-dev
The Android Automerger [Thu, 9 Jul 2015 08:05:04 +0000 (01:05 -0700)]
merge in mnc-release history after reset to mnc-dev

8 years agomerge in mnc-dr-release history after reset to mnc-dr-dev
The Android Automerger [Thu, 9 Jul 2015 08:03:29 +0000 (01:03 -0700)]
merge in mnc-dr-release history after reset to mnc-dr-dev

8 years agoMount emulated volumes as consistent location.
Jeff Sharkey [Tue, 7 Jul 2015 21:37:03 +0000 (14:37 -0700)]
Mount emulated volumes as consistent location.

We really only support a single emulated volume on the device at a
time, either on internal storage, or moved to a private volume.  To
avoid kicking off a giant rescan of all media when moved, keep all
the paths the same when mounted as primary.

Also ensure we have /data/media/0 ready on private volumes.

Bug: 20275423
Change-Id: I0c102f430b865ca7536772b1fae56d8c9660a97a

8 years agomerge in mnc-dr-release history after reset to mnc-dr-dev
The Android Automerger [Mon, 6 Jul 2015 23:07:37 +0000 (16:07 -0700)]
merge in mnc-dr-release history after reset to mnc-dr-dev

8 years agomerge in mnc-release history after reset to mnc-dev
The Android Automerger [Thu, 2 Jul 2015 08:02:41 +0000 (01:02 -0700)]
merge in mnc-release history after reset to mnc-dev

8 years agoTrim both internal and adopted private storage.
Jeff Sharkey [Fri, 26 Jun 2015 21:02:09 +0000 (14:02 -0700)]
Trim both internal and adopted private storage.

Refactor fstrim code to be encapsulated in unique task object, and
give it option of benchmarking when finished.  Trimming now includes
both storage from fstab and adopted private volumes.  Cleaner timing
stats are logged for each unique volume.

Add wakelock during ongoing async move tasks.  Push disk sysfs path
to framework so it can parse any SD card registers as desired.

Bug: 21831325
Change-Id: I76577685f5cae4929c251ad314ffdaeb5eb1c8bf

8 years agoNull-terminate readlink() result, full remount.
Jeff Sharkey [Tue, 30 Jun 2015 22:54:17 +0000 (15:54 -0700)]
Null-terminate readlink() result, full remount.

In order to compare results from readlink() calls, we need to null
terminate the read value, otherwise we can end up doing an infinitely
recursive remount in the root namespace.

When remounting inside a namespace, unmount all existing mounts before
mounting the new storage into place.  This also means we need to mount
the user-specific symlinks back into place.

Skip spinning up the FUSE daemon when not visible, otherwise we get
stuck waiting for a daemon that never shows up.

Bug: 2219251822204412
Change-Id: Icc7db822354ab7ffc47c39cd0611f65edecc32e5

8 years agoNull-terminate readlink() result, full remount.
Jeff Sharkey [Tue, 30 Jun 2015 22:54:17 +0000 (15:54 -0700)]
Null-terminate readlink() result, full remount.

In order to compare results from readlink() calls, we need to null
terminate the read value, otherwise we can end up doing an infinitely
recursive remount in the root namespace.

When remounting inside a namespace, unmount all existing mounts before
mounting the new storage into place.  This also means we need to mount
the user-specific symlinks back into place.

Skip spinning up the FUSE daemon when not visible, otherwise we get
stuck waiting for a daemon that never shows up.

Bug: 2219251822204412
Change-Id: Icc7db822354ab7ffc47c39cd0611f65edecc32e5

8 years agomerge in mnc-release history after reset to mnc-dev
The Android Automerger [Sat, 27 Jun 2015 08:06:10 +0000 (01:06 -0700)]
merge in mnc-release history after reset to mnc-dev

8 years agoLast ditch check for partition on raw disk.
Jeff Sharkey [Fri, 26 Jun 2015 18:16:14 +0000 (11:16 -0700)]
Last ditch check for partition on raw disk.

Some storage devices can be formatted as bare partitions, without an
MBR or GPT header.  If we found no partitions, try poking at the raw
disk, and treat it as a public volume if we found a valid filesystem.

Bug: 20503551
Change-Id: I80304e1ad865435321c341b667c0daf2daf4d56c

8 years agoLet's reinvent storage, yet again!
Jeff Sharkey [Wed, 24 Jun 2015 18:49:24 +0000 (11:49 -0700)]
Let's reinvent storage, yet again!

Now that we're treating storage as a runtime permission, we need to
grant read/write access without killing the app.  This is really
tricky, since we had been using GIDs for access control, and they're
set in stone once Zygote drops privileges.

The only thing left that can change dynamically is the filesystem
itself, so let's do that.  This means changing the FUSE daemon to
present itself as three different views:

/mnt/runtime_default/foo - view for apps with no access
/mnt/runtime_read/foo - view for apps with read access
/mnt/runtime_write/foo - view for apps with write access

There is still a single location for all the backing files, and
filesystem permissions are derived the same way for each view, but
the file modes are masked off differently for each mountpoint.

During Zygote fork, it wires up the appropriate storage access into
an isolated mount namespace based on the current app permissions.  When
the app is granted permissions dynamically at runtime, the system
asks vold to jump into the existing mount namespace and bind mount
the newly granted access model into place.

Bug: 21858077
Change-Id: Iade538e4bc7af979fe20095f74416e8a0f165a4a

8 years agomerge in mnc-release history after reset to mnc-dev
The Android Automerger [Thu, 25 Jun 2015 08:03:56 +0000 (01:03 -0700)]
merge in mnc-release history after reset to mnc-dev

8 years agoMerge "Make sure volume is vfat before fsck'ing." into mnc-dev
Makoto Onuki [Wed, 24 Jun 2015 20:33:55 +0000 (20:33 +0000)]
Merge "Make sure volume is vfat before fsck'ing." into mnc-dev

8 years agoMake sure volume is vfat before fsck'ing.
Makoto Onuki [Wed, 24 Jun 2015 20:30:45 +0000 (13:30 -0700)]
Make sure volume is vfat before fsck'ing.

Bug 21948137

Change-Id: I6843423fd8809d9e2f352059a810aa17dd83b3e3

8 years agoAdd purpose to vold-generated keymaster1 keys.
Shawn Willden [Wed, 24 Jun 2015 14:21:54 +0000 (07:21 -0700)]
Add purpose to vold-generated keymaster1 keys.

Also remove the app ID and additional padding and digest options.

Bug: 22009890
Change-Id: Ibff9bbd0e0c11d651d11fac85d4ac907588f1cd2

8 years agomerge in mnc-release history after reset to mnc-dev
The Android Automerger [Tue, 23 Jun 2015 08:09:10 +0000 (01:09 -0700)]
merge in mnc-release history after reset to mnc-dev

8 years agoAdd method to forget private partition keys.
Jeff Sharkey [Thu, 18 Jun 2015 21:25:08 +0000 (14:25 -0700)]
Add method to forget private partition keys.

Report both the disk and the partition GUID for private volumes to
userspace, and offer to forget the encryption key for a given
partition GUID.

Bug: 21782268
Change-Id: Ie77a3a58e47bf3563cdb3e4b0edfab1de4d0e6b4

8 years agoUse correct error code for rate limiting.
Shawn Willden [Thu, 18 Jun 2015 18:26:59 +0000 (12:26 -0600)]
Use correct error code for rate limiting.

Note that this CL depends on cl 712195, which must be submitted first.

Bug: 21607106
Change-Id: Iafc42d1c8a1145a31ea252b33b404044f92ec62b

8 years agomerge in mnc-release history after reset to mnc-dev
The Android Automerger [Thu, 18 Jun 2015 08:03:59 +0000 (01:03 -0700)]
merge in mnc-release history after reset to mnc-dev

8 years agoAdd keymaster1 support to vold.
Shawn Willden [Wed, 3 Jun 2015 15:40:45 +0000 (09:40 -0600)]
Add keymaster1 support to vold.

Bug: 21607106
Change-Id: I498141b90888d4f0652912413b04519f61886935

8 years agomerge in mnc-release history after reset to mnc-dev
The Android Automerger [Tue, 16 Jun 2015 08:06:27 +0000 (01:06 -0700)]
merge in mnc-release history after reset to mnc-dev

8 years agomerge in mnc-release history after reset to mnc-dev
The Android Automerger [Mon, 15 Jun 2015 18:58:52 +0000 (11:58 -0700)]
merge in mnc-release history after reset to mnc-dev

8 years agomerge in mnc-release history after reset to mnc-dev
The Android Automerger [Sat, 13 Jun 2015 08:08:21 +0000 (01:08 -0700)]
merge in mnc-release history after reset to mnc-dev

8 years agoImprove boot time by 0.1s by reducing a polling sleep interval
Paul Lawrence [Thu, 11 Jun 2015 18:15:29 +0000 (11:15 -0700)]
Improve boot time by 0.1s by reducing a polling sleep interval

Bug: 21516860
Change-Id: I9e28f4d9cc20ec2a7d9e325c02ef85f0ad9b3d60

9 years agomerge in mnc-release history after reset to mnc-dev
The Android Automerger [Thu, 11 Jun 2015 08:03:52 +0000 (01:03 -0700)]
merge in mnc-release history after reset to mnc-dev

9 years agoMerge "Start tracking added users with serial numbers." into mnc-dev
Jeff Sharkey [Wed, 10 Jun 2015 16:44:50 +0000 (16:44 +0000)]
Merge "Start tracking added users with serial numbers." into mnc-dev

9 years agoStart tracking added users with serial numbers.
Jeff Sharkey [Wed, 10 Jun 2015 16:42:01 +0000 (09:42 -0700)]
Start tracking added users with serial numbers.

vold will eventually use the serial numbers to clean up stale user
directories when mounting private storage devices.

Bug: 20275572
Change-Id: Ia29cb5da23e969f3087bb5caa5dc8f4e88f07613

9 years agoRemove hex encoding and password adjusting now that patterns are '1' based
Paul Lawrence [Tue, 9 Jun 2015 20:37:44 +0000 (13:37 -0700)]
Remove hex encoding and password adjusting now that patterns are '1' based

Bug: 21606650
Change-Id: I3486ad394d563135c5171a1d4785f7a27eeea3ae

9 years agomerge in mnc-release history after reset to mnc-dev
The Android Automerger [Wed, 10 Jun 2015 08:05:40 +0000 (01:05 -0700)]
merge in mnc-release history after reset to mnc-dev

9 years agoRun restorecon over mounted private volumes.
Jeff Sharkey [Tue, 9 Jun 2015 17:59:17 +0000 (10:59 -0700)]
Run restorecon over mounted private volumes.

This ensures that we have consistent SELinux policy in place before
going any further, and it mirrors the way we restorecon /data when
first mounted.

Bug: 21121357
Change-Id: I2a7e3584ade655fe1fae8916cf54f9eae3a0f99d

9 years agomerge in mnc-release history after reset to mnc-dev
The Android Automerger [Tue, 9 Jun 2015 08:05:46 +0000 (01:05 -0700)]
merge in mnc-release history after reset to mnc-dev

9 years agoAdd f2fs support for private volumes.
Jeff Sharkey [Fri, 22 May 2015 05:35:42 +0000 (22:35 -0700)]
Add f2fs support for private volumes.

When formatting volumes, pass along fsType string which can be "auto"
to let the volume select the best choice.  For now, private volumes
assume that MMC devices (like SD cards) are best off using f2fs when
both kernel support and tools are present, otherwise fall back to
ext4.  Use blkid when mounting to pick the right set of tools.

Move filesystem utility methods into namespaces and place in separate
directory to be more organized.

Bug: 20275581
Change-Id: Id5f82d8672dda2e9f68c35b075f28232b0b55ed4

9 years agomerge in mnc-release history after reset to mnc-dev
The Android Automerger [Sat, 6 Jun 2015 08:06:16 +0000 (01:06 -0700)]
merge in mnc-release history after reset to mnc-dev

9 years agoMove crypt commands to a different listener in vold
Paul Lawrence [Wed, 3 Jun 2015 21:19:51 +0000 (14:19 -0700)]
Move crypt commands to a different listener in vold

In order to prevent this bug from happening, we must allow vold cryptfs
commands to complete while a long running mount is underway.

While waiting for vold to be changed to a binder interface, we will simply
create two listeners, one for cryptfs and one for everything else.

Bug: 19197175
Change-Id: If74142aa81abd58f718a9de6c9e387f6ea442754

9 years agoImprove boot time
Paul Lawrence [Thu, 4 Jun 2015 17:49:25 +0000 (10:49 -0700)]
Improve boot time

Bug: 21516860
Change-Id: I3153c7f9a414a8eeadc0118f0a642ad8e96c81ce

9 years agomerge in mnc-release history after reset to mnc-dev
The Android Automerger [Sat, 30 May 2015 08:08:28 +0000 (01:08 -0700)]
merge in mnc-release history after reset to mnc-dev

9 years agoMerge "Don't use TEMP_FAILURE_RETRY on close in vold." into mnc-dev
Elliott Hughes [Fri, 29 May 2015 22:04:26 +0000 (22:04 +0000)]
Merge "Don't use TEMP_FAILURE_RETRY on close in vold." into mnc-dev

9 years agoDO NOT MERGE Delete password as per block encryption
Paul Lawrence [Wed, 6 May 2015 20:53:43 +0000 (13:53 -0700)]
DO NOT MERGE Delete password as per block encryption

(cherry-picked from commit 00f4aade5c172534c16070540d1c6c26d0a78c84)

Bug: 18151196
Change-Id: Iee0f932c61ff4a309dc2861725b24bf976adb4c7

9 years agoDO NOT MERGE Fix problem that reading/writing crypto footers wasn't identity
Paul Lawrence [Tue, 5 May 2015 22:58:27 +0000 (15:58 -0700)]
DO NOT MERGE Fix problem that reading/writing crypto footers wasn't identity

(cherry-picked from commit 75c922f49b593f3203ee59c33d00ccb5b3b66ca8)

Bug: 18151196
Change-Id: Ideef6bcdbccf068a64ed3e042be50c4837a373f8

9 years agoDO NOT MERGE Retry unmounts in ext4 encryption
Paul Lawrence [Tue, 5 May 2015 21:28:25 +0000 (14:28 -0700)]
DO NOT MERGE Retry unmounts in ext4 encryption

(cherry-picked from commit 29b54aab8ee2d08e2129832364f9b719dd17fa4e)

Bug: 18151196
Change-Id: I52ca23b2ce3adcff44bd003d4a12243a0bd6ac34

9 years agoDO NOT MERGE Use default key permissions for ext4enc
Paul Lawrence [Tue, 5 May 2015 18:09:07 +0000 (11:09 -0700)]
DO NOT MERGE Use default key permissions for ext4enc

(cherry-picked from commit 1190a26f6d7dd34bf10ffc7b367b374d5e591146)

As per discussion default permissions are the correct ones.
Note that since we use logon keys, they cannot be read outside
the kernel.

Note also that we limit who can read/write keys in selinux policy.

Bug: 18151196
Change-Id: Icc916f430a70eff22e6b74c20ec361c8f3789c1c