Commit graph

1870 commits

Author SHA1 Message Date
Jeff Sharkey
83b559ced4 Move all crypto commands over to Binder.
Prefix FDE related commands with "fde" to make it clear which devices
they apply to.  This will also make it easier to remove once FDE
is fully deprecated in a future release.

To emulate the single-threaded nature of the old socket, introduce a
lock that is acquired for all encryption related methods.

Sprinkle some "const" around older files to make C++ happy.

Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.DirectBootHostTest
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.AdoptableHostTest
Test: cts-tradefed run commandAndExit cts-dev -m CtsOsTestCases -t android.os.storage.cts.StorageManagerTest
Bug: 13758960
Change-Id: I0a6ec6e3660bbddc61424c344ff6ac6da953ccf0
2017-09-12 17:24:06 -06:00
Jeff Sharkey
ec4fda2459 Add some Binder argument sanity checking.
Yell if the remote caller is trying to pass shady arguments.

Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.AdoptableHostTest
Test: cts-tradefed run commandAndExit cts-dev -m CtsOsTestCases -t android.os.storage.cts.StorageManagerTest
Bug: 13758960
Change-Id: I925dc9290a72fb4389574cd505fc4edfc8fbf0e1
2017-09-12 14:38:14 -06:00
Chen, Luhai
5744dfe3cc 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: 65423023
Test: local build with boot test and device encryption status check. 

Change-Id: I26482c98ac1858a63b9f5c3f84a8699fd6a21cd7
Signed-off-by: Ai, Ting A <ting.a.ai@intel.com>
Signed-off-by: Chen, Luhai <luhai.chen@intel.com>
2017-09-11 18:39:01 -07:00
Jeff Sharkey
11c2d380a7 Move even more vold commands over to Binder.
This moves fstrim, obb and appfuse commands over to the new Binder
interface.  This change also separates creating/destroying and
mounting/unmounting of OBB volumes, which means they finally flow
nicely into the modern VolumeInfo/VolumeBase design.

We now generate unique identifiers for all OBB volumes, instead of
using a shady MD5 hash.

Change all "loop" and "dm" devices to tag the kernel resources with
a vold-specific prefix so that we can clean them up if vold crashes;
there are new destroyAll() methods that handle this cleanup.

Move appfuse mounting/unmounting into VolumeManager so it can be
shared.  Move various model objects into a separate directory to
tidy things up.

Test: cts-tradefed run commandAndExit cts-dev -m CtsOsTestCases -t android.os.storage.cts.StorageManagerTest
Bug: 13758960
Change-Id: I7294e32b3fb6efe07cb3b77bd20166e70b66958f
2017-09-11 18:44:17 -06:00
Elliott Hughes
a94fc7cdcd Merge "<stdbool.h> unnecessary in C++." 2017-09-09 00:09:19 +00:00
Elliott Hughes
f654c04d01 <stdbool.h> unnecessary in C++.
Bug: N/A
Test: builds
Change-Id: Iddbd364e581477b8304dc6f0764f153dbcf122a7
2017-09-08 14:58:08 -07:00
Jeff Sharkey
cf2121435d Merge "Move "volume" commands over to Binder." 2017-09-08 21:55:43 +00:00
Daniel Rosenberg
1b38e33003 Add support for gid derivation on private volumes
This sdcardfs feature was moved under a mount option
and is only needed on private volumes

Test: Private emulated volume should attempt to mount with
      derive_gid option.
Bug: 63245673
Change-Id: I40a8b15c298c815a4643007b9eca8269379fd2ac
2017-09-07 15:27:08 -07:00
Jeff Sharkey
9462bdd512 Move "volume" commands over to Binder.
Keep the old socket-based commands intact for awhile so we can
rapidly disable this change using the ENABLE_BINDER feature flag.

