Commit graph

1726 commits

Author SHA1 Message Date
Guang Zhu
ea43a7e4ea Merge "Revert "Enable metadata encryption"" 2017-04-29 00:01:34 +00:00
Guang Zhu
5b6c6a2c4a Revert "Enable metadata encryption"
Bug: 37792477

This reverts commit 3963b23645.

Change-Id: I3b6bf5a9a4c3899aabe2c824d8498a06981daed8
2017-04-28 23:58:39 +00:00
Daniel Rosenberg
c6bf7c7544 Revert "Revert "Stop dropping caches now we have kernel fix""
This reverts commit 8ad0bef7b5.

Bug: 37231161
Test: Boot device with FBE enabled. ls /storage/emulated/0/Android
Unlock device. ls /storage/emulated/0/Android
1st will not be found. Second should be found.

Change-Id: I92c7ad0adaa7bd357e10661a47cc667ac0ff84b4
Merged-In: I92c7ad0adaa7bd357e10661a47cc667ac0ff84b4
2017-04-28 23:56:00 +00:00
Daniel Rosenberg
71c56f6dd5 Revert "Revert "Stop dropping caches now we have kernel fix""
This reverts commit 8ad0bef7b5.

Bug: 37231161
Test: Boot device with FBE enabled. ls /storage/emulated/0/Android
Unlock device. ls /storage/emulated/0/Android
1st will not be found. Second should be found.

Change-Id: I92c7ad0adaa7bd357e10661a47cc667ac0ff84b4
2017-04-28 16:04:11 -07:00
Nick Desaulniers
f622c43e3a Merge "Enable metadata encryption" 2017-04-28 21:29:29 +00:00
Paul Lawrence
3963b23645 Enable metadata encryption
Bug: 26778031
Test: Boots, reboots, sector 0 of userdata encrypted
      Make sure an FDE device, both default and password protected,
      boots.
      Make sure an FBE device without metadata encryption boots.
Change-Id: Ic44a32ce7e9b978e9c9e2dc112b26206741c838d
2017-04-28 16:44:23 +00:00
Yong Yao
01c4815ecf Fix keyname generation issue am: 392c4dbdc1
am: b8bb4463e0  -s ours

Change-Id: I20283d6cc9576af54b0bfc9e2adaf0e1bfabcee7
2017-04-26 21:36:03 +00:00
Yong Yao
b8bb4463e0 Fix keyname generation issue
am: 392c4dbdc1

Change-Id: Iea048673c82dea1d5d9a13a10e1f70376955ca4b
2017-04-26 21:05:18 +00:00
Paul Crowley
d5759811ff Add support for metadata encryption
Support encrypting metadata in /userdata using the dm-default-key
driver with a key in the /metadata partition.

Bug: 29189559
Test: Angler & Marlin build and boot
Change-Id: I716b117508d4bb4f6a4039293acb848cbc60f67b
2017-04-21 13:40:20 -07:00
Yong Yao
392c4dbdc1 Fix keyname generation issue
The keyname binded to keyring return a wrong string when there are binary char larger than 127,
the sign extension will introduce unexpect FFFFFF string to the keyname.

Bug: 36975893
Test: local build

Change-Id: Iba2f6ef95aeacd08c8d6c72b71e7b92e956ec3fc
Signed-off-by: Ai, Ting A <ting.a.ai@intel.com>
2017-04-21 11:33:36 -07:00
Paul Crowley
f71ace310e Refactor to lay the groundwork for metadata encryption
Bug: 26778031
Test: Angler, Marlin build and boot
Change-Id: Ic136dfe6195a650f7db76d3489f36da6a1929dc5
2017-04-21 10:47:17 -07:00
Daniel Rosenberg
5e32f9c8fc Revert "Stop dropping caches now we have kernel fix" am: 8ad0bef7b5
am: e531126b40

Change-Id: I797d2c4615a94aca88640da11342f4053b15bb11
2017-04-20 22:42:17 +00:00
Daniel Rosenberg
e531126b40 Revert "Stop dropping caches now we have kernel fix"
am: 8ad0bef7b5

Change-Id: I318b956c38175abada5a2423b8d920b299883030
2017-04-20 22:39:16 +00:00
Daniel Rosenberg
8ad0bef7b5 Revert "Stop dropping caches now we have kernel fix"
This reverts commit 6abe6831b5.

Bringing this back temporarily for the same issue on sdcardfs.
Will remove once the kernel issue is resolved.

