OSDN Git Service

android-x86/system-vold.git
9 years agoam b707d72a: am 6efa9351: Merge "Don\'t use deprecated OpenSSL functions."
Alex Klyubin [Wed, 29 Oct 2014 07:00:52 +0000 (07:00 +0000)]
am b707d72a: am 6efa9351: Merge "Don\'t use deprecated OpenSSL functions."

* commit 'b707d72a33c8e442cafb36f724245f1c9898fb36':

9 years agoam ab083da0: Merge "Set SELinux contexts on device nodes created by vold."
Nick Kralevich [Sat, 18 Oct 2014 23:08:54 +0000 (23:08 +0000)]
am ab083da0: Merge "Set SELinux contexts on device nodes created by vold."

* commit 'ab083da069a73f787a9304e155c0ab847c85377f':
  Set SELinux contexts on device nodes created by vold.

9 years agoMerge "Set SELinux contexts on device nodes created by vold."
Nick Kralevich [Sat, 18 Oct 2014 23:02:30 +0000 (23:02 +0000)]
Merge "Set SELinux contexts on device nodes created by vold."

9 years agoam ada1f929: am 512f0d52: cryptfs: [HACK] reboot if the crypto block dev failed to...
JP Abgrall [Fri, 17 Oct 2014 19:12:11 +0000 (19:12 +0000)]
am ada1f929: am 512f0d52: cryptfs: [HACK] reboot if the crypto block dev failed to open

* commit 'ada1f9290fc266f5277fbed88b02faf2a4f93ff8':
  cryptfs: [HACK] reboot if the crypto block dev failed to open

9 years agoam 0f3e09cb: resolved conflicts for merge of 7776871d to lmp-mr1-dev
JP Abgrall [Fri, 17 Oct 2014 18:59:31 +0000 (18:59 +0000)]
am 0f3e09cb: resolved conflicts for merge of 7776871d to lmp-mr1-dev

* commit '0f3e09cb9c5adbdae140694e519cf9a8b241f1ba':
  cryptfs: extra debugging around crypto blockdev dm-... errors.

9 years agoam 512f0d52: cryptfs: [HACK] reboot if the crypto block dev failed to open
JP Abgrall [Fri, 17 Oct 2014 18:50:39 +0000 (18:50 +0000)]
am 512f0d52: cryptfs: [HACK] reboot if the crypto block dev failed to open

* commit '512f0d52ac5f85b327872e085d9fe6f02517eadf':
  cryptfs: [HACK] reboot if the crypto block dev failed to open

9 years agoresolved conflicts for merge of 7776871d to lmp-mr1-dev
JP Abgrall [Fri, 17 Oct 2014 18:41:56 +0000 (11:41 -0700)]
resolved conflicts for merge of 7776871d to lmp-mr1-dev

This change was already in lmp-mr1-dev

9 years agocryptfs: [HACK] reboot if the crypto block dev failed to open
JP Abgrall [Sat, 11 Oct 2014 01:43:41 +0000 (18:43 -0700)]
cryptfs: [HACK] reboot if the crypto block dev failed to open

There are cases where the /dev/block/dm-0 fails to open.
This leads to the device not completing the boot up sequence.
Currently, the only way out is to reboot.

Bug: 17898962
Change-Id: If4583ebb1ef1ebdbaf680d69b876459aaec2f4ce
(cherry picked from commit 7fc1de8a44307d6c51826ab90f804702e08d1e6d)

9 years agoam 7fc1de8a: cryptfs: [HACK] reboot if the crypto block dev failed to open
JP Abgrall [Mon, 13 Oct 2014 20:36:52 +0000 (20:36 +0000)]
am 7fc1de8a: cryptfs: [HACK] reboot if the crypto block dev failed to open

* commit '7fc1de8a44307d6c51826ab90f804702e08d1e6d':
  cryptfs: [HACK] reboot if the crypto block dev failed to open

9 years agoam 3334c6a1: cryptfs: extra debugging around crypto blockdev dm-... errors.
JP Abgrall [Mon, 13 Oct 2014 19:07:27 +0000 (19:07 +0000)]
am 3334c6a1: cryptfs: extra debugging around crypto blockdev dm-... errors.

* commit '3334c6a1ae38b2c7886fc9c0a69467e586af8635':
  cryptfs: extra debugging around crypto blockdev dm-... errors.

9 years agocryptfs: [HACK] reboot if the crypto block dev failed to open
JP Abgrall [Sat, 11 Oct 2014 01:43:41 +0000 (18:43 -0700)]
cryptfs: [HACK] reboot if the crypto block dev failed to open

There are cases where the /dev/block/dm-0 fails to open.
This leads to the device not completing the boot up sequence.
Currently, the only way out is to reboot.

Bug: 17898962
Change-Id: If4583ebb1ef1ebdbaf680d69b876459aaec2f4ce

9 years agocryptfs: extra debugging around crypto blockdev dm-... errors.
JP Abgrall [Fri, 10 Oct 2014 22:52:11 +0000 (15:52 -0700)]
cryptfs: extra debugging around crypto blockdev dm-... errors.

Some times the /dev/block/dm-0 fails to open after it has been setup.
Log why.

Bug: 17576594
Bug: 17942270
Change-Id: If0bbfe22d84137f2029bacb10873832038f0d36c

9 years agocryptfs: extra debugging around crypto blockdev dm-... errors.
JP Abgrall [Fri, 10 Oct 2014 22:52:11 +0000 (15:52 -0700)]
cryptfs: extra debugging around crypto blockdev dm-... errors.

