Commit graph

124 commits

Author SHA1 Message Date
Yifan Hong
57838d665f vold: remove unnecessary dependency on libbatteryservice.
Battery check could be replaced by hwbinder calls into
android.hardware.health@2.0 instead, but because
of b/16868177, this is actually not needed.

Bug: 62229583
Test: pass
Change-Id: Ieb03e6ee2f648d9c1d85dbbdc10626726f5fe39b
2017-09-27 18:49:18 -07:00
Elliott Hughes
4e19ff7ab1 Merge "Switch to libkeyutils." am: 612eea6b4f am: 7a7df78819
am: f727d05b83

Change-Id: I1b3e4e932e54b33dd582a849135822ace61c11d7
2017-05-13 00:44:18 +00:00
Elliott Hughes
12d1312f98 Switch to libkeyutils.
Bug: http://b/37991155
Test: builds+boots
Change-Id: I33a3ba0d59ffd504093dc94517815c1196e95e2b
2017-05-09 17:01:04 -07:00
Wei Wang
4375f1be4c Change to use new WaitForProperty API
Change to use WaitForProperty API to wait for vold.post_fs_data_done
Also change cryptfs to C++

Bug: 35425974
Test: mma, marlin/angler boot

Change-Id: Id821f2035788fcc91909f296c83c871c67571de3
2017-02-24 17:47:53 -08:00
Isaac Chen
fec6ba5c8c Merge "Removed HW encryption build flags and related code." am: bf8518056d am: 95dc636942 am: 730c6196a2
am: 2f88e97172

Change-Id: I2decffa399cbc941b93ba251957f2a9168945d29
2017-02-15 09:00:36 +00:00
Isaac Chen
dff70b4e3e Removed HW encryption build flags and related code.
TARGET_HW_DISK_ENCRYPTION and TARGET_CRYPTFS_HW_PATH build flags
and related code in cryptfs.c are removed since it doesn't match
the driver in current tree.

To enable HW encryption, the driver needs to be hidlized.

Bug: 34268168

Test: compile
Change-Id: I507a0e2908b3c407c565e44873b82c94a8305de6
2017-02-14 20:40:00 +08:00
TreeHugger Robot
7c289b44cd Merge "Port to binder based keymaster hal" 2017-01-23 22:58:29 +00:00
bowgotsai
a4792eb229 Merge "Include libavb in static libraries" am: d65506217d am: 967f9715c3 am: ab9218c64f
am: efb59f9971

Change-Id: Ia64f945476f38bbe5047c5a62d4e2ff08e84eaec
2017-01-21 13:03:42 +00:00
Janis Danisevskis
8e537b8002 Port to binder based keymaster hal
Bug: 32020919
Change-Id: If45ece76fdaf4d2c80eddc537e429633e4d42f9d
2017-01-17 11:23:40 +00:00
bowgotsai
58bdac8d25 Include libavb in static libraries
Bug: 31264231
Test: compile
Change-Id: I1d84f7aa67a0ed31f2b6400cf1c9567bf503295a
2017-01-07 00:45:14 +08:00
Paul Crowley
4315c6a0c3 Enable building and running the vold_tests module as part of a
standard build; make it use only static libraries as per documented
limitations of APCT.

Bug: 33384925
Test: This is a test.
Change-Id: I794adbfa3376795120cfbca1e9322093960009b5
2016-12-06 08:22:04 -08:00
Adrien Schildknecht
6218c51e4b Manually merge commit 'b406ffa' into stage-aosp-master am: 04c55e6ed7 am: 93722ead06
am: 43100e580f

Change-Id: I8a74fd730f0aa5a1f94c04c12286e96ac299b463
2016-12-03 04:20:13 +00:00
Adrien Schildknecht
e0f409ca32 Add support for creating ext4 images with mke2fs
We are investigating replacing make_ext4fs with the upstream tool mke2fs.
See b/23686092 for more informations.

To mitigate the trouble that may arise if the new tool behave differently
compared to the old one, there will be a transition period where both mke2fs
and make_ext4fs will be supported.