Define constants in AIDL to keep Java and C++ in sync.

Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.ExternalStorageHostTest
Test: cts-tradefed run commandAndExit cts-dev --abi armeabi-v7a -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.AdoptableHostTest
Bug: 13758960
Change-Id: I0d6f82cbebe67f671b60949fd727409aeb1fdc0d
2017-09-07 15:27:30 -06:00
Jeff Sharkey
48fb82cfbc Merge "Start paving the way for vold calls over Binder." 2017-09-07 01:10:20 +00:00
Luis Hector Chavez
769d195438 Merge "Invert the order of SO_RCVBUFFORCE and SO_RCVBUFF" am: a3258252ad am: 2aa4643dca am: d896787df7
am: b216a0a2ee

Change-Id: I369ffbf3be5253a0379dd56cfb3516486031dbc2
2017-09-06 22:58:26 +00:00
Jeff Sharkey
068c6be622 Start paving the way for vold calls over Binder.
This change is the bare minimum needed to publish a new vold
Binder service and move the simple "reset" call over to go through
the new interface.

Test: builds, boots
Bug: 13758960
Change-Id: I5b70976653c69f92e1efc8d1f432b2038eb618a4
2017-09-06 14:06:06 -06:00
Luis Hector Chavez
b216a0a2ee Merge "Invert the order of SO_RCVBUFFORCE and SO_RCVBUFF" am: a3258252ad am: 2aa4643dca
am: d896787df7

Change-Id: I3b72e82b030c685d7e11fa00601774eaba3c241c
2017-09-06 19:57:37 +00:00
Luis Hector Chavez
d896787df7 Merge "Invert the order of SO_RCVBUFFORCE and SO_RCVBUFF" am: a3258252ad
am: 2aa4643dca

Change-Id: I959f84c8e0962ddda76016f4bfa456970bf52be3
2017-09-06 19:52:35 +00:00
Luis Hector Chavez
2aa4643dca Merge "Invert the order of SO_RCVBUFFORCE and SO_RCVBUFF"
am: a3258252ad

Change-Id: I92981e2eb069c4b01ac8d1be51abddb47602529c
2017-09-06 19:48:35 +00:00
Treehugger Robot
a3258252ad Merge "Invert the order of SO_RCVBUFFORCE and SO_RCVBUFF" 2017-09-06 19:32:03 +00:00
Josh Gao
e78efb7df4 Merge "Switch RebootType to an enum class." am: db725d3348 am: da54114d23 am: c01810be33
am: 41770aab2c

Change-Id: Ia5e279208a7ed804abc898520f13ceb2d19b77c3
2017-08-30 02:52:55 +00:00
Josh Gao
41770aab2c Merge "Switch RebootType to an enum class." am: db725d3348 am: da54114d23
am: c01810be33

Change-Id: Ie54bffd0befd917165debfd8d6eff8f9552d6949
2017-08-29 22:01:20 +00:00
Josh Gao
c01810be33 Merge "Switch RebootType to an enum class." am: db725d3348
am: da54114d23

Change-Id: I36b78d3ece0bef5ebedc3193ba989afdfb97e777
2017-08-29 21:54:20 +00:00
Josh Gao
da54114d23 Merge "Switch RebootType to an enum class."
am: db725d3348

Change-Id: I72431dc56d20cf1acb2443ae3d67300a59e10ad3
2017-08-29 21:47:58 +00:00
Treehugger Robot
db725d3348 Merge "Switch RebootType to an enum class." 2017-08-29 21:26:39 +00:00
Luis Hector Chavez
d1b00de2c1 Invert the order of SO_RCVBUFFORCE and SO_RCVBUFF
This change swaps the order of SO_RCVBUFFORCE and SO_RCVBUFF, because
the latter is silently capped to sysctl_rmem_max. So, just try
SO_RCVBUFF if the former failed.

Bug: 62417946
Test: Run android in a new user and network namespace, vold does not
      abort here.

Change-Id: Iac2ddae6fbb80ba84afe5414eade978cd795ef3c
2017-08-29 10:29:48 -07:00
Josh Gao
fec4437972 Switch RebootType to an enum class.
RebootType's shutdown enumerator collides with the shutdown socket
function, which causes problems when <sys/socket.h> gets included
transitively. Switch RebootType into an enum class, to namespace its
enumerators.

