Commit graph

1907 commits

Author SHA1 Message Date
TreeHugger Robot
3cb5cbff5a Merge "Add functions to handle idle maintenance" 2017-11-15 18:47:21 +00:00
Xin Li
1dd13cd558 Merge remote-tracking branch 'goog/stage-aosp-master' into HEAD
am: c6d4d2a22d

Change-Id: I65288cb11d5b2a56bcf3e388f1bb4de6d3ee74dd
2017-11-15 01:19:24 +00:00
Xin Li
c6d4d2a22d Merge remote-tracking branch 'goog/stage-aosp-master' into HEAD
Change-Id: Id798fe06c18348b17befbca944afa25f7c514a80
2017-11-14 16:38:31 -08:00
Jin Qian
a370c14f75 Add functions to handle idle maintenance
runIdleMaint is equivalent with:

1. echo 1 > /sys/fs/f2fs/sdX/gc_urgent
2. wait until /sys/fs/f2fs/sdX/dirty_segments
     <= threshold or timeout
3. echo 0 > /sys/fs/f2fs/sdX/gc_urgent
4. fstrim

abortIdleMaint forces the wait loop above to exit and
skips fstrim. However, if fstrim is already running,
abortIdleMaint will just leave it run to completion.

Test: adb shell sm idle-maint [run|abort]
Bug: 67776637
Change-Id: I4adff8d9b6bbd63bce41368cea55dc9e9b117eb6
2017-11-14 15:12:30 -08:00
Xin Li
bf168f7dad Merge commit 'e2d1d99f1a98b02a28fe71f2a387a72b69d4b4a6' from
oc-mr1-dev-plus-aosp into stage-aosp-master

Change-Id: I4bdada4c933109f1cc60c61946fa30e174ca7583
2017-11-14 12:20:56 -08:00
Jaegeuk Kim
119a98ac1b Merge "cryptfs: support make_f2fs with quota" am: 7807866abe am: 4d1c7765c8
am: 5968445892

Change-Id: Id898a24124eeafdcc1abdaafc4864d795f6fd340
2017-11-14 03:33:35 +00:00
Jaegeuk Kim
ab693f201e Merge "cryptfs: call format_f2fs correctly with proper flags" am: b9a1169eca am: af285d98b8
am: e15780494f

Change-Id: I5e08076759e8ba4d35c76d9da19e6607e5515958
2017-11-14 03:33:16 +00:00
Jaegeuk Kim
5968445892 Merge "cryptfs: support make_f2fs with quota" am: 7807866abe
am: 4d1c7765c8

Change-Id: Ica0836d567049774eeaf41d7f75d5cd83045edfe
2017-11-14 03:03:10 +00:00
Jaegeuk Kim
e15780494f Merge "cryptfs: call format_f2fs correctly with proper flags" am: b9a1169eca
am: af285d98b8

Change-Id: Ia40ec01d0685769d3af5cfeeb6a76673a07dd003
2017-11-14 03:02:43 +00:00
Jaegeuk Kim
4d1c7765c8 Merge "cryptfs: support make_f2fs with quota"
am: 7807866abe

Change-Id: I9b52d87df0a6ddc3c29b4bd5d302e300747ad4c1
2017-11-14 01:10:34 +00:00
Jaegeuk Kim
af285d98b8 Merge "cryptfs: call format_f2fs correctly with proper flags"
am: b9a1169eca

Change-Id: I7ad4229ee514d80fc3280d8f468844a3b5eb9137
2017-11-14 01:10:17 +00:00
Treehugger Robot
7807866abe Merge "cryptfs: support make_f2fs with quota" 2017-11-14 01:06:37 +00:00
Jaegeuk Kim
b9a1169eca Merge "cryptfs: call format_f2fs correctly with proper flags" 2017-11-14 01:06:27 +00:00
Jaegeuk Kim
8de9f065a4 cryptfs: support make_f2fs with quota
Change-Id: I699b457ca0282c02e0d0a399c146d4e54a403bf4
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2017-11-13 13:54:16 -08:00
Jaegeuk Kim
98651a235b cryptfs: call format_f2fs correctly with proper flags
Change-Id: Ia493e6f758ff5dd5dd41479193ab237d4306d464
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2017-11-13 13:16:45 -08:00
Wei Wang
a087947490 Vold: Add fsync in writeStringToFile() am: 701d05d32c
am: ee8170f2ac

Change-Id: I2ce9e9a6ea1969e1bf41ef6886dc4d27ee19f58a
2017-11-08 21:38:42 +00:00
Wei Wang
ee8170f2ac Vold: Add fsync in writeStringToFile()
am: 701d05d32c