Some times the /dev/block/dm-0 fails to open after it has been setup.
Log why.

Bug: 17576594
Bug: 17942270
Change-Id: If0bbfe22d84137f2029bacb10873832038f0d36c

9 years agoam fc615041: Remove possibility of zero chars from passwords
Paul Lawrence [Tue, 7 Oct 2014 00:34:56 +0000 (00:34 +0000)]
am fc615041: Remove possibility of zero chars from passwords

* commit 'fc61504166d4377a1f83211c236ca11260da1261':
  Remove possibility of zero chars from passwords

9 years agoRemove possibility of zero chars from passwords
Paul Lawrence [Sat, 4 Oct 2014 22:32:29 +0000 (15:32 -0700)]
Remove possibility of zero chars from passwords

scrypt pads the password with zeros. Our patterns use 0 to represent
the top left dot. So patterns that end there are equivalent to ones
that end one short.

After much thought, the best solution is to change the way we
represent patterns in keyguard. This, however, is a big change.

The short term solution is to change the pattern representation in vold
so that we are storing the correct thing. Later we will change keyguard
to handle patterns correctly and remove quite a few hacks from vold
(use of hex, this code). b/17840293 created to track this.

Bug: 17751714
Change-Id: I30cdffb0f0db406d2e2b6c54d4153d120d975318

9 years agoam 7639a6ab: Merge "Reset failed decryption count on successful decryptions" into...
Paul Lawrence [Sun, 5 Oct 2014 23:38:39 +0000 (23:38 +0000)]
am 7639a6ab: Merge "Reset failed decryption count on successful decryptions" into lmp-dev

* commit '7639a6ab60426bbfa57c750c1ff0b4016cad0294':
  Reset failed decryption count on successful decryptions

9 years agoMerge "Reset failed decryption count on successful decryptions" into lmp-dev
Paul Lawrence [Sun, 5 Oct 2014 23:24:46 +0000 (23:24 +0000)]
Merge "Reset failed decryption count on successful decryptions" into lmp-dev

9 years agoReset failed decryption count on successful decryptions
Paul Lawrence [Sun, 5 Oct 2014 19:57:37 +0000 (12:57 -0700)]
Reset failed decryption count on successful decryptions

Bug: 17866359
Change-Id: I1af2ff1ac4f5243afba0cfa2f2d3a1d0b029091b

9 years agoam 6e8440fd: cryptfs: kill processes with open files on tmpfs /data
Greg Hackmann [Fri, 3 Oct 2014 06:16:58 +0000 (06:16 +0000)]
am 6e8440fd: cryptfs: kill processes with open files on tmpfs /data

* commit '6e8440fd5072a673dd861ffb531fc17b4673ad90':
  cryptfs: kill processes with open files on tmpfs /data

9 years agoam 9c58a871: Use monotonic clock for cryptfs progress
Paul Lawrence [Fri, 3 Oct 2014 06:16:57 +0000 (06:16 +0000)]
am 9c58a871: Use monotonic clock for cryptfs progress

* commit '9c58a871f9fb356409d3b90734bf706d1463f041':
  Use monotonic clock for cryptfs progress

9 years agocryptfs: kill processes with open files on tmpfs /data
Greg Hackmann [Fri, 3 Oct 2014 00:18:20 +0000 (17:18 -0700)]
cryptfs: kill processes with open files on tmpfs /data

cryptfs will fail to remount /data at boot if any processes (e.g.
dex2oat) have files open on the tmpfs /data partition.  Since these
files are about to be destroyed anyway, just kill the offending
processes: first with SIGHUP and finally with SIGKILL.

Also remove a stray i++ that effectively cut the number of retries in
half.

Bug: 17576594

Change-Id: I76fb90ce2e52846ffb9de706e52b7bde98b4186a
Signed-off-by: Greg Hackmann <ghackmann@google.com>
9 years agoSet SELinux contexts on device nodes created by vold.
Stephen Smalley [Tue, 30 Sep 2014 14:29:24 +0000 (10:29 -0400)]
Set SELinux contexts on device nodes created by vold.

Extend vold to look up and set SELinux contexts on the
device nodes it creates for extra loop devices and for volumes.
Prior to this change, these device nodes simply inherited the type
of their parent directory /dev/block, i.e. block_device, and vold
therefore required create_file perms to block_device:blk_file.
With this change we can scope vold down to accessing specific
block device types.

This depends on change Id3bea28f5958086716cd3db055bea309b3b5fa5a
to allow vold to use setfscreatecon().

Change-Id: Ib9e8294abb1da94d92503947603ec12e802ff08c
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
9 years agoUse monotonic clock for cryptfs progress
Paul Lawrence [Tue, 30 Sep 2014 16:12:51 +0000 (09:12 -0700)]
Use monotonic clock for cryptfs progress

Otherwise we get strange results when the time changes. Worst
effect is that the encryption takes a lot longer since we are
calling the logging code far more frequently.

Bug: 17625981
Change-Id: Ice29f28b3720e9e4a1ea28e45eeab574d1959ec1

9 years agoam 3574b085: Merge "cryptfs: log umount() failure reason" into lmp-dev
Greg Hackmann [Fri, 26 Sep 2014 00:21:50 +0000 (00:21 +0000)]
am 3574b085: Merge "cryptfs: log umount() failure reason" into lmp-dev