Test: treehugger
Change-Id: Ib5e8667df363acb28771430fd43000d381dc8620
2017-08-28 13:22:55 -07:00
Gao Xiang
1e61eae45c mInternalEmulated could be used after shutdown() called am: 7056de1b42
am: bd6ca4a69a

Change-Id: Id886faeee6932641e45c0c9f58a826132d84d592
2017-08-18 18:11:17 +00:00
Gao Xiang
bd6ca4a69a mInternalEmulated could be used after shutdown() called
am: 7056de1b42

Change-Id: I26fd9a89730491f22397e92fb35275504ebcd744
2017-08-18 17:59:58 +00:00
Gao Xiang
7056de1b42 mInternalEmulated could be used after shutdown() called
It fixes the findvolume() / reset() use-after-free issue after
shutdown called to avoid vold crash.

bug: 64833901
Test: test reboot
Fixes: a5bbb5e3c1 ("make shutdown safe for double calls.")
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>

(cherry picked from commit d263da8807)

Change-Id: I636b28f30fb82e4672d88144cd04072d24ef3b85
2017-08-18 08:21:17 -07:00
Keun-young Park
a6447057e3 Merge "mInternalEmulated could be used after shutdown() called" am: 9b4a443bd6 am: 92052aa582 am: 1b6d8237f2 am: 23b87ecf41
am: eddeea7fa7

Change-Id: I139d2b65d0a280a173f2e32e87423dbd18cca3ad
2017-08-17 22:26:41 +00:00
Keun-young Park
eddeea7fa7 Merge "mInternalEmulated could be used after shutdown() called" am: 9b4a443bd6 am: 92052aa582 am: 1b6d8237f2
am: 23b87ecf41

Change-Id: I2aeed83fad9d3690c12e5e7a4603697f3a06119b
2017-08-17 22:23:40 +00:00
Keun-young Park
23b87ecf41 Merge "mInternalEmulated could be used after shutdown() called" am: 9b4a443bd6 am: 92052aa582
am: 1b6d8237f2

Change-Id: I71b1ec275e2850c1a8273ac5eebc7373a0729552
2017-08-17 22:21:40 +00:00
Keun-young Park
1b6d8237f2 Merge "mInternalEmulated could be used after shutdown() called" am: 9b4a443bd6
am: 92052aa582

Change-Id: I7cd336807b1084bb52fcc2d973b2fd8efe5f54c7
2017-08-17 22:17:10 +00:00
Keun-young Park
92052aa582 Merge "mInternalEmulated could be used after shutdown() called"
am: 9b4a443bd6

Change-Id: Ia1007988297c39f391b35ad51645556ceeaf0cc6
2017-08-17 22:13:40 +00:00
Keun-young Park
9b4a443bd6 Merge "mInternalEmulated could be used after shutdown() called" 2017-08-17 22:10:24 +00:00
Jin Qian
b678d7c3f7 cryptfs: remove reference to legacy make_ext4fs
Use upstream mke2fs tool to format ext4 filesystem.

Bug: 64395169
Change-Id: I383510f25a7c0935ddb280a14ef31fcbd143cba1
2017-08-16 11:01:14 -07:00
Pavel Grafov
ea90d0504b Zero memory used for encryuption keys. am: e2e2d308df
am: fce5bc8f14

Change-Id: I06f4be03107eca78ac98affafb9fb612d65f1a44
2017-08-14 14:38:13 +00:00
Pavel Grafov
fce5bc8f14 Zero memory used for encryuption keys.
am: e2e2d308df

Change-Id: I94d4cec05b76ade916cda42ae0b215f8272d7d51
2017-08-14 14:34:13 +00:00
Gao Xiang
d263da8807 mInternalEmulated could be used after shutdown() called
It fixes the findvolume() / reset() use-after-free issue after
shutdown called to avoid vold crash.

