Commit graph

2069 commits

Author SHA1 Message Date
Logan Chien
ba2861c225 [automerger skipped] Merge changes I3c14cfcf,I9d2ea66c,I9930105e am: 14540d9ceb
am: b053bc0716  -s ours

Change-Id: I137a24f649b17abfba49d7f2f1d0a464d504aca4
2018-05-07 22:49:20 -07:00
Logan Chien
b053bc0716 Merge changes I3c14cfcf,I9d2ea66c,I9930105e
am: 14540d9ceb

Change-Id: I5fb6d27b98e0308f181f5bd2be8f1af967d37e42
2018-05-07 22:43:03 -07:00
Logan Chien
14540d9ceb Merge changes I3c14cfcf,I9d2ea66c,I9930105e
* changes:
  Replace library headers with angle quotations
  Reorder the include directives in cryptfs.cpp
  Add linux/types.h to cryptfs.h
2018-05-08 05:28:08 +00:00
Logan Chien
196d5850f2 Replace library headers with angle quotations
This commit replaces the double quotations for library headers with
angle quotations.

Test: cd system/vold && mma
Change-Id: I3c14cfcf80f29173669409df548af84c1b39b96d
Merged-In: I3c14cfcf80f29173669409df548af84c1b39b96d
2018-05-02 12:18:45 +08:00
Logan Chien
862eef7ace Reorder the include directives in cryptfs.cpp
This commit reorders the include directives in cryptfs.cpp so that
upcoming <cutils/log.h> change can be obvious.

Test: lunch aosp_walleye-userdebug && cd system/vold && mma
Change-Id: I9d2ea66c15b7b68014a67ba7c1420075953459ba
Merged-In: I9d2ea66c15b7b68014a67ba7c1420075953459ba
2018-05-02 12:18:38 +08:00
Logan Chien
83a5ad2731 Add linux/types.h to cryptfs.h
This commit adds <linux/types.h> to cryptfs.h because cryptfs.h uses
`__le16` and `__le32` which are defined in <linux/types.h>.

The absence of <linux/types.h> will become an error after we sort the
headers in the upcoming commits.

Test: cd system/vold && mma
Change-Id: I9930105ee86f80a29295b59596b21335c68a8e23
Merged-In: I9930105ee86f80a29295b59596b21335c68a8e23
2018-05-02 12:18:31 +08:00
Logan Chien
188b0ab7b3 Deprecate <cutils/log.h> and <utils/Log.h>
This commit replaces <cutils/log.h> and <utils/Log.h> with <log/log.h>.

Background:
<cutils/log.h> has been moved to <log/log.h> for a while.  Both
<cutils/log.h> and <utils/Log.h> simply includes <log/log.h> for
backward compatibility.  This commit is a part of the effort to remove
<cutils/log.h> and <utils/Log.h> from the source tree eventually.

Bug: 78370064
Test: lunch aosp_walleye-userdebug && cd system/vold && mma
Change-Id: I1f9b7b132f9c35469e97556a30b521cc47e829d7
2018-05-02 12:10:19 +08:00
Logan Chien
3f2b122cd2 Replace library headers with angle quotations
This commit replaces the double quotations for library headers with
angle quotations.

Test: cd system/vold && mma
Change-Id: I3c14cfcf80f29173669409df548af84c1b39b96d
2018-05-02 12:10:16 +08:00
Logan Chien
d557d76466 Reorder the include directives in cryptfs.cpp
This commit reorders the include directives in cryptfs.cpp so that
upcoming <cutils/log.h> change can be obvious.

Test: lunch aosp_walleye-userdebug && cd system/vold && mma
Change-Id: I9d2ea66c15b7b68014a67ba7c1420075953459ba
2018-05-02 12:09:39 +08:00
Logan Chien
0267ccf8a4 Add linux/types.h to cryptfs.h
This commit adds <linux/types.h> to cryptfs.h because cryptfs.h uses
`__le16` and `__le32` which are defined in <linux/types.h>.

The absence of <linux/types.h> will become an error after we sort the
headers in the upcoming commits.

Test: cd system/vold && mma
Change-Id: I9930105ee86f80a29295b59596b21335c68a8e23
2018-05-02 10:57:56 +08:00
Jaegeuk Kim
53411c7cad Merge "vold: Idle-maint calls device GC" into pi-dev
am: 4a04cad4ec