Change-Id: Ia29ea4fddb7777012a2eea9259f9ac856773fe01
Bug: 37231161
Test: Boot device with FBE enabled. ls /storage/emulated/0/Android
Unlock device. ls /storage/emulated/0/Android
1st will not be found. Second should be found.
2017-04-20 12:38:26 -07:00
cjbao
eb50114a83 BuildDataUserCePath always use dir instead of symbolic link
Select whichever is real dir instead of symbolic link from either /data/data
or /data/user/0. This is to minimize path walking overhead in kernel.

This works together with Change 369787

Test: Manual test
Change-Id: I338518673fc22ccbfed6ddd6be196931fce18525
Signed-off-by: cjbao <cathy.bao@intel.com>
2017-04-18 19:57:54 +08:00
Eric Biggers
cb34b78e55 vold: unlink ext4 encryption keys rather than revoking them am: fa4039b162
am: 9f71aa0ebc

Change-Id: Ie6688e99e6cf4bbc8f524ea4fdfbc389002cbde5
2017-04-05 00:33:50 +00:00
Eric Biggers
9f71aa0ebc vold: unlink ext4 encryption keys rather than revoking them
am: fa4039b162

Change-Id: I118ef8b85620f721370e5d26be2d3ef3c2679a8d
2017-04-05 00:31:49 +00:00
Seigo Nonaka
b5aad7f033 Merge "Prepare necessary data directory before loading persistent properties." am: 399bd0866c am: e1f216cc4d am: cbe1f6b1e4
am: faec65d7c3

Change-Id: Ie8e0bcc05bdf83351b3bfb73309c1b00eb511e30
2017-04-05 00:02:05 +00:00
Seigo Nonaka
faec65d7c3 Merge "Prepare necessary data directory before loading persistent properties." am: 399bd0866c am: e1f216cc4d
am: cbe1f6b1e4

Change-Id: I864e4151a0b7e1551892d9199883e8783941f7a8
2017-04-05 00:00:05 +00:00
Seigo Nonaka
cbe1f6b1e4 Merge "Prepare necessary data directory before loading persistent properties." am: 399bd0866c
am: e1f216cc4d

Change-Id: I69153c12ca16fcb8381972c70ac7e3e25c050d42
2017-04-04 23:52:12 +00:00
Seigo Nonaka
e1f216cc4d Merge "Prepare necessary data directory before loading persistent properties."
am: 399bd0866c

Change-Id: I4a675722c79bc74bcfc106365a1f056c9b338cc4
2017-04-04 23:46:15 +00:00
Treehugger Robot
399bd0866c Merge "Prepare necessary data directory before loading persistent properties." 2017-04-04 23:34:24 +00:00
Eric Biggers
fa4039b162 vold: unlink ext4 encryption keys rather than revoking them
Unlinking keys rather than revoking them avoids bugs in certain kernel
versions without having to hack around the problem with an arbitrary 20
second delay, which is not guaranteed to be sufficient and has caused
full device hangs like in b/35988361.

Furthermore, in the context of filesystem encryption, unlinking is not
currently supposed to be any less secure than revoking.  There was a
case where revoking (but not unlinking) keys will cause the filesystem
to deny access to files that were previously opened with that key.
However, this was a means of _access control_, which encryption is not
intended to be used for.  Instead, file permissions and/or SELinux
should be used to enforce access control, while filesystem encryption
should be used to protect data at rest independently from access
control.  This misfeature has also been removed upstream (and backported
to 4.4-stable and 4.9-stable) because it caused CVE-2017-7374.

Eventually we'd really like to make the kernel support proper revocation
of filesystem encryption keys, i.e. fully clearing all key material and
plaintext and safely waiting for any affected filesystem operations or
writeback to complete.  But for now this functionality does not exist.
('sync && echo 3 > /proc/sys/vm/drop_caches' can be useful, but it's not
good enough.)

Bug: 35988361
Change-Id: Ib44effe5368cdce380ae129dc4e6c6fde6cb2719
(cherry picked from commit fd7ba5e4c6)
2017-04-04 22:25:24 +00:00
Eric Biggers
fb0fad54ab Merge "vold: unlink ext4 encryption keys rather than revoking them" 2017-04-04 22:16:50 +00:00
Seigo Nonaka
cb46b9b0c8 Prepare necessary data directory before loading persistent properties.
init reads files in /data/property/ but it is not ready to read when
trigger_load_persist_props is triggered by vold.decrypt.