This patch does 3 things:
  - add the necessary code to use mke2fs to format an ext4 partition;
  - add a dependency to the binary used by vold.

Test: m -j32 with TARGET_USES_MKE2FS={,false,true}
                  TARGET_USERIMAGES_USE_EXT4={,true}

Change-Id: I89222642fe1d11a035155c8224b84b2e3719938b
2016-11-22 18:46:37 -08:00
Yabin Cui
889ed48e5f Use libbootloader_message.
Bug: 29582118

Change-Id: I8de2cfbc62908011dba2ab86d17f977ebcfadac0
(cherry picked from commit 1fb5966fbb)
2016-10-16 17:04:46 -07:00
Tao Bao
5a95ddbacf Update the header path for ext4_utils.
Test: mmma system/vold

Change-Id: I805b8874b05b8043390c2cd3c143cc469913c067
(cherry picked from commit 989fec2769)
2016-10-07 16:54:29 -07:00
Tao Bao
989fec2769 Update the header path for ext4_utils.
Test: mmma system/vold

Change-Id: I805b8874b05b8043390c2cd3c143cc469913c067
2016-10-05 23:12:49 -07:00
Paul Crowley
dff8c727c1 Support Keymaster 2 configuration and key upgrading
Bug: 27212248
Change-Id: I96bd9a442f4f535ba6ea44c9e81bcc1fee0ec471
2016-08-15 13:58:37 -07:00
Yabin Cui
951de915a3 Use libbootloader_message.
am: 1fb5966fbb

Change-Id: Ib97b3be116b704188082a81626a9b5ecdde56726
2016-06-30 22:55:42 +00:00
Yabin Cui
1fb5966fbb Use libbootloader_message.
Bug: 29582118

Change-Id: I8de2cfbc62908011dba2ab86d17f977ebcfadac0
2016-06-29 16:50:05 -07:00
Elliott Hughes
ccd9dd53f8 resolve merge conflicts of 81fd991 to nyc-dev-plus-aosp
Change-Id: Iabda2c9ad05ed4aa0a078c5da40b887f36dd9328
2016-04-12 16:44:04 -07:00
Yabin Cui
ffa2e09921 vold: write bootloader message directly.
Bug: 27176738
Change-Id: I09bfe777e383325809d7ecc2dcb9129fe234053f
2016-04-06 17:21:38 -07:00
Mattias Nissler
dc80323969 Switch to BoringSSL crypto.
This replaces the libmincrypt dependency with libcrypto_utils, which
is needed due to libfec and fs_mgr switching to BoringSSL.

Change-Id: I4f6f4d8cc5e200679331a9bcdf2cc3bad1082dd6
2016-04-06 15:54:11 +02:00
Dimitry Ivanov
01f86a521d Add missing liblog dependency
Bug: http://b/27171986
Change-Id: I03c5f9375ca46a81250ac00493a4f3f1eebf3156
2016-02-12 16:10:22 -08:00
Paul Crowley
63c18d3ba9 Add scrypt-based password stretching.
Bug: 27056334
Change-Id: Ifa7f776c21c439f89dad7836175fbd045e1c603e
2016-02-10 14:07:59 +00:00
Jeff Sharkey
47695b29af Allow callers to prepare CE/DE user storage.
Give callers the option of preparing CE and/or DE storage.  The
framework will only prepare CE storage after the CE keys have been
unlocked for that user.

When init is calling enablecrypto, kick off the work in a thread so
that we can make other calls back into vold without causing
deadlock.  Leaves blocking call intact for framework callers.

Clean up 'vdc' tool to send useful transaction numbers, and
actually watch for the matching result to come back.  This fixes
race conditions when there are multiple 'vdc' callers.

Also add other system and misc directories to match spec.