Change-Id: I6a88f69f4eb1e9108ac0bf28a4066606000e1911
2018-04-20 17:31:08 -07:00
TreeHugger Robot
4a04cad4ec Merge "vold: Idle-maint calls device GC" into pi-dev 2018-04-20 23:42:04 +00:00
Tri Vo
8337899103 Merge "Exclude /mnt/vendor from vold's ownership." into pi-dev
am: b244714eea

Change-Id: Iefcaf167fe242f90ac715905f15dc88de0b154c8
2018-04-17 13:42:34 -07:00
TreeHugger Robot
b244714eea Merge "Exclude /mnt/vendor from vold's ownership." into pi-dev 2018-04-17 19:16:55 +00:00
Tri Vo
bca5cd78fe Exclude /mnt/vendor from vold's ownership.
Addresses this selinux denial:
avc: denied { search } for name="vendor" dev="tmpfs" ino=11069
scontext=u:r:vold:s0 tcontext=u:object_r:mnt_vendor_file:s0 tclass=dir
permissive=0

Bug: 64905218
Test: fixes above denial.
Change-Id: I670b2148e65c7e0fcabd1e11f5bace0c4f4e18bd
2018-04-16 14:33:53 -07:00
Jaegeuk Kim
eefc5eebc3 vold: Idle-maint calls device GC
This activates device GCs in idle time.

F2FS GC = 7 mins
Trim = 1 mins
Dev GC = 2 mins

Bug: 63264275
Bug: 68721792
Change-Id: I843a742ef192ebe00d77c47a216d4200bc9ccb9d
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2018-04-16 09:54:41 -07:00
Jaegeuk Kim
4e3a51ff18 vold: set f2fs feature bit
am: 7db02ab5d1

Change-Id: I7c3bc9a276bb0cb1221465589a26b689600069b2
2018-04-10 21:08:04 -07:00
Jaegeuk Kim
7db02ab5d1 vold: set f2fs feature bit
Bug: 74604441
Bug: 67380979
Change-Id: Ifcb43fb4f8fbdf79e70cfa208af73073d815e254
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2018-04-06 11:54:31 -07:00
Daniel Rosenberg
eea3792845 Merge "Remove waitpid on UnMount" am: f6dbba8846
am: 1584dc0d1d

Change-Id: I6c2562f6fc075e8be7db2986e461f2c2dd092650
2018-04-03 13:49:04 -07:00
Daniel Rosenberg
1584dc0d1d Merge "Remove waitpid on UnMount"
am: f6dbba8846

Change-Id: I4e96e702bc9b2251cc2801a037177a2f7a154c75
2018-04-03 13:37:19 -07:00
Treehugger Robot
f6dbba8846 Merge "Remove waitpid on UnMount" 2018-04-03 20:23:59 +00:00
Shawn Willden
27e7cc4e79 Disable use of StrongBox for encryption
am: c1903ad3d6

Change-Id: Id3f2e2e0f695ebd8eaa1c3883f636a4773b96859
2018-04-02 20:50:49 +00:00
Shawn Willden
c1903ad3d6 Disable use of StrongBox for encryption
Until VerificationTokens are wired up, StrongBox can't work.  Also,
this will reduce complications for early StrongBox testing.

Bug: 77338527
Test: Boot the device
Change-Id: I44a1577c388703aeecb2886e7db52084c17e2afd
2018-03-30 18:01:35 -07:00
Paul Crowley
7d1e0f305f Gate use of allow_encrypt_override behind ro.crypto property
am: 385cb8c4d6

Change-Id: I91f057b853902b63028897640ba6bb8e3d13e223
2018-03-29 23:23:58 +00:00
Paul Crowley
385cb8c4d6 Gate use of allow_encrypt_override behind ro.crypto property
Test: use adb set-virtual-disk to create a virtual partition
Bug: 25861755
Change-Id: I6a227a083c82321c8d4d2d9188091a6f7f0451f0
2018-03-29 13:39:21 -07:00
Daniel Rosenberg
8b9a5b344e Remove waitpid on UnMount
Since we no longer have the Fuse Daemon, we won't ever
need to stop the daemon when unmounting.

Bug: 33808187
Test: Run "adb shell ps | grep -w Z"
          The sdcard daemon should not be listed.
Change-Id: I6bb9341785b711d81553393f7c3b56115c435236
2018-03-13 02:58:03 +00:00
Rubin Xu
ea0514ee95 Remove secdiscard IPC call
am: eb850f93ab