* commit '3574b085f46a5b22ee660a9fd3ef727a20c106ee':
  cryptfs: log umount() failure reason

9 years agoam 46a3a79a: Merge "print information about opened files when failed unmount" into...
Greg Hackmann [Fri, 26 Sep 2014 00:21:49 +0000 (00:21 +0000)]
am 46a3a79a: Merge "print information about opened files when failed unmount" into lmp-dev

* commit '46a3a79a8f6b8b8eb66b1194a1a56b0ddcd4943b':
  print information about opened files when failed unmount

9 years agoam dd1a8040: Include reason when wiping data.
Jeff Sharkey [Fri, 26 Sep 2014 00:21:49 +0000 (00:21 +0000)]
am dd1a8040: Include reason when wiping data.

* commit 'dd1a8040e8449cc0e8b861a23e0339a43d80593c':
  Include reason when wiping data.

9 years agoMerge "cryptfs: log umount() failure reason" into lmp-dev
Greg Hackmann [Wed, 24 Sep 2014 23:32:00 +0000 (23:32 +0000)]
Merge "cryptfs: log umount() failure reason" into lmp-dev

9 years agoMerge "print information about opened files when failed unmount" into lmp-dev
Greg Hackmann [Wed, 24 Sep 2014 23:31:50 +0000 (23:31 +0000)]
Merge "print information about opened files when failed unmount" into lmp-dev

9 years agocryptfs: log umount() failure reason
Greg Hackmann [Wed, 24 Sep 2014 21:55:20 +0000 (14:55 -0700)]
cryptfs: log umount() failure reason

Bug: 17576594

Change-Id: I7320aa597210896b4db6e663e1b2cb0c24d96557
Signed-off-by: Greg Hackmann <ghackmann@google.com>
9 years agoprint information about opened files when failed unmount
jessica_yu [Mon, 22 Sep 2014 07:57:40 +0000 (15:57 +0800)]
print information about opened files when failed unmount

Change-Id: I88ae719cdae490433390d624f75612a9f4f96677

Cryptfs : Enabling support for allow_discards in dmcrypt.
Cryptfs : Password matches
Cryptfs : test_mount_encrypted_fs(): Master key saved
TrustyKeymaster: Creating device
TrustyKeymaster: Device address: 0x7f8f416100
Cryptfs : keymaster version is 3
Cryptfs : Just asked init to shut down class main
ServiceManager: service 'drm.drmManager' died
ServiceManager: service 'media.audio_flinger' died
ServiceManager: service 'media.player' died
ServiceManager: service 'media.camera' died
ServiceManager: service 'android.security.keystore' died
Cryptfs : unmounting /data failed

Bug: 17576594

9 years agoInclude reason when wiping data.
Jeff Sharkey [Wed, 24 Sep 2014 18:46:51 +0000 (11:46 -0700)]
Include reason when wiping data.

This will help us track down who requested a data wipe.

Bug: 17412160
Change-Id: I5ab39a4de03c973ed151d703d6462a172ee043fd

9 years agoam 3846be17: Reduce cryptfs logspam
Paul Lawrence [Tue, 23 Sep 2014 17:05:56 +0000 (17:05 +0000)]
am 3846be17: Reduce cryptfs logspam

* commit '3846be17feba13150a5db22204622db6a762a0d8':
  Reduce cryptfs logspam

9 years agoReduce cryptfs logspam
Paul Lawrence [Mon, 22 Sep 2014 18:33:54 +0000 (11:33 -0700)]
Reduce cryptfs logspam

Bug: 17572886
Change-Id: I91302ccc284e0f908299852650db5bf645f2ff71

9 years agoam 6efa9351: Merge "Don\'t use deprecated OpenSSL functions."
Alex Klyubin [Fri, 19 Sep 2014 23:17:02 +0000 (23:17 +0000)]
am 6efa9351: Merge "Don\'t use deprecated OpenSSL functions."

* commit '6efa9351a257edc53ce07eb8c544ccf08efb64ae':
  Don't use deprecated OpenSSL functions.

9 years agoam 6efa9351: Merge "Don\'t use deprecated OpenSSL functions."
Alex Klyubin [Fri, 19 Sep 2014 23:02:26 +0000 (23:02 +0000)]
am 6efa9351: Merge "Don\'t use deprecated OpenSSL functions."

* commit '6efa9351a257edc53ce07eb8c544ccf08efb64ae':
  Don't use deprecated OpenSSL functions.

9 years agoMerge "Don't use deprecated OpenSSL functions."
Alex Klyubin [Fri, 19 Sep 2014 22:41:09 +0000 (22:41 +0000)]
Merge "Don't use deprecated OpenSSL functions."

9 years agoam 8e3f4510: HACK: Retry/reboot when mount reports busy.
Paul Lawrence [Fri, 12 Sep 2014 23:21:11 +0000 (23:21 +0000)]
am 8e3f4510: HACK: Retry/reboot when mount reports busy.

* commit '8e3f4510a88871a2d489ca4cdf7b738d4229053d':
  HACK: Retry/reboot when mount reports busy.

9 years agoresolved conflicts for merge of 2b2a0bec to lmp-dev-plus-aosp
Dan Albert [Fri, 12 Sep 2014 20:05:56 +0000 (13:05 -0700)]
resolved conflicts for merge of 2b2a0bec to lmp-dev-plus-aosp

Change-Id: I224499833777ef80d85c1199f475f5ed1568d053