Fixes: a5bbb5e3c1 ("make shutdown safe for double calls.")
Change-Id: I50f216141b20da08549080291091dc5690c00ffe
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
2017-08-14 14:26:56 +08:00
Pavel Grafov
e2e2d308df Zero memory used for encryuption keys.
std::vector with custom zeroing allocator is used instead of
std::string for data that can contain encryption keys.

Bug: 64201177
Test: manually created a managed profile, changed it's credentials
Test: manually upgraded a phone with profile from O to MR1.
Change-Id: Ic31877049f69eba9f8ea64fd99acaaca5a01d3dd
2017-08-10 17:31:03 +01:00
Ravisankar Reddy
c1c58d479f Merge "Add noatime to vfat and exfat" into oc-mr1-dev am: 53deec14b8
am: 7f361f97b5

Change-Id: Ibdea8f3c60bbfdbb08508e32e508d2558b4c7f60
2017-08-04 04:37:20 +00:00
Ravisankar Reddy
7f361f97b5 Merge "Add noatime to vfat and exfat" into oc-mr1-dev
am: 53deec14b8

Change-Id: I72527d88639638f72aca10d59171a520adce0cdf
2017-08-04 04:31:19 +00:00
TreeHugger Robot
53deec14b8 Merge "Add noatime to vfat and exfat" into oc-mr1-dev 2017-08-04 04:24:57 +00:00
Keun-young Park
c962a494df do not sleep if it is shutting down am: 375ac25773 am: 4460d0e554
am: 51001f99d1

Change-Id: Idf0720d6c978e8b06076dd3a34a08b55e9167149
2017-08-03 18:41:35 +00:00
Keun-young Park
ddcee9af0c do not sleep if it is shutting down am: 375ac25773 am: 612270b598
am: 9eee633412

Change-Id: I32fb3eee2db53a4b55787991b812c96d1e180005
2017-08-03 18:35:06 +00:00
Keun-young Park
51001f99d1 do not sleep if it is shutting down am: 375ac25773
am: 4460d0e554

Change-Id: I017220c17760d4264359a91395ff834bd01e1394
2017-08-03 18:35:05 +00:00
Keun-young Park
9eee633412 do not sleep if it is shutting down am: 375ac25773
am: 612270b598

Change-Id: I3f88d8b0c5c4654ef57c3f9f0c8851a501945866
2017-08-03 18:29:04 +00:00
Keun-young Park
4460d0e554 do not sleep if it is shutting down
am: 375ac25773

Change-Id: Id0aa75c190b7012f4d329533fcd664341ae8c26b
2017-08-03 18:28:14 +00:00
Keun-young Park
612270b598 do not sleep if it is shutting down
am: 375ac25773

Change-Id: I576040b0068c27b9c7abd880e390841ce80f9906
2017-08-03 18:24:04 +00:00
Pavel Grafov
99002091bf Drop inode and page caches after evicting CE key. am: b350ed02d5
am: 1565a1d365

Change-Id: I0553599d266fc699b16b3f8e5e9eb0109af9477d
2017-08-03 13:20:26 +00:00
Pavel Grafov
1565a1d365 Drop inode and page caches after evicting CE key.
am: b350ed02d5

Change-Id: I84b60141c240eb03162dacd9a563cbc8bc006cd7
2017-08-03 13:09:53 +00:00
Keun-young Park
375ac25773 do not sleep if it is shutting down
- Various sleep(5) for vold shutdown can increase shutdown time a lot.
- If it is shutting down, do not sleep at all. init will take care of
  active partitions if not unmounted.

bug: 64143519
Test: reboot and check logs from vold, check if "ShutdownThread: Shutdown wait timed out" happens.
Change-Id: I7cb91427ad2205fe23a054d255caf7ffdfd9f6c3
2017-08-02 17:45:48 -07:00
Elliott Hughes
86bfd11f9a Merge "Move off deprecated readdir_r." am: 1647759651 am: b60d874f24 am: 984b786b0e am: f14b2fdca9
am: 60d64e1df3

Change-Id: Ic7f859c538cce3050fd5f872d7ab6d351c6db2fb
2017-08-02 18:02:18 +00:00