Bug: 25796509
Change-Id: Ie4f853db6e387916b845d2b5fb92925d743b063d
2016-02-05 13:03:52 -07:00
Jeff Vander Stoep
75fc83bac8 resolve merge conflicts of 2b6f9ce823 to master.
Change-Id: I69f36f560334b11b099f2eb15999603dd2469d4f
2016-02-01 15:24:58 -08:00
Jeff Vander Stoep
df72575862 cryptfs: run e2fsck/fsck.f2fs in fsck domain
e2fsck and fsck.f2fs must run in the fsck domain. Add call to
setexeccon() to tell selinux to run in the fsck domain on exec.

Addresses:
avc: denied { execute_no_trans } for path="/system/bin/e2fsck" dev="mmcblk0p41" ino=241 scontext=u:r:vold:s0 tcontext=u:object_r:fsck_exec:s0 tclass=file

Bug: 26872236
Change-Id: Ib2a583aeefc667f8aa67532e0ac0ff9619b65461
2016-02-01 12:59:59 -08:00
Paul Crowley
13ffd8ef7a Improvements to the key storage module
The key storage module didn't comply with Android coding standards
and had room for improvemnet in a few other ways, so have cleaned up.

Change-Id: I260ccff316423169cf887e538113b5ea400892f2
2016-01-27 15:54:35 +00:00
Paul Crowley
1ef255816c Use a keymaster-based key storage module
Instead of writing raw keys, encrypt the keys with keymaster. This
paves the way to protecting them with auth tokens and passwords later.
In addition, fold in the hash of a 16k file into their encryption, to
ensure secure deletion works properly.

Now even C++ier!

Bug: 22502684
Bug: 22950892
Change-Id: If70f139e342373533c42d5a298444b8438428322
2016-01-26 18:24:03 +00:00
Paul Crowley
8bb8fcfb4f Use android-base logging not cutils in secdiscard
Much nicer C++ style logging, but the main reason is to clean up
AutoCloseFD.h so I don't have to use cutils to use it.

Change-Id: I7a7f227508418046eecce6c89f813bd8854f448a
2016-01-12 10:03:05 +00:00
Sami Tolvanen
f0500a0823 am 0331d4ae: am 685dfdd3: Merge "Error correction: Add libfec dependencies for vold"
* commit '0331d4ae3843f682e98bfa1aba0f8da7fbd9beb0':
  Error correction: Add libfec dependencies for vold
2015-10-02 10:55:10 +00:00
Sami Tolvanen
0331d4ae38 am 685dfdd3: Merge "Error correction: Add libfec dependencies for vold"
* commit '685dfdd33590ef8a93627015c434fea54b8f1b4d':
  Error correction: Add libfec dependencies for vold
2015-10-02 10:47:23 +00:00
Sami Tolvanen
efe67cd25d Error correction: Add libfec dependencies for vold
Vold requires libfec and related dependencies due to fs_mgr_mount_all.

Bug: 21893453
Change-Id: If59df0c5fd3395d4aac97dd8119b7c70c0fa5d4d
2015-09-29 14:55:35 +01:00
Tom Cherry
10b02df820 am 218f48d6: Merge "bundle init.rc contents with its service"
* commit '218f48d6c55a7ee5115a7a8fc4248d33ea01811f':
  bundle init.rc contents with its service
2015-08-21 18:24:14 +00:00
Tom Cherry
685439bbc7 am 218f48d6: Merge "bundle init.rc contents with its service"
* commit '218f48d6c55a7ee5115a7a8fc4248d33ea01811f':
  bundle init.rc contents with its service
2015-08-21 18:20:19 +00:00
Tom Cherry
a285984ae4 bundle init.rc contents with its service
Bug: 23186545
Change-Id: I82d8b6dc54ebe32ceb1ed997aaab3701ee7b6c4a
2015-08-19 17:36:11 -07:00
Paul Crowley
f4000e480d am 5bd0daf9: Add tool for scrubbing files with BLKSECDISCARD.
* commit '5bd0daf926ea8096dc091d7b99ff9e56cc5746aa':
  Add tool for scrubbing files with BLKSECDISCARD.
2015-07-14 15:06:47 +00:00
Paul Crowley
5bd0daf926 Add tool for scrubbing files with BLKSECDISCARD.
Bug: 19706593