9 years agoMerge "Remove makefile cruft."
Dan Albert [Fri, 12 Sep 2014 18:07:50 +0000 (18:07 +0000)]
Merge "Remove makefile cruft."

9 years agoHACK: Retry/reboot when mount reports busy.
Paul Lawrence [Mon, 8 Sep 2014 17:11:17 +0000 (10:11 -0700)]
HACK: Retry/reboot when mount reports busy.

This is a hack because we don't know why mount() reports busy.

Requires dependent change in syste/core:
  https://googleplex-android-review.git.corp.google.com/#/c/543125/

Bug: 17358530

Change-Id: I8d3078bc68f8c450adce2c3a4101b6a958f1c4a0

9 years agoRemove makefile cruft.
Dan Albert [Fri, 12 Sep 2014 17:48:12 +0000 (10:48 -0700)]
Remove makefile cruft.

Don't manually include stlport, and don't use private bionic headers.

Change-Id: I44dd212fdd5874e625890c548e9d7bf3a9c27912

9 years agoam 7e17e2d2: Don\'t worry about battery levels when encrypting
Paul Lawrence [Wed, 10 Sep 2014 22:58:38 +0000 (22:58 +0000)]
am 7e17e2d2: Don\'t worry about battery levels when encrypting

* commit '7e17e2d226783a2e065a194e60c061c255cebaae':
  Don't worry about battery levels when encrypting

9 years agoDon't worry about battery levels when encrypting
Paul Lawrence [Tue, 9 Sep 2014 21:47:53 +0000 (14:47 -0700)]
Don't worry about battery levels when encrypting

This is a deliberately minimalistic change. There is another
defect to remove all this code - removing some of it will (IMO)
simply confuse the issue.

Bug: 16868177
Bug: 17180951
Change-Id: I57d7a4fb3a881d62eb73419cd639a6e3ca567f91

9 years agoam e17a9c4a: Change cryptfs keymaster padding to ensure the high bit is never 1,...
Shawn Willden [Tue, 9 Sep 2014 16:34:09 +0000 (16:34 +0000)]
am e17a9c4a: Change cryptfs keymaster padding to ensure the high bit is never 1, to ensure the padded message is never larger than the RSA public modulus.

* commit 'e17a9c4ad3ebb4051853a4860b18973e1a01ce11':
  Change cryptfs keymaster padding to ensure the high bit is never 1, to ensure the padded message is never larger than the RSA public modulus.

9 years agoChange cryptfs keymaster padding to ensure the high bit is never 1,
Shawn Willden [Mon, 8 Sep 2014 19:04:08 +0000 (13:04 -0600)]
Change cryptfs keymaster padding to ensure the high bit is never 1,
to ensure the padded message is never larger than the RSA public
modulus.

Bug: 17358530

Change-Id: I4dc488399c4ecfa2d24cacb839a9087e65475947

9 years agoam b2f682bd: Fix Shamus bricked by encryption upgrade
Paul Lawrence [Mon, 8 Sep 2014 20:21:04 +0000 (20:21 +0000)]
am b2f682bd: Fix Shamus bricked by encryption upgrade

* commit 'b2f682bda8443fb93ab67f19be84fd80d5ed2838':
  Fix Shamus bricked by encryption upgrade

9 years agoFix Shamus bricked by encryption upgrade
Paul Lawrence [Mon, 8 Sep 2014 18:28:19 +0000 (11:28 -0700)]
Fix Shamus bricked by encryption upgrade

Bug: 17358530
Change-Id: I95207b62131224a2ed7ae3b75621a09acd69ea79

9 years agoam 47ba10d6: Pad object to proper size before signing.
Shawn Willden [Fri, 5 Sep 2014 23:44:02 +0000 (23:44 +0000)]
am 47ba10d6: Pad object to proper size before signing.

* commit '47ba10d6d53e0d2e54453fe62324afdfa8d6c78a':
  Pad object to proper size before signing.

9 years agoDon't use deprecated OpenSSL functions.
Adam Langley [Wed, 3 Sep 2014 21:23:13 +0000 (14:23 -0700)]
Don't use deprecated OpenSSL functions.

This change simply switches from the deprecated
EVP_{En|De}crypt{Init|Final} to the newer, _ex versions of the same.

There is no difference in behaviour, save for calling
EVP_CIPHER_CTX_init, as the deprecated versions are just wrappers around
the _ex functions. See
https://git.openssl.org/gitweb/?p=openssl.git;a=blob;f=crypto/evp/evp_enc.c;h=f705967a40ab92cdf3c2ba8dd6bc19680d6157d6;hb=HEAD#l274

This change is required for the transition to BoringSSL, which removes
the deprecated functions.

Bug: 17409664
Change-Id: I35c6cc2d86d0c876a9edaff1e5571170fe393d87
Signed-off-by: Adam Langley <agl@google.com>
9 years agoPad object to proper size before signing.
Shawn Willden [Wed, 3 Sep 2014 23:07:06 +0000 (17:07 -0600)]
Pad object to proper size before signing.

Correct implementations of keymaster should reject using an n-bit
RSA key to sign less than n bits of data, because we specify that
keymaster should not perform padding.

Change-Id: Ibdff1bbfbee84fd5bdbfb3149a124dbbaa7827fc

9 years agoam 60dec16c: Correctly remove asecs for full disk encryption
Paul Lawrence [Tue, 2 Sep 2014 21:44:45 +0000 (21:44 +0000)]
am 60dec16c: Correctly remove asecs for full disk encryption

