Commit graph

408 commits

Author SHA1 Message Date
Kenny Root
c4c70f15bb Change key derivation to scrypt
scrypt is a sequential memory-hard key derivation algorithm that makes
it more difficult for adversaries to brute force passwords using
specialized equipment. See http://www.tarsnap.com/scrypt/scrypt.pdf for
more details of the algorithm.

This adds support for initializing disk encryption using scrypt and
upgrading from the previous PBKDF2 algorithm.

Change-Id: I1d26db4eb9d27fea7310be3e49c8e6219e6d2c3b
2013-06-24 09:40:54 -07:00
Kenny Root
c96a5f8edf Extract some version constants to header
In order to make it easier to upgrade the crypto footer, extract some
constants to a header file instead. Then the header can control what the
current version is and the upgrade_crypto_ftr code should be the only
thing that needs to be updated.

Change-Id: I3ed5a7d3b640419cd8af91388d94a00de8cc09db
2013-06-14 12:50:02 -07:00
Kenny Root
7434b3111b Change upgrade code to allow multiple versions
In the future, we'd like to have the ability to upgrade from any
supported version to any future version. Change the upgrade function
slightly to support this.

Change-Id: I3b20ccfff51c4c86f1e5e08690c263dc95ff5ce4
2013-06-14 11:32:18 -07:00
Ken Sumrall
9caab76c6b vold: Add an optional wipe paramter to the volume format command
The new wipe option to the vold format command will invoke BLKDISCARD
on the partition before invoking newfs_msdos.  This will be used whenever
a full wipe of the device is wanted, as this is more secure than just
doing newfs_msdos.

Bug: 9392982
Change-Id: Ie106f1b9cc70abc61206006d1821641c27c7ccae
2013-06-12 18:42:02 -07:00
The Android Open Source Project
dfbf110dfa am 9420c0b3: (-s ours) Reconcile with jb-mr2-release - do not merge
* commit '9420c0b338106eed246b362238b063ecdab3a710':
  Grab a partial wakelock when doing fstrim
2013-05-16 05:48:24 -07:00
The Android Open Source Project
9420c0b338 Reconcile with jb-mr2-release - do not merge
Change-Id: I58dee084939bd1b49432bfb4e460dddeb4f6e15a
2013-05-16 05:44:19 -07:00
The Android Automerger
d0be146cee merge in jb-mr2-release history after reset to jb-mr2-dev 2013-05-15 05:55:51 -07:00
Ken Sumrall
e88e1eb745 am c587269c: vold: Increase timeout due to selinux changes
* commit 'c587269c5a34d4e7412ff42e53ed6312359a8505':
  vold: Increase timeout due to selinux changes
2013-05-14 19:19:22 -07:00
Ken Sumrall
c587269c5a vold: Increase timeout due to selinux changes
The new selinux_reload_policy command can take a while to complete on
some systems.  The reason is being investigated, and hopefully a fix can
be found to improve performance, but for now, increase the timeout that
vold waits for the post_fs_data section to complete when decrypting a
device on boot.

Also, emit a decent error message if the device times out.

Bug: 8967715
Change-Id: Ifb01c983dffe095a9de752c17c467a1751e9ce99
2013-05-14 15:26:31 -07:00
Alex Klyubin
707795ad39 Fix a typo in a comment
Change-Id: Ibb9667d762189849ebcbefef4ba70ffd34cf885e
2013-05-10 15:17:07 -07:00
Ken Sumrall
1ede90d504 am bc7d5088: vold: Have the fstrim log start and finish times in the event log
* commit 'bc7d5088f7f7cbd097f99d2f6d015e2c0a73cacb':
  vold: Have the fstrim log start and finish times in the event log
2013-05-08 15:03:52 -07:00
The Android Automerger
4d5a7ca549 merge in jb-mr2-release history after reset to jb-mr2-dev 2013-05-08 05:55:57 -07:00
Ken Sumrall
bc7d5088f7 vold: Have the fstrim log start and finish times in the event log
bug: 8688454