Bug: 29332975
Change-Id: I14beac8714ff2f722d8b11f666bc7ca693ccd46e
(cherry picked from commit e2ef0c0da4)
2017-04-04 15:01:28 -07:00
Jeff Sharkey
246779028f Merge "Abort migration early when not enough space." into oc-dev am: e6c142174c
am: a4c0a3b2ca

Change-Id: Ie50f0ae2dbf7eb1b868606b75d1ade808d34590b
2017-04-04 02:05:21 +00:00
Jeff Sharkey
a4c0a3b2ca Merge "Abort migration early when not enough space." into oc-dev
am: e6c142174c

Change-Id: I193b962b1288be22fb343c802ac3d2b464748f17
2017-04-04 01:58:25 +00:00
TreeHugger Robot
e6c142174c Merge "Abort migration early when not enough space." into oc-dev 2017-04-04 01:45:42 +00:00
Jeff Sharkey
a0220a5bd4 Abort migration early when not enough space.
Otherwise we potentially waste minutes of the users time copying
data that will never fit.

Also fix bug around storage calculation.  It's confusing, but f_bsize
is not the value you're looking for; the real block size is f_frsize.

Test: builds, boots
Bug: 27590986, 36840579
Change-Id: I77c63e259356824cc75a3adcf3f4af567efdc7aa
2017-04-03 17:13:06 -06:00
Eric Biggers
fd7ba5e4c6 vold: unlink ext4 encryption keys rather than revoking them
Unlinking keys rather than revoking them avoids bugs in certain kernel
versions without having to hack around the problem with an arbitrary 20
second delay, which is not guaranteed to be sufficient and has caused
full device hangs like in b/35988361.

Furthermore, in the context of filesystem encryption, unlinking is not
currently supposed to be any less secure than revoking.  There was a
case where revoking (but not unlinking) keys will cause the filesystem
to deny access to files that were previously opened with that key.
However, this was a means of _access control_, which encryption is not
intended to be used for.  Instead, file permissions and/or SELinux
should be used to enforce access control, while filesystem encryption
should be used to protect data at rest independently from access
control.  This misfeature has also been removed upstream (and backported
to 4.4-stable and 4.9-stable) because it caused CVE-2017-7374.

Eventually we'd really like to make the kernel support proper revocation
of filesystem encryption keys, i.e. fully clearing all key material and
plaintext and safely waiting for any affected filesystem operations or
writeback to complete.  But for now this functionality does not exist.
('sync && echo 3 > /proc/sys/vm/drop_caches' can be useful, but it's not
good enough.)

Change-Id: Ib44effe5368cdce380ae129dc4e6c6fde6cb2719
2017-04-03 15:48:09 -07:00
Tom Cherry
c1a6797905 vdc: use libbase logging and log directly to kmsg on boot am: c61581e7d2
am: bd7e8c55af

Change-Id: If48f19f21c29bac7de7a639e812a5729d9e3de5e
2017-04-03 22:12:49 +00:00
Tom Cherry
bd7e8c55af vdc: use libbase logging and log directly to kmsg on boot
am: c61581e7d2

Change-Id: I1a77a6f8f3c3325abf4d74d0feef1a6187c3f6b6
2017-04-03 22:06:06 +00:00
Tom Cherry
c61581e7d2 vdc: use libbase logging and log directly to kmsg on boot
Init is no longer calling vdc with logwrapper, so it must take care of
logging to kmsg directly.

Bug: 36278706
Test: observe logging in kmsg on boot and stderr on normal usage

(cherry picked from commit f71511ac41)

Change-Id: Ieb643918f11bdde4f99ec7f3ec083efbb326e809
2017-03-31 20:48:58 +00:00
Tom Cherry
8633c324ce Merge "vdc: use libbase logging and log directly to kmsg on boot" am: 4f6c1ee19f am: e3a8a60024 am: 83f1551ecb
am: ce4af048ce

Change-Id: I641bd2510023bd256276250766f8642bdfe4f7db
2017-03-31 16:55:22 +00:00
Tom Cherry
ce4af048ce Merge "vdc: use libbase logging and log directly to kmsg on boot" am: 4f6c1ee19f am: e3a8a60024
am: 83f1551ecb

Change-Id: Ib6c575bbfd010e71cac509bee343a7be563e730a
2017-03-31 16:47:44 +00:00
Tom Cherry
83f1551ecb Merge "vdc: use libbase logging and log directly to kmsg on boot" am: 4f6c1ee19f
am: e3a8a60024