* commit '60dec16c5026d29a52791ad790860d247f47f8f2':
  Correctly remove asecs for full disk encryption

9 years agoCorrectly remove asecs for full disk encryption
Paul Lawrence [Tue, 2 Sep 2014 17:52:15 +0000 (10:52 -0700)]
Correctly remove asecs for full disk encryption

Previously this would fail if the framework wasn't stopped. The failure
would then stop full disk encryption. The fact that the unmount worked,
however, would then stop the second attempt from achieving anything.

Fix in line with current retry philosophy

We still need to figure out why Devmapper::destroy() fails at first.

Bug: 17301843
Change-Id: I405a36c832ccdebf2d904bef77f15eea174a6bfb

9 years agoam 74f29f1d: Don\'t test mount when we can use the crypto footer to test the password
Paul Lawrence [Fri, 29 Aug 2014 20:35:47 +0000 (20:35 +0000)]
am 74f29f1d: Don\'t test mount when we can use the crypto footer to test the password

* commit '74f29f1df7d12c0cc06e9d6685adf15e757d8eda':
  Don't test mount when we can use the crypto footer to test the password

9 years agoDon't test mount when we can use the crypto footer to test the password
Paul Lawrence [Thu, 28 Aug 2014 22:54:10 +0000 (15:54 -0700)]
Don't test mount when we can use the crypto footer to test the password

Note that this also changes the boot sequence, and moves the test for corrupted
data to cryptfs_restart_internal.

Bug: 17213613
Change-Id: I0f86e8fe3d482e2d1373bd0f4d0d861e63ad8904

9 years agoam 00786076: Merge "Don\'t reboot after default encrypting" into lmp-dev
Paul Lawrence [Tue, 26 Aug 2014 04:53:39 +0000 (04:53 +0000)]
am 00786076: Merge "Don\'t reboot after default encrypting" into lmp-dev

* commit '00786076cd6a3a32a42f95b4813ea807321b3fda':
  Don't reboot after default encrypting

9 years agoam 71577504: Show correct remaining time
Paul Lawrence [Tue, 26 Aug 2014 04:53:24 +0000 (04:53 +0000)]
am 71577504: Show correct remaining time

* commit '715775046c79f04d8975da53efcfbd1b70abe699':
  Show correct remaining time

9 years agoMerge "Don't reboot after default encrypting" into lmp-dev
Paul Lawrence [Mon, 25 Aug 2014 20:28:46 +0000 (20:28 +0000)]
Merge "Don't reboot after default encrypting" into lmp-dev

9 years agoShow correct remaining time
Paul Lawrence [Wed, 13 Aug 2014 21:55:55 +0000 (14:55 -0700)]
Show correct remaining time

In field reports, sometimes the remaining time gets stuck for many
minutes. This has to be caused by a spurious low reading early on which
cannot be overridded because of old logic.

Solution: allow time to increase but only by large amounts (avoid time
jittering up and down).

Bug: 16973374
Change-Id: I49d23ae8c54ded416cbedf383a3c03b33dc02e1c

9 years agoam 43ed123d: ASEC resize tweaking, allow read-write mounting.
Jeff Sharkey [Sun, 24 Aug 2014 19:04:02 +0000 (19:04 +0000)]
am 43ed123d: ASEC resize tweaking, allow read-write mounting.

* commit '43ed123d3fc1a3edf3660cd0e2528e971abc399e':
  ASEC resize tweaking, allow read-write mounting.

9 years agoASEC resize tweaking, allow read-write mounting.
Jeff Sharkey [Fri, 22 Aug 2014 19:29:05 +0000 (12:29 -0700)]
ASEC resize tweaking, allow read-write mounting.

Resize is no-op when sector count is unchanged; the caller can't
anticipate how vold does its sector calculations.

After resizing, we need to mount the container read-write, so allow
the caller to request "ro" or "rw" mode.

Handle ENOTSUP when trying to fallocate() on some filesystems

Bug: 16514385
Change-Id: I0d3a378280d4c36d14f8108ff428102283d583fa

9 years agoDon't reboot after default encrypting
Paul Lawrence [Fri, 15 Aug 2014 14:37:28 +0000 (07:37 -0700)]
Don't reboot after default encrypting

Instead trigger normal default encryption mount

Requires matching change to system/core: https://googleplex-android-review.git.corp.google.com/#/c/527286/

Bug: 17041092

Change-Id: Ifcf023386e08325db7dce61395fbb056f7d9815b

9 years agoam e82df164: Revert "Revert "cryptfs: Added support for f2fs fast encryption""
Daniel Rosenberg [Mon, 18 Aug 2014 20:02:53 +0000 (20:02 +0000)]
am e82df164: Revert "Revert "cryptfs: Added support for f2fs fast encryption""

* commit 'e82df164e8128ec9df0072c4a4f3d92e79a0f5f4':
  Revert "Revert "cryptfs: Added support for f2fs fast encryption""

9 years agoRevert "Revert "cryptfs: Added support for f2fs fast encryption""
Daniel Rosenberg [Fri, 15 Aug 2014 22:19:23 +0000 (22:19 +0000)]
Revert "Revert "cryptfs: Added support for f2fs fast encryption""

This reverts commit a70abc60091aed3c3eaf8bc8e1766e233c1c3a2f.

Change-Id: Ic41d1924638586cf9b2297f91ed5417f3b0303c6