Change-Id: If4f758f34519cd7bf328a431dc9b14af5e475eed
2018-03-06 23:07:19 +00:00
Rubin Xu
eb850f93ab Remove secdiscard IPC call
No longer used by the framework, hence removing.

Bug: 62140539
Test: builds
Change-Id: I17b9818ea6121d84223a502949186cf679a83a90
2018-03-05 13:55:23 +00:00
Risan
de787a847a Remove libarcmounter dependency in Vold
Due to rerouting ArcBridge call through System Server, Vold doesn't need
to depend on ArcBridge-related C++ library anymore.

Bug: 64500663
Test: Compiled.
Change-Id: Ic93cbc8cec8496784960d5093fb7b12d43574ced
2018-03-01 11:19:51 +09:00
TreeHugger Robot
e283f998c6 Merge "Use unique_ptr<DIR> to safely release resources." 2018-02-25 02:45:33 +00:00
Jeff Sharkey
e50314d52b Trim whitespace from sysfs values.
Test: builds, boots
Bug: 72740079
Change-Id: If364927ea762c7dee99bff5dc307e3b9b5355c2b
2018-02-24 18:23:37 -07:00
Jeff Sharkey
5540b4406c Use unique_ptr<DIR> to safely release resources.
Test: builds, boots
Bug: 66995913
Change-Id: Ib580501fc979b63295b180250581dc7527de76b2
2018-02-24 18:09:22 -07:00
TreeHugger Robot
8c26c46059 Merge "Add ArcService AIDL in Vold" 2018-02-23 20:52:22 +00:00
Risan
ea2d2bb46c Add ArcService AIDL in Vold
This is needed to allow ARC++ Vold to interact with ArcBridgeService
through SystemServer.

Bug: 64500663
Test: Compiled, tested on device + cts in master-arc-dev (ag/3488659)
Change-Id: I3b05b0f456ec99be9163877a2d83cdbf2bb94991
2018-02-23 18:23:35 +00:00
Jaegeuk Kim
af705674fd Merge "vold: Idle-maint issues discards fully" 2018-02-23 03:39:10 +00:00
Jaegeuk Kim
a6aae2f5a5 vold: Idle-maint issues discards fully
Change-Id: Ib20a55e8761aa740b530803f029ecb36256fe9aa
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2018-02-22 19:06:24 -08:00
Greg Kaiser
38723f23ff cryptfs: Optionally get crypto type as a property
Instead of hardcoding to "aes-cbc-essiv:sha256" with a 16 byte
key, we introduce a new property, "ro.crypto.fde_algorithm",
to allow the use of different crypto types.  The only other
method we currently support is "speck128-xts-plain64" with
a 32 byte key, although new crypto types are easily added.

We intentionally derive things like the crypto name and the
keysize from the given property name.  This means the code
must be changed for each new crypto type we want to support,
but that's worth it to remove the exploit vector of crypto
types with incorrect key sizes.

Due to previous refactoring CLs, this has minimal impact on
the current code other than changing what we return for
cryptfs_get_{keysize,crypto_name}.

Bug: 73079191
Test: Flashed onto a gobo device with the property set for SPECK, and confirmed via kernel debug output we were using SPECK on the device.
Change-Id: I9c9df61590344c5f62114dfbf679031b0c2ceb1f
2018-02-16 15:24:20 -08:00
Greg Kaiser
57f9af6af4 cryptfs: Require ext disk crypt to match code
Our external partitions have no crypto header/footer, so we
only get the keysize and key.  Our code has been implicitly
assuming that this keysize off of disk matches the crypto
type we have in our code (and thus matches the keysize our
code is using as well).  We now make this assumption
explicit, and check for this and no longer allow external
code to pass a keysize in to cryptfs.

Bug: 73079191
Test: Compiled and tested in combination with other CLs.
Change-Id: I1a1996187e1aaad6f103982652b1bcdfd5be33ce
2018-02-16 15:23:56 -08:00
Greg Kaiser
59ad018d0b cryptfs: Use the crypt_mnt_ftr keysize
Our code has places where we were reading in the crypt_mnt_ftr
struct from disk, but then proceeding to use a hardcoded constant
for the keysize.  We plan to allow crypto with different sized
keys in the future, so we want to just trust the keysize we get
off of disk.

While doing this, we reject any crypt_mnt_ftr we read from disk
which has a keysize in excess of MAX_KEY_LEN.  This defends us
against buffer overflows in the case of corrupt disk data.