Change-Id: I24ab82c29abd56e35d1016b2b3aa0e199528efb3
2017-11-08 21:35:56 +00:00
Wei Wang
701d05d32c Vold: Add fsync in writeStringToFile()
Test: Build, test with ag/3180275
Bug: 68901441
Change-Id: Ieca9e5227025e00184a67508d5e8fbbddd12f21e
2017-11-08 19:01:33 +00:00
Jeff Sharkey
cbcb2926b2 Abort long-running benchmarks, report progress.
A typical storage device finishes the benchmark in under 10 seconds,
but some extremely slow devices can take minutes, resulting in a
confusing UX that looks like we've frozen.  Even worse, we keep
churning through all that I/O even though we know the device will
blow past our user-warning threshold.

So periodically check if we've timed out, and also use that to report
progress up into the Settings UI.

Test: manual
Bug: 62201209, 65639764, 67055204
Change-Id: I321397bcff230976f034cede0947d4a5a1f3e8a7
2017-11-07 09:57:12 -07:00
Paul Crowley
b64933a502 Be even more C++. Switch on a warning.
Remove lots of "extern C" and "ifdef __cplusplus" which are no longer
needed now all of vold is C++. Also turn on the cert-err58-cpp warning
we once had to disable.

Bug: 67041047
Test: compiles, boots
Change-Id: I8c6f9dd486f2409e0deed7bb648d959677465b21
2017-10-31 08:40:23 -07:00
Jeff Sharkey
2048a2865c Test that plaintext can't be read from disk for encrypted files.
Bug: 36029169
Test: tested by hand on Taimen
Change-Id: I5717a8630bb2c8d8fe5c343d519c4e59862ecbdf
2017-10-27 15:14:56 -07:00
Paul Crowley
2d64b91823 Improve VDC's logging on failure.
Also refactor.
Bug: 36029169
Test: ensure that a command fails, check logs for failure.

Change-Id: I1dece2982f762f4522e17d45b5f04af104b95861
2017-10-27 13:37:24 -07:00
Paul Crowley
26a53888a4 When we forget a volume, forget per-volume key
Protect all per-volume-per-user keys with a per-volume key, which is
forgotten when the volume is forgotten. This means that the user's key
is securely lost even when their storage is encrypted at forgetting
time.

Bug: 25861755
Test: create a volume, forget it, check logs and filesystem.
Change-Id: I8df77bc91bbfa2258e082ddd54d6160dbf39b378
2017-10-26 12:19:09 -07:00
Paul Crowley
c6433a299d Forget keys when we forget the volume.
Bug: 25861755
Test: create a volume, forget it, check logs and filesystem.
Change-Id: I0ab662969c51703cb046d57b72330e0f14447ef3
2017-10-26 12:19:03 -07:00
Paul Crowley
ff19b05e8e Fix errors on non-keymaster keys
If it's not a keymaster key, don't try to invalidate or delete the key
blob.

Bug: 25861755
Test: Create and forget a volume, check logs and files.
Change-Id: If8bfb1a9ab41e6c7e46bc311eb296242e56d264f
2017-10-26 11:38:14 -07:00
TreeHugger Robot
6d9afa8d49 Merge "Create subdirectories in misc_ce/misc_de for storaged" 2017-10-25 20:34:49 +00:00
Jin Qian
f39614449d Create subdirectories in misc_ce/misc_de for storaged
Test: Boot device, check directories created
Bug: 63740245
Change-Id: Ie3f593e2cceb99ea7e86614d6b0d7b34f8c7034c
2017-10-24 17:26:44 -07:00
Paul Crowley
3aa914d4a9 Give SD cards their own keys and modes.
When we set up encryption on real volumes - not just /data - we should
give them their own keys, so that these keys can be deleted when the
volume is forgotten. Also, we must choose the encryption modes
differently, since ICE encryption which works on /data may not work on
such volumes.

Bug: 25861755
Test: boot device, add SD card, check modes.
Change-Id: I354cd651757c3566dba046ae99d324833ad9b0e5
2017-10-24 15:27:04 -07:00
Paul Crowley
82b41ff837 Convert vold_prepare_subdirs to C++
Minimize overhead in boot by replacing shell script invoked multiple
times with a C++ program invoked once.

Bug: 67901036
Test: create user, run adb shell ls -laZ /data/misc_ce/10; delete user
    and check logs.
Change-Id: I886cfd6505cca1f5b5902f2071e13f48e612214d
2017-10-24 15:26:58 -07:00
Jeff Sharkey
3ce18256a1 Pass both partition GUID and filesystem UUID.
FDE keys are indexed using the partition GUID, while FBE keys will be
indexed using the filesystem UUID, so pass both of those identifiers
along when forgetting a volume.

Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.AdoptableHostTest
Bug: 25861755
Change-Id: I6e239d5ba67a01c9a848d705f6167da00f975924
2017-10-24 12:19:47 -06:00
Jeff Sharkey
ac46172c79 Merge "Move vold to Android.bp." 2017-10-24 18:19:08 +00:00
Jeff Vander Stoep
236bae4ecc Merge "Check that dir name is a pid before attempting to read" am: 6419445383 am: c923127e23
am: fa8acb3220  -s ours