9 years agoam 52f5425f: Merge "Fix Vold to properly handle full-disk file systems"
JP Abgrall [Fri, 15 Aug 2014 20:56:13 +0000 (20:56 +0000)]
am 52f5425f: Merge "Fix Vold to properly handle full-disk file systems"

* commit '52f5425ff53216e3d7e2410bffd05e0df2b13c9c':
  Fix Vold to properly handle full-disk file systems

9 years agoMerge "Fix Vold to properly handle full-disk file systems"
JP Abgrall [Fri, 15 Aug 2014 20:49:09 +0000 (20:49 +0000)]
Merge "Fix Vold to properly handle full-disk file systems"

9 years agoFix Vold to properly handle full-disk file systems
Robert Chiras [Tue, 27 May 2014 07:40:37 +0000 (10:40 +0300)]
Fix Vold to properly handle full-disk file systems

(full-disk: no partitions)

In Android, Vold recognizes a USB drive having a full-disk file system
and mounts it properly, but when the drive is removed from system Vold
won't unmount the device. This is because Vold only unmounts partitions.
For a FAT32 USB drive (with partitions), kernel will create two devices:
sda (disk device) and sda1 (partition device). When the drive is removed,
Vold will receive two netlink events: one for partition remove (sda1)
and one for disk remove (sda). The unmount occurs only when partition
remove event is received.
For a full-disk FS USB drive, kernel will only create one device: sda
(disk device). When the drive is removed, Vold will only receive one
netlink event for disk remove (sda) and it won't unmount the device.

This patch will verify if there is a currently mounted device when disk
remove event is received and will perform unmount, to properly unmount
the device.

Change-Id: I4866ab2482fddfb40a8fc73083f31df846bbb24f
Signed-off-by: Robert Chiras <robert.chiras@intel.com>
9 years agoam a70abc60: Revert "cryptfs: Added support for f2fs fast encryption"
Jim Miller [Fri, 15 Aug 2014 11:49:55 +0000 (11:49 +0000)]
am a70abc60: Revert "cryptfs: Added support for f2fs fast encryption"

* commit 'a70abc60091aed3c3eaf8bc8e1766e233c1c3a2f':
  Revert "cryptfs: Added support for f2fs fast encryption"

9 years agoam 74c01201: cryptfs: Added support for f2fs fast encryption
Daniel Rosenberg [Fri, 15 Aug 2014 11:48:33 +0000 (11:48 +0000)]
am 74c01201: cryptfs: Added support for f2fs fast encryption

* commit '74c01201dec12b5de43ba0f20a2f38e835cd00af':
  cryptfs: Added support for f2fs fast encryption

9 years agoam 211c0cfd: Merge "Enable SD card format"
JP Abgrall [Fri, 15 Aug 2014 04:28:21 +0000 (04:28 +0000)]
am 211c0cfd: Merge "Enable SD card format"

* commit '211c0cfda6c38469180a8ae87228603d7f317778':
  Enable SD card format

9 years agoRevert "cryptfs: Added support for f2fs fast encryption"
Jim Miller [Fri, 15 Aug 2014 02:00:45 +0000 (02:00 +0000)]
Revert "cryptfs: Added support for f2fs fast encryption"

This reverts commit 74c01201dec12b5de43ba0f20a2f38e835cd00af.

Change-Id: Ib397a2b5812179ee2e2b68de5d718077563adc1c

9 years agocryptfs: Added support for f2fs fast encryption
Daniel Rosenberg [Wed, 13 Aug 2014 08:56:18 +0000 (01:56 -0700)]
cryptfs: Added support for f2fs fast encryption

Bug: 15749466
Change-Id: I25452a05e1cbe90ac6603a89db9b720c7ab17e55
Signed-off-by: Daniel Rosenberg <drosen@google.com>
9 years agoMerge "Enable SD card format"
JP Abgrall [Fri, 15 Aug 2014 02:46:35 +0000 (02:46 +0000)]
Merge "Enable SD card format"

9 years agoWipe userdata when password is good but it won't mount
Paul Lawrence [Fri, 8 Aug 2014 21:28:10 +0000 (14:28 -0700)]
Wipe userdata when password is good but it won't mount

Store salted scrypt of intermediate key in crypto header

When mount fails, check if matches, and if it does return error
code prompting a wipe

Bug: 11477689
Change-Id: I3dcf9e0c64f2a01c8ba8eaf58df82cbe717d421b

9 years agofstrim: Use a local definition of the IOCTL FIDTRIM number
JP Abgrall [Fri, 8 Aug 2014 01:44:37 +0000 (18:44 -0700)]
fstrim: Use a local definition of the IOCTL FIDTRIM number

As it is not upstream, it doesn't belong in the external/kernel-headers
... or in bionic's cleaned up copy.

It matches what is in common/android-3.10.

Bug: 15593563
Change-Id: I6fa22cd823a88805ec57f973813ac69291069c7d

9 years agofstrim: fix typo in log message for FIDTRIM case
JP Abgrall [Thu, 7 Aug 2014 23:50:44 +0000 (16:50 -0700)]
fstrim: fix typo in log message for FIDTRIM case

Bug: 15593563
Change-Id: I2b5fbbfb694e1b87de6c14ab63f1a5f803bbbc36

9 years agoWhen encryption fails, reboot into recovery
Paul Lawrence [Mon, 28 Jul 2014 19:47:22 +0000 (12:47 -0700)]
When encryption fails, reboot into recovery