Bug: 73079191
Test: Compiled and tested in combination with other CLs.
Change-Id: Id6f192b905960e5508833e9cd3b4668d4754dc7e
2018-02-16 15:22:43 -08:00
Gao Xiang
17510259cc Merge "mFusePid should be cleared after waitpid successfully" am: 456483d193 am: 8be3be3167
am: 8fe7f3104b

Change-Id: I18199ce5f972f0a403728e34dec608a01fceb183
2018-02-16 01:42:39 +00:00
Gao Xiang
8fe7f3104b Merge "mFusePid should be cleared after waitpid successfully" am: 456483d193
am: 8be3be3167

Change-Id: Ib55467c9719d5c578a51b0fc49b03dbc9bbe0870
2018-02-16 01:24:40 +00:00
Gao Xiang
8be3be3167 Merge "mFusePid should be cleared after waitpid successfully"
am: 456483d193

Change-Id: I61bf49cea396ebc8009a54740d7322249025acf0
2018-02-16 01:04:45 +00:00
Treehugger Robot
456483d193 Merge "mFusePid should be cleared after waitpid successfully" 2018-02-15 23:46:14 +00:00
Greg Kaiser
00eda38635 cryptfs: Don't use bare integers for key size
Rather than use an integer and have a comment, we use a named
constant for sizing these master key buffers.  This will help
avoid confusion when we switch to allowing different sized
master keys.

Bug: 73079191
Test: Build
Change-Id: Ifaffdd94d337bb2d5a178f818dfe00f9386ae03b
2018-02-15 12:28:51 -08:00
Greg Kaiser
c0de9c7dba cryptfs: Clarify sizing of intermediate key
Some parts of the code were intermingling constants for the master
key and the intermediate key.  That works at the moment because
these are the same size.  But we'll be introducing logic allowing
different sized master keys, while keeping the intermediate the
same.  To aid that introduction, we use separate constants for
the intermediate key.

Bug: 73079191
Test: Build
Change-Id: I22b1dbf18aff2f76229df1c898fc606d6c1af3ca
2018-02-15 12:27:23 -08:00
Greg Kaiser
b802078adc Revert "cryptfs: Don't hardcode ikey buffer size"
This reverts commit f45a70c416.
2018-02-14 11:26:12 -08:00
Greg Kaiser
2c92d7b6a1 Revert "cryptfs: Make decrypted key buffers large enough"
This reverts commit 4a35ef0a53.
2018-02-14 11:26:08 -08:00
Greg Kaiser
fa099611bf Revert "cryptfs: Optionally get crypt type from properties"
This reverts commit 291fec1789.
2018-02-14 11:26:00 -08:00
Greg Kaiser
291fec1789 cryptfs: Optionally get crypt type from properties
Instead of hardcoding to "aes-cbc-essiv:sha256", we introduce a
new property, "ro.crypto.crypt_type_name", to allow the use of
different crypt methods.  The only other method we currently
support is "speck128-xts-plain64", although new methods are
easily added.

We intentionally derive things like the keysize from the given
crypt name, to reduce exploit vectors.  We also only accept
crypt names the code has whitelisted.

The biggest impact is replacing the hard-coded KEY_LEN_BYTES.
For compile-time buffers, we use the MAX_KEY_LEN to assure they
will be big enough for any crypt type.  For run-time sizing,
we use the value derived from our property.

Bug: 73079191
Test: On an encrypted gobo, booted successfully with (1) no property set, (2) proproperty set to invalid value (and confirmed we defaulted to aes), and (3) after wiping userdata, with property set to "speck128-xts-plain64", confirmed we were using SPECK.
Change-Id: Ic4e10840d6ee2a4d4df58582448e0f768e6f403f
2018-02-12 09:07:16 -08:00
Greg Kaiser
4a35ef0a53 cryptfs: Make decrypted key buffers large enough
Looking at the EVP_DecryptUpdate() documentation, we need a
buffer which isn't just the keysize, but also provides the
cipher block length minus one byte extra.  For EVP_aes_128_cbc(),
that block length is 16, but we use the maximum block length to
be safe for any future cipher change.

For two of our decrypted_master_key usages, the buffer was
already sufficiently sized.  But for one of our instances,
in cryptfs_enable_internal(), the buffer was previously
smaller than this.  So this CL represents a possible behavior
change if we were ever overrunning that buffer.

Bug: 73079191, 73176599
Test: Flashed an encrypted sailfish and it booted.

Change-Id: Ic5043340910dc7d625e6e5baedbca5bd4b2bfb03
2018-02-09 17:21:33 -08:00