Change-Id: I5540ab27d3ade2c42ee8fd0de6fbfc1d1e19e36f
2013-05-07 17:29:12 -07:00
Ken Sumrall
8cca752b80 Grab a partial wakelock when doing fstrim
Fstrim can take a while, so grab a wakelock so it finishes now,
not when the user picks up the device and wakes it back up.

This change does not protect against multiple calls to fstrim
before the first one completes.  When the first one completes, it
will release the wakelock, and the device will go to sleep.
However, normal usage is this will not be invoked by the framework
more than once a day, so this should not be an issue.

Bug: 8781133

Change-Id: I8065d1380eaf52ca8a7ca308af66fb6e86d60a66
2013-05-02 15:47:40 -07:00
Ken Sumrall
924d9defc6 am e78cd4f3: Grab a partial wakelock when doing fstrim
* commit 'e78cd4f33d2b7969f1baca2b274740e1b53b3121':
  Grab a partial wakelock when doing fstrim
2013-05-02 11:36:02 -07:00
Ken Sumrall
e78cd4f33d Grab a partial wakelock when doing fstrim
Fstrim can take a while, so grab a wakelock so it finishes now,
not when the user picks up the device and wakes it back up.

This change does not protect against multiple calls to fstrim
before the first one completes.  When the first one completes, it
will release the wakelock, and the device will go to sleep.
However, normal usage is this will not be invoked by the framework
more than once a day, so this should not be an issue.

Bug: 8781133

Change-Id: I8065d1380eaf52ca8a7ca308af66fb6e86d60a66
2013-05-01 23:37:45 -07:00
Ken Sumrall
2c4b563b3d vold: Do not print fstrim amount if ioctl returns an error
Change-Id: I8620ea67a774ead51bd6bd9b6e737bf3d634470b
2013-04-29 19:17:56 -07:00
Ken Sumrall
160b4d68ec vold: Add support for unencrypted persistent info
In order to display the correct language, timezone, airplane
mode and other settings on the decrypt screen, a copy of those
settings needs to be stored unencrypted so the framework can
query them.  This adds support to vold to store up to 32
property like key/value pairs that are not encrypted.

Change-Id: Id5c936d2c57d46ed5cff9325d92ba1e8d2ec8972
2013-04-26 15:44:59 -07:00
Ken Sumrall
d3ae5221e2 am 743a5ec9: vold: Perform fstrim work in a separate thread.
* commit '743a5ec96cd54bdc06234be15cdde65296357a6a':
  vold: Perform fstrim work in a separate thread.
2013-04-23 15:02:09 -07:00
Ken Sumrall
743a5ec96c vold: Perform fstrim work in a separate thread.
Some devices can take up to a few minutes to do fstrim.  If done
in the same thread as the rest of the vold command listener, then
vold is blocked from responding to any other commands until the
trim is done.  So create a thread to do the work, and return
immediately.

bug: 8688454

Change-Id: I780baae03ba7de2d3e805c3e9f103ec03be84c47
2013-04-22 19:21:07 -07:00
Ken Sumrall
5fb923142f am b55025bf: Merge "vold: set klog level so e2fsck output is logged" into jb-mr2-dev
* commit 'b55025bfa1039c8fa205727b49fe4a8dd1df7725':
  vold: set klog level so e2fsck output is logged
2013-04-15 10:42:11 -07:00
Ken Sumrall
b55025bfa1 Merge "vold: set klog level so e2fsck output is logged" into jb-mr2-dev 2013-04-15 17:34:25 +00:00
Ken Sumrall
b9738ea969 vold: set klog level so e2fsck output is logged
When mounting an encrypted filesystem vold calls fs_mgr, which
will call e2fsck on the fielsystem if it's configured to, and
fs_mgr will attempt to log the output the kernel log. However,
if won't log anything unless the klog level is set to 6, aka INFO.

Change-Id: I8ac34941330262ea3414681b872fbbeb75391461
2013-04-10 02:28:55 -07:00
Ying Wang
476c893041 am 741a1699: Add liblog
* commit '741a1699b15c628e36e5c26457bd703b11f1e515':
  Add liblog