Set flag on starting encryption to say it failed, and only clear
when we get into a recoverable state (partially or fully encrypted.)

Go to recovery on seeing this flag on boot

Bug: 16552363
Change-Id: I7e452b653edf3a087ecfaba8f81f41765a1c8daf

9 years agofstrim: prep for supporting a deep trim ioctl
JP Abgrall [Tue, 29 Jul 2014 20:24:56 +0000 (13:24 -0700)]
fstrim: prep for supporting a deep trim ioctl

This adds an "fstrim dodtrim" command which will attempt to use
the FIDTRIM ioctl() if FIDTRIM is defined in the uapi/linux/fs.h.
If not, it will fail with EINVAL.

If no FIDTRIM is defined, it does not affect the "fstrim dotrim".

Change-Id: Icbfd621abb592b170db06f749e5eedfd1175f723

9 years agoFix failure erasing SD in Factory reset
Cylen Yao [Tue, 22 Jul 2014 02:34:49 +0000 (10:34 +0800)]
Fix failure erasing SD in Factory reset

Initialize mIsDecrypted to prevent from formatting SD failure

Change-Id: I30851e6b01b0999bf0b8c1e4b8e3f3a976a41ad1
Signed-off-by: Cylen Yao <cylen.yao@mediatek.com>
(cherry picked from commit 5dbcbd03149af50db42dadeebf565333ce399182)

9 years agovold: support "volume list [broadcast]" command
JP Abgrall [Fri, 25 Jul 2014 01:02:16 +0000 (18:02 -0700)]
vold: support "volume list [broadcast]" command

Sometimes when an sdcard is already mounted,
some info like uuid and label are not re-broadcast to new listeners.
The extra argument to list allows late listeners to catch up by asking
volume list to broadcast that info again.

Bug: 16253597
Bug: 16306775
Change-Id: Ie7d0c1132c22d307a5b2a0e50075a3716138d00b
Signed-off-by: Benson Huang <benson.huang@mediatek.com>
(cherry picked from commit 85f4700f44170b772697e627b3075dcb9137e1b7)

9 years agoFat.cpp: Tuned FAT parameters according to SD Association recommendations.
Daniel Rosenberg [Thu, 26 Jun 2014 22:35:24 +0000 (15:35 -0700)]
Fat.cpp: Tuned FAT parameters according to SD Association recommendations.

Updated cluster size to be 32k, and aligned the starting cluster of the root
directory to be cluster aligned.

Change-Id: I759997569f7a0263a076cc462b235a6cf54e0c5f
Signed-off-by: Daniel Rosenberg <drosen@google.com>
9 years agoEnable SD card format
Bogdan George Stefan [Mon, 30 Jun 2014 12:40:03 +0000 (15:40 +0300)]
Enable SD card format

When an SD card has no MBR it cannot be formatted
and then mounted by Android. This is because
the device node was incremented by one by mistake
when building the device path

Change-Id: I8533c6028151fe28246e74f89a294c1e58e79438
Signed-off-by: Bogdan George Stefan <bogdan.g.stefan@intel.com>
10 years agoFix an accidental PRId64 to PRIx64.
Elliott Hughes [Thu, 26 Jun 2014 01:36:19 +0000 (18:36 -0700)]
Fix an accidental PRId64 to PRIx64.

Change-Id: Ic5313289d826bac74c3466b33f1f167a8f0955ad

10 years agoresolved conflicts for merge of afa60cee to master
Elliott Hughes [Thu, 26 Jun 2014 01:25:11 +0000 (18:25 -0700)]
resolved conflicts for merge of afa60cee to master

Change-Id: I1568def8839bed4d4d2dadbd97194d5603edc627

10 years agoam c0c28675: Merge "Fix vold %lld to PRId64."
Elliott Hughes [Thu, 26 Jun 2014 00:37:45 +0000 (00:37 +0000)]
am c0c28675: Merge "Fix vold %lld to PRId64."

* commit 'c0c2867518eed4539444434c95fad8185a6ac08e':
  Fix vold %lld to PRId64.

10 years agoMerge "Fix vold %lld to PRId64."
Elliott Hughes [Thu, 26 Jun 2014 00:28:33 +0000 (00:28 +0000)]
Merge "Fix vold %lld to PRId64."

10 years agoFix vold %lld to PRId64.
Elliott Hughes [Thu, 26 Jun 2014 00:27:42 +0000 (17:27 -0700)]
Fix vold %lld to PRId64.

Change-Id: I6eb9f21fff124b8b22f4fae2ac74c2b41d93b384

10 years agocryptfs: makefs F2FS if the partition type is F2FS.
JP Abgrall [Mon, 16 Jun 2014 20:01:23 +0000 (13:01 -0700)]
cryptfs: makefs F2FS if the partition type is F2FS.

When a crypto is enabled with a wipe flag (obsolete?),
it will correctly handle the fstab's choice for the fs type.

Remove the dead code for FAT_FS which was un-invocable.

Change-Id: I8d141a0d4d14df9fe84d3b131484e9696fcd8870
Signed-off-by: JP Abgrall <jpa@google.com>
10 years agoIncrease asec image size for reflecting ext4 reserved clusters
Daniel Rosenberg [Wed, 11 Jun 2014 00:16:03 +0000 (17:16 -0700)]
Increase asec image size for reflecting ext4 reserved clusters

From Shawn Heo's patch:

Ext4 introduced reserved clusters to prevent costly zeroout, or
unexpected ENOSPC. The size is 2% or 4096 clusters, whichever
is smaller (http://lwn.net/Articles/546473/).

So, we need to allocate additionally this amount of free space
to asecs when vold create asec images. This is required when
Android runs on Linux kernel 3.10 or later.

see: https://android-review.git.corp.google.com/#/c/96160

Change-Id: Iacff16b8cf0314493c355fa741bcfa519f744d6c
Signed-off-by: Daniel Rosenberg <drosen@google.com>
10 years agoAdded support for ext4 ASEC resizing.
Daniel Rosenberg [Thu, 22 May 2014 18:23:56 +0000 (11:23 -0700)]
Added support for ext4 ASEC resizing.

ASECs formatted as ext4 can now be resized using vdc asec resize.
Refactored some common code.
Requires resize2fs.

Change-Id: Ie78bb6015114a7bc4af42b16d1f299322ffc1e2a
Signed-off-by: Daniel Rosenberg <drosen@google.com>
10 years agoOn low power turn off rather than rebooting to allow device to charge
Paul Lawrence [Mon, 9 Jun 2014 21:10:09 +0000 (14:10 -0700)]
On low power turn off rather than rebooting to allow device to charge

The code was using encrypted_upto == 0 as an indicator that encryption
has succeeded. This meant that if no encryption happened, we would reboot
continually.

We now set encrypted_upto to fs_size when encryption is complete.

Also don't start to encrypt unless we are at 10% power. Stop when we
get to 5% power. This should lead to partial encryptions only very
rarely.

Bug: 15513202
Change-Id: I6214d78579d1fbbe2f63ee8862473d86a89d29b3

10 years agoam df293f14: merge in master-release history after reset to b31f33b5e41bf295705b8f0c1...
The Android Automerger [Fri, 6 Jun 2014 15:42:06 +0000 (15:42 +0000)]
am df293f14: merge in master-release history after reset to b31f33b5e41bf295705b8f0c1582c6277e8fec64

* commit 'df293f14f5bdb4f572c7f836ebb0802a177836ff':
  Fix encryption on Nakasi

10 years agoam ea256025: am 45faade2: Merge "Replaces uses of index() with strchr()."
Dan Albert [Thu, 5 Jun 2014 20:33:07 +0000 (20:33 +0000)]
am ea256025: am 45faade2: Merge "Replaces uses of index() with strchr()."

* commit 'ea256025669f4a5dd8c59e4c70ec7154a198be48':
  Replaces uses of index() with strchr().

10 years agoam 45faade2: Merge "Replaces uses of index() with strchr()."
Dan Albert [Thu, 5 Jun 2014 20:29:33 +0000 (20:29 +0000)]
am 45faade2: Merge "Replaces uses of index() with strchr()."

* commit '45faade28ae9e245e7c611c26990254aba006d2a':
  Replaces uses of index() with strchr().

10 years agoMerge "Replaces uses of index() with strchr()."
Dan Albert [Thu, 5 Jun 2014 19:56:03 +0000 (19:56 +0000)]
Merge "Replaces uses of index() with strchr()."

10 years agoCalculate time to go while encrypting
Paul Lawrence [Wed, 4 Jun 2014 21:05:01 +0000 (14:05 -0700)]
Calculate time to go while encrypting

@bug 15159008

Change-Id: I6a96eeab180dceb0613202ba5d252036a0d5376f

10 years agoShow correct percentage when encrypting used blocks only
Paul Lawrence [Wed, 4 Jun 2014 20:12:21 +0000 (13:12 -0700)]
Show correct percentage when encrypting used blocks only

Bug: 12975202
Change-Id: I7e4adfa2c4951055bbb2c11986a7784f465f586f

10 years agoReplaces uses of index() with strchr().
Dan Albert [Thu, 5 Jun 2014 18:44:40 +0000 (11:44 -0700)]
Replaces uses of index() with strchr().

Bionic is removing index() because it was removed from POSIX 2008.

Change-Id: I704fb8962ff2c08b8f12245d2db2118d410826b0

10 years agoFixed bugs with ASEC filesystem.
Daniel Rosenberg [Fri, 23 May 2014 20:47:00 +0000 (13:47 -0700)]
Fixed bugs with ASEC filesystem.

Changed ext4 to be 4kb aligned, and fat to be 32kb aligned.
Fixed issue that could potentially cause unencrypted ext4
ASECS to overwrite the ASEC super block when filled.

Change-Id: I890426c82ac9cbc65add85a8e3f5063504193c31
Signed-off-by: Daniel Rosenberg <drosen@google.com>
10 years agoam 099b20f3: am 1881395b: am c6752b06: Merge "vold: wildcard support for device path...
JP Abgrall [Tue, 27 May 2014 19:28:07 +0000 (19:28 +0000)]
am 099b20f3: am 1881395b: am c6752b06: Merge "vold: wildcard support for device path matching"

* commit '099b20f3ce42a49ba49a1a70a818047ea59612ad':
  vold: wildcard support for device path matching

10 years agoam 1881395b: am c6752b06: Merge "vold: wildcard support for device path matching"
JP Abgrall [Tue, 27 May 2014 19:24:03 +0000 (19:24 +0000)]
am 1881395b: am c6752b06: Merge "vold: wildcard support for device path matching"

* commit '1881395b696017dfb40a01e718cc8dc2ea7a38e9':
  vold: wildcard support for device path matching