Change-Id: Id2abc9f0404c3107439e7cf2fb75bb6aeeb46c75
2017-10-24 17:38:30 +00:00
Jeff Vander Stoep
fa8acb3220 Merge "Check that dir name is a pid before attempting to read" am: 6419445383
am: c923127e23

Change-Id: Ie64df29420d9a6dac7bd5b1f47b4c6c9cda8f078
2017-10-24 17:24:58 +00:00
Jeff Vander Stoep
c923127e23 Merge "Check that dir name is a pid before attempting to read"
am: 6419445383

Change-Id: I8b7639934bcee660bcd84f83afae5cc2c17bae15
2017-10-24 17:19:58 +00:00
Treehugger Robot
6419445383 Merge "Check that dir name is a pid before attempting to read" 2017-10-24 17:15:03 +00:00
TreeHugger Robot
9fd7559813 Merge "Check that dir name is a pid before attempting to read" 2017-10-24 16:04:22 +00:00
Jeff Vander Stoep
a997db73d6 Check that dir name is a pid before attempting to read
Prevents selinux denials for folders in /proc that do not have the
default /proc label.

Bug: 68146208
Test: no selinux denials for vold attempting to read proc_asound dir.
Merged-In: I7cdd3bbe8e687e078372012773e9a34a5c76e0f8
Change-Id: I7cdd3bbe8e687e078372012773e9a34a5c76e0f8
2017-10-24 14:04:27 +00:00
Jeff Vander Stoep
5889083d71 Check that dir name is a pid before attempting to read
Prevents selinux denials for folders in /proc that do not have the
default /proc label.

Bug: 68146208
Test: no selinux denials for vold attempting to read proc_asound dir.
Change-Id: I7cdd3bbe8e687e078372012773e9a34a5c76e0f8
2017-10-24 07:03:01 -07:00
Jeff Sharkey
d16dc5089b Move vold to Android.bp.
Test: builds, boots
Bug: 67041047
Change-Id: Ife9118d274fc92d30b38d216f815741a060a04b7
2017-10-23 17:27:49 -06:00
TreeHugger Robot
947a57e76d Merge "Undo Utils dependency on VolumeManager" 2017-10-20 18:52:55 +00:00
Paul Crowley
56292ef119 Undo Utils dependency on VolumeManager
I want to use Utils in another executable, so breaking this link.

Bug: 25861755
Test: compiles (and boots, though that doesn't exercise changed code)
Change-Id: I6bb447453bb370fefb7f2f3aceb459428bdee6a7
2017-10-20 10:05:36 -07:00
Jeff Sharkey
f4304de64a Merge "Use sgdisk to create better-aligned MBR tables." 2017-10-20 16:04:57 +00:00
Chih-hung Hsieh
20a042e5ff Merge "Use -Werror in system/vold/tests" am: d6d0e91c62 am: 7718457dfc am: 2412d496c8
am: 192ebf8acb

Change-Id: I1c2346c160190e26e4023e2aa4c1091ebf7621ba
2017-10-19 23:49:12 +00:00
Chih-hung Hsieh
192ebf8acb Merge "Use -Werror in system/vold/tests" am: d6d0e91c62 am: 7718457dfc
am: 2412d496c8

Change-Id: Ibf15a38de8902c31fdb970d6aa2970c710480bbe
2017-10-19 23:34:51 +00:00
Chih-hung Hsieh
2412d496c8 Merge "Use -Werror in system/vold/tests" am: d6d0e91c62
am: 7718457dfc

Change-Id: I74f21fe6a41d2585a05c6e0c47e80b9041bae588
2017-10-19 23:24:20 +00:00
Chih-hung Hsieh
7718457dfc Merge "Use -Werror in system/vold/tests"
am: d6d0e91c62

Change-Id: Idc41239ba5d67954dfb7d6e61e31768dafdd3599
2017-10-19 23:18:12 +00:00
Chih-hung Hsieh
d6d0e91c62 Merge "Use -Werror in system/vold/tests" 2017-10-19 22:33:52 +00:00
Chih-Hung Hsieh
8646da062a Use -Werror in system/vold/tests
* Comment out unused function.

Bug: 66996870
Test: build with WITH_TIDY=1
Change-Id: I7a23573af0d664a5f39f1cde3a22ac0001dac1ac
2017-10-19 11:51:20 -07:00
Chih-Hung Hsieh
27c0d952cb Use -Werror in system/vold/tests
Bug: 66996870
Test: build with WITH_TIDY=1
Change-Id: Ied1f6160124d10d81151d401ed4a0b089816abb3
2017-10-19 10:07:38 -07:00
Jeff Sharkey
4ddf576ca8 Merge "Introduce lock for SELinux process-level changes." 2017-10-19 15:02:53 +00:00