Change-Id: Ifae6798ca5d352c05cd78dce59087bf3a29eede8
2017-03-31 16:45:11 +00:00
Tom Cherry
e3a8a60024 Merge "vdc: use libbase logging and log directly to kmsg on boot"
am: 4f6c1ee19f

Change-Id: Ib5c11abb027f5c91f448e0322a11ed93c4ce29e2
2017-03-31 16:43:12 +00:00
Tom Cherry
4f6c1ee19f Merge "vdc: use libbase logging and log directly to kmsg on boot" 2017-03-31 16:41:02 +00:00
Tom Cherry
f71511ac41 vdc: use libbase logging and log directly to kmsg on boot
Init is no longer calling vdc with logwrapper, so it must take care of
logging to kmsg directly.

Test: observe logging in kmsg on boot and stderr on normal usage
Change-Id: Ie3e59da433bd154f121ce103dea0c59eb0bab069
2017-03-29 17:06:31 -07:00
Jeff Sharkey
32ebb739cb Enable clang-tidy for security sensitive domain.
Start with clang-analyzer-security* and cert-*, but disable two
specific errors:

-- cert-err34-c, which checks for atoi(); heavily triggered by
CommandListener, but will disappear when we move to Binder.
-- cert-err58-cpp, which checks for exceptions before main(); it's
a "Low" severity issue, and filed 36656327 to track cleanup.

Fix all other triggered errors along the way.

Test: builds, boots
Bug: 36655947
Change-Id: I1391693fb521ed39700e25ab6b16bc741293bb79
2017-03-27 17:14:52 -06:00
Jeff Sharkey
fd3dc3c076 Spread around some O_CLOEXEC love.
Also remove some unnecessary SELinux logic when creating image files
for loop devices.

Test: builds, boots, common operations work
Bug: 34903607
Change-Id: I68dfa022ecc39f56c175e786694e0de35b954ca0
2017-03-27 11:13:36 -06:00
Jeff Sharkey
9f912b8cc4 Merge "Add a new "virtual disk" feature." 2017-03-27 15:22:47 +00:00
Jeff Sharkey
fa1c677c1a Add a new "virtual disk" feature.
It's extremely difficult to test storage related logic on devices
that don't have physical SD card slots.  So to support better
debugging and testing, add a new "virtual disk" feature which mounts
a 512MB file through loop device.

It relies on the kernel having the "loop.max_part" value set to
something other than 0 via the boot command line, since that allows
all the existing partition logic to fall into place.

Bug: 34903607
Test: builds, boots, virtual disk works
Change-Id: I04c5b33e37319d867542985a56b7999a9b7cf35d
2017-03-25 23:25:14 -06:00
Shawn Willden
12e72ad921 Add digest support and implementation name to getHardwareFeatures.
Test: Manual
Change-Id: I910dea4fab671436fe5eb2ab35a6ffaa86179b35
2017-03-23 11:26:35 -06:00
Keun-young Park
3918ae6c76 Merge "make shutdown safe for double calls." am: 71fa1068de am: 2f93c657f4
am: 2a8605b9d1

Change-Id: Id1cd83d307e7791359bc6dfd96368f1138ff21d2
2017-03-15 02:56:40 +00:00
Keun-young Park
2a8605b9d1 Merge "make shutdown safe for double calls." am: 71fa1068de
am: 2f93c657f4

Change-Id: I78962b7272ef0c39a133db042f36684fc1324018
2017-03-15 02:52:10 +00:00
Keun-young Park
2f93c657f4 Merge "make shutdown safe for double calls."
am: 71fa1068de

Change-Id: I161c96dc5a44890fffe8fcdf9e0f8fc874df29c0
2017-03-15 02:47:09 +00:00
Treehugger Robot
71fa1068de Merge "make shutdown safe for double calls." 2017-03-15 02:39:51 +00:00
Keun-young Park
a5bbb5e3c1 make shutdown safe for double calls.
- In new shutdown sequence, volume shutdown is requested in two places:
  system_server and init.
- Make VolumeManager.shutdown safe for double calls.
  It crashed before this change.

bug: 36004738
Test: reboot and check last_kmsg for crash / vdc timeout
Change-Id: I296913959b2647b65d66553073f2032545beba57
2017-03-14 17:27:02 -07:00
Bowgo Tsai
3b0a884381 Merge "vold: replacing fs_mgr_read_fstab() with fs_mgr_read_fstab_default()" am: 92f21f5294 am: f53cc1b04a
am: b169603d95

Change-Id: Ic3ac2ccb853b43d9051d3703f19590cf97b3e689
2017-03-10 03:17:52 +00:00