2013-04-09 22:17:32 -07:00
Ying Wang
741a1699b1 Add liblog
Bug: 8580410
Change-Id: I1a59b45c87cd901b3de52540ad7b670c42ffcbd5
2013-04-09 22:05:28 -07:00
Ken Sumrall
91ff7128dd am c5771b5a: Merge "Vold: Add the fstrim subsystem to vold" into jb-mr2-dev
* commit 'c5771b5a4d66a0c7ca0e2cb1056e670f38b3834f':
  Vold: Add the fstrim subsystem to vold
2013-03-27 14:18:38 -07:00
Ken Sumrall
c5771b5a4d Merge "Vold: Add the fstrim subsystem to vold" into jb-mr2-dev 2013-03-27 21:15:55 +00:00
Ken Sumrall
b87937cdea Vold: Add the fstrim subsystem to vold
The fstrim subsystem implements the dotrim command, which goes
through all the writable filesystems on the device, and invokes
the FITRIM ioctl() on them.  This marks all the unused blocks on
the underlying flash device as unused, so the device performs better.

Change-Id: I5fc8c2f60e0bc823f162d0f89580fb288ecb2160
2013-03-22 02:19:15 -07:00
Jean-Baptiste Queru
2d907482fd am 6bbf28da: (-s ours) am c004cfd8: am b843601a: am 77acfc4d: (-s ours) am 3c73fdaa: (-s ours) Reconcile with jb-mr1-release - do not merge
* commit '6bbf28da27dde1d3154456ab44a68ff62ee81c3c':
2013-03-11 20:51:43 +00:00
Jean-Baptiste Queru
6bbf28da27 am c004cfd8: am b843601a: am 77acfc4d: (-s ours) am 3c73fdaa: (-s ours) Reconcile with jb-mr1-release - do not merge
* commit 'c004cfd80c5b54c971b8854fa1d10ee23be1c868':
2013-03-11 13:44:17 -07:00
Jean-Baptiste Queru
c004cfd80c am b843601a: am 77acfc4d: (-s ours) am 3c73fdaa: (-s ours) Reconcile with jb-mr1-release - do not merge
* commit 'b843601a9de78a0015c8d963187efaa530e46d46':
2013-03-11 13:06:39 -07:00
Jean-Baptiste Queru
b843601a9d am 77acfc4d: (-s ours) am 3c73fdaa: (-s ours) Reconcile with jb-mr1-release - do not merge
* commit '77acfc4d6dc30f0b46ade8c6e12445065a2520eb':
2013-03-11 12:47:14 -07:00
Jean-Baptiste Queru
77acfc4d6d am 3c73fdaa: (-s ours) Reconcile with jb-mr1-release - do not merge
* commit '3c73fdaad106c2bd5e9d9349aae13f07ec40a547':
2013-03-11 12:28:04 -07:00
Jean-Baptiste Queru
3c73fdaad1 Reconcile with jb-mr1-release - do not merge 2013-03-11 12:23:40 -07:00
Kenny Root
286374f166 am bacdfc0e: Merge "Fix compiling warnings"
* commit 'bacdfc0ed9a0882ee3e9ee889a8fd4cabb9a71f3':
  Fix compiling warnings
2013-02-27 17:59:01 +00:00
Kenny Root
bacdfc0ed9 Merge "Fix compiling warnings" 2013-02-27 16:57:15 +00:00
Ken Sumrall
56ad03cae1 vold: use unified fstab format
Change vold to use the unified fstab.  This includes both
support for sdcards, and changes to the crypto code to work
with some changes to the fs_mgr library api.

Change-Id: Id5a8aa5b699afe151db6e31aa0d76105f9c95a80
2013-02-15 18:21:56 -08:00
Chih-Wei Huang
7929deb206 Fix compiling warnings
The patch removes the following warnings:

system/vold/vdc.c: In function 'do_cmd':
system/vold/vdc.c:71:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
[...]