(based on work in commit 8d0cd7ffd903a753c6bb5c6f33987a7a66621cef)

Change-Id: I9699275a63f2d0a110435bd4a725d7dfcce4ed90
2015-07-13 21:08:45 +01:00
Jeff Sharkey
3ff337db56 am c86ab6f5: Trim both internal and adopted private storage.
* commit 'c86ab6f538bec63638c168d6c843fe7cf73add3b':
  Trim both internal and adopted private storage.
2015-07-02 00:58:16 +00:00
Jeff Sharkey
c86ab6f538 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
2015-07-01 15:53:51 -07:00
Jeff Sharkey
d6a77b518c am d0640f63: Add f2fs support for private volumes.
* commit 'd0640f6358041f7e2657167560b357078db73526':
  Add f2fs support for private volumes.
2015-06-09 13:01:36 +00:00
Jeff Sharkey
d0640f6358 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
2015-06-08 20:21:25 -07:00
Paul Lawrence
5c18a67579 Merge commit 'd0b4295c' into manualmerge
Change-Id: I6d7178edebf50663fa9622b539c8101627a84385
2015-06-04 16:01:47 -07:00
Paul Lawrence
d0b4295ccc 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
2015-06-04 21:29:01 +00:00
Paul Lawrence
731a7a242d DO NOT MERGE Securely encrypt the master key
(cherry-picked from commit 707fd6c7cc)

Move all key management into vold
Reuse vold's existing key management through the crypto footer
to manage the device wide keys.

Use ro.crypto.type flag to determine crypto type, which prevents
any issues when running in block encrypted mode, as well as speeding
up boot in block or no encryption.

This is one of four changes to enable this functionality:
  https://android-review.googlesource.com/#/c/148586/
  https://android-review.googlesource.com/#/c/148604/
  https://android-review.googlesource.com/#/c/148606/
  https://android-review.googlesource.com/#/c/148607/

Bug: 18151196

Change-Id: I3c68691717a61b5e1df76423ca0c02baff0dab98
2015-05-29 17:25:54 +00:00
Jeff Sharkey
ddd4da1af6 am 5a6bfca1: Initial pass at storage benchmarks.
* commit '5a6bfca1638760b87cf64c5ffb48ff3557cc0563':
  Initial pass at storage benchmarks.
2015-05-15 22:22:33 +00:00
Jeff Sharkey
5a6bfca163 Initial pass at storage benchmarks.
Now that we're offering to store private app data on adopted storage
devices, the performance of those devices is much more important to
overall user experience.

To help set user expectations, this change offers to execute a
real-world benchmark on a storage device, returning a metric that can
be used to compare internal and external storage.  The benchmark is
generated from the strace-instrumented storage access patterns of
typical apps.

A typical device completes the benchmark in under two seconds on
internal storage, a UHS-3 SD card is even faster (!), but a very slow
Class 4 SD card takes about 30 seconds to complete, giving us a clear
signal.

The measured benchmark numbers are logged along with information
about the storage device, such as manufacturer, model, etc.  Card
serial numbers are scrubbed from output.

Bug: 21172095
Change-Id: I9b2713dafdfdfcf5d97bf1bc21841f39409a7e54
2015-05-15 10:48:11 -07:00
Kenny Root
e05aacfec6 resolved conflicts for merge of 9df68a13 to mnc-dev-plus-aosp
Change-Id: I5c72c27ec055195d84c58d0699b46d3942c29dde
2015-05-13 09:36:52 -07:00
Paul Crowley
75a5202d9f Add vold commands for setting up per-user encrypted user
directories

Bug: 19704432
Change-Id: I15980eed8e4960ca270cf0f8db4e480a8c2ca832
2015-05-13 10:17:14 +01:00
Paul Crowley
4f817d1bd2 am 42696d97: Merge "Make vdc a C++ file as a base for further improvement."
* commit '42696d97ce138fa5e7a1380b3841250549acb615':
  Make vdc a C++ file as a base for further improvement.
2015-05-06 23:48:01 +00:00