In file included from system/vold/Fat.cpp:34:0:
bionic/libc/kernel/common/linux/fs.h:109:0: warning: "MS_RMT_MASK" redefined [enabled by default]
In file included from system/vold/Fat.cpp:31:0:
bionic/libc/include/sys/mount.h:64:0: note: this is the location of the previous definition
[...]

Change-Id: I1e950dcec87f8bae0cec61a1611126b3abc0c90e
2013-02-10 23:34:36 +08:00
Ken Sumrall
db5e026058 Enable allow_discards if dm-crypt supports it
dm-crypt version 1.11.0 and later supports the allow_discards option
when setting up a crypto device.  This passes discard requests from
the filesytem to the underlying block device.  This helps make flash
based storage faster.  So query the dm-crypt version, and pass the
option if the version is 1.11.0 or greater.

Change-Id: If30e9db5a2dbd6ea0281d91344e5b2c35e75131e
2013-02-07 15:05:54 -08:00
Rom Lemarchand
2ba45aafc2 Replace custom logwrapper implementation with liblogwrap
Use liblogwrap to provide logwrapper functionality instead of
using vold's own implementation.

Change-Id: I76aac5aa72a1fdca043a63b86c6a9b54e7abec16
2013-01-30 12:15:47 -08:00
Rom Lemarchand
5593c856f4 Fix calls to logwrap
Make sure all the calls to logwrap are consistent with the function's
semantics.

Change-Id: Ib0e2ad5c283cc4bb06c0ef5d6a9a52a5840b3dd2
2013-01-03 18:08:53 -08:00
Rom Lemarchand
b9dcde7845 Ensure vold doesn't hang when a child process dies
Add a monitoring thread that notifies the main parent thread when the child
process terminates. The return code from the child is then propagated back up
to the parent.

Change-Id: Idf46e100e8dee2e8f1aaa331317f3c4955632183
2013-01-02 13:17:49 -08:00
Rom Lemarchand
e90c1749b0 Make sure to exit with _exit from child
Exiting the child process with _exit after forking but before exec.

Change-Id: I5df34242c5444b6de6a559735074737d370a6a2e
2012-12-21 11:35:43 -08:00
Dianne Hackborn
d67870ee8c am 16a32502: am 3fd60b42: Fix issue #7503920: Log spew from vold
* commit '16a32502bf98b4b0fc15a82a36242fada29baf5b':
  Fix issue #7503920: Log spew from vold
2012-11-28 11:20:19 -08:00
Dianne Hackborn
16a32502bf am 3fd60b42: Fix issue #7503920: Log spew from vold
* commit '3fd60b428202a0f5f324fccc67c0c0402b9131ba':
  Fix issue #7503920: Log spew from vold
2012-11-28 11:18:10 -08:00
Dianne Hackborn
3fd60b4282 Fix issue #7503920: Log spew from vold
Change-Id: Ibfa5b979014f433085b94aab0d3d81bf9269d4b5
2012-11-27 16:00:04 -08:00
The Android Open Source Project
9ffb1ac318 am b1596afa: (-s ours) am b7afc4e1: Reconcile with jb-mr1-factory-release jb-mr1-release - do not merge
* commit 'b1596afa59c7108cc6ce23bab54a1bc41961806a':
2012-11-06 12:31:15 -08:00
The Android Open Source Project
b1596afa59 am b7afc4e1: Reconcile with jb-mr1-factory-release jb-mr1-release - do not merge
* commit 'b7afc4e15b29d933477328d1944c3201337808c6':
2012-11-06 12:27:10 -08:00
The Android Open Source Project
b7afc4e15b Reconcile with jb-mr1-factory-release jb-mr1-release - do not merge
Change-Id: I8de173f6b24b2f82b20e568e577878d8539e5148
2012-11-06 12:19:27 -08:00
The Android Open Source Project
cda1948e61 am 10b8e684: (-s ours) Reconcile with jb-mr1-release - do not merge
* commit '10b8e684e1945edfb60ec4391ac4c7f3d8bf4172':
2012-10-31 09:23:14 -07:00