Commit graph

970 commits

Author SHA1 Message Date
Mateusz Nowak
a4f48d0f44 vold: fix 64 bit ioctl error
Changing the num_sectors used in ioctl with BLKGETSIZE because
the kernel expects an unsigned long type and then changes 64 bits
with a 64 bits userspace. This overwrites what's located close to
the parameter location if any.

Change-Id: I78fd61a1084de2741f39b926aa436462518709a0
Signed-off-by: Mateusz Nowak <mateusz.nowak@intel.com>
Signed-off-by: Zhiquan Liu <zhiquan.liu@intel.com>
2015-10-21 11:16:19 +08:00
Sami Tolvanen
0331d4ae38 am 685dfdd3: Merge "Error correction: Add libfec dependencies for vold"
* commit '685dfdd33590ef8a93627015c434fea54b8f1b4d':
  Error correction: Add libfec dependencies for vold
2015-10-02 10:47:23 +00:00
Sami Tolvanen
685dfdd335 Merge "Error correction: Add libfec dependencies for vold" 2015-10-02 10:42:16 +00:00
Sami Tolvanen
efe67cd25d Error correction: Add libfec dependencies for vold
Vold requires libfec and related dependencies due to fs_mgr_mount_all.

Bug: 21893453
Change-Id: If59df0c5fd3395d4aac97dd8119b7c70c0fa5d4d
2015-09-29 14:55:35 +01:00
Tom Cherry
79b6fdfcea update bundled rc files to their contents from rootdir/init.rc
Bug 23186545

Change-Id: I634b682b7a4cef9e1b817561b4458e1442443c63
(cherry picked from commit 6cb234dc57)
2015-08-21 21:55:01 +00:00
Tom Cherry
685439bbc7 am 218f48d6: Merge "bundle init.rc contents with its service"
* commit '218f48d6c55a7ee5115a7a8fc4248d33ea01811f':
  bundle init.rc contents with its service
2015-08-21 18:20:19 +00:00
Tom Cherry
218f48d6c5 Merge "bundle init.rc contents with its service" 2015-08-21 17:42:33 +00:00
Tom Cherry
a285984ae4 bundle init.rc contents with its service
Bug: 23186545
Change-Id: I82d8b6dc54ebe32ceb1ed997aaab3701ee7b6c4a
2015-08-19 17:36:11 -07:00
Elliott Hughes
b1259ffd92 am f298f6be: Merge "Use errno correctly."
* commit 'f298f6be4c8df8745735676e37ccc963909ff3b2':
  Use errno correctly.
2015-08-17 17:43:54 +00:00
Elliott Hughes
f298f6be4c Merge "Use errno correctly." 2015-08-17 17:33:35 +00:00
tao.pei
a1038a9566 Use errno correctly.
Make sure to check errno prior to doing anything
else that can modify it.

Change-Id: Id81ecc2c3fa07c222ab1e2ef6441331a1eaad635
2015-08-17 20:22:17 +08:00
Elliott Hughes
3097d0e151 am 6d24e086: Merge "Remove dead code."
* commit '6d24e0866f61aba0ac3023408ead083ad9b6cdab':
  Remove dead code.
2015-08-15 02:19:04 +00:00
Elliott Hughes
6d24e0866f Merge "Remove dead code." 2015-08-15 02:06:36 +00:00
Elliott Hughes
c569f528a2 Remove dead code.
Change-Id: I042f8aacfa8a7900b5684aaa24da368cdcb41b1f
2015-08-14 18:41:14 -07:00
Jeff Sharkey
7206b42bad am eddf9bd6: Request specific tags from blkid.
* commit 'eddf9bd63c1f7e0f9709f7c58a1035fa43338325':
  Request specific tags from blkid.
2015-08-13 00:43:05 +00:00
Jeff Sharkey
eddf9bd63c Request specific tags from blkid.
Otherwise blkid can emit tags like SEC_TYPE which mess with the value
extraction code.

Bug: 23069906
Change-Id: Id2a588ff43a538747d1e44cd8218c96ebd0192c2
2015-08-12 16:04:52 -07:00
Jeff Sharkey
2b8f194f1a am 1bd078fa: Protect runtime storage mount points.
* commit '1bd078fa7b5ca613cb3e793d67ccd86d2602787d':
  Protect runtime storage mount points.
2015-08-06 19:58:08 +00:00
Jeff Sharkey
1bd078fa7b Protect runtime storage mount points.
We have a bunch of magic that mounts the correct view of storage
access based on the runtime permissions of an app, but we forgot to
protect the real underlying data sources; oops.

This series of changes just bumps the directory heirarchy one level
to give us /mnt/runtime which we can mask off as 0700 to prevent
people from jumping to the exposed internals.

Also add CTS tests to verify that we're protecting access to
internal mount points like this.

Bug: 22964288
Change-Id: I83f09f0423f4993e766273c50389dd29b1c50589
2015-08-06 11:45:50 -07:00
Jeff Sharkey
3a60599ae8 am 8474ee32: Return useful path when not visible.
* commit '8474ee323131fdadcc17f09eab25003a7ae934e0':
  Return useful path when not visible.
2015-07-31 01:51:23 +00:00
Jeff Sharkey
8474ee3231 Return useful path when not visible.
This allows apps like ExternalStorageProvider to still read/write
files on transient storage devices which aren't mounted as visible.

Bug: 22545248
Change-Id: Idacb15f2233245a8e1861d9be977535a82b218ec
2015-07-30 16:54:23 -07:00
Jeff Sharkey
26934b0954 am d46687ee: Use random data for benchmark instead of zeros.
* commit 'd46687ee5da7c9847c6188241ccc699d3a0826c2':
  Use random data for benchmark instead of zeros.
2015-07-29 20:13:08 +00:00
Jeff Sharkey
d46687ee5d Use random data for benchmark instead of zeros.
If we always write zeros, we're leaving a giant pile of known
plaintext at an almost deterministic location on newly formatted
volumes.  To avoid this, repeat a 64K chunk of random data.

Bug: 22816936
Change-Id: Iedc067a519bd676a93b9d74ea4f9f77c84c8461c
2015-07-29 10:03:11 -07:00
Jeff Sharkey
09b542f269 am 20642ae7: Give secondary users read-only physical cards.
* commit '20642ae71aa93ec2658d09c92a1ffc3844f5a555':
  Give secondary users read-only physical cards.
2015-07-29 04:04:44 +00:00
Jeff Sharkey
20642ae71a Give secondary users read-only physical cards.
Long ago, we mounted secondary physical cards as readable by all
users on the device, which enabled the use-case of loading media on
a card and viewing it from all users.

More recently, we started giving write access to these secondary
physical cards, but this created a one-directional channel for
communication across user boundaries; something that CDD disallows.

This change is designed to give us the best of both worlds: the
package-specific directories are writable for the user that mounted
the card, but access to those "Android" directories are blocked for
all other users.  Other users remain able to read content elsewhere
on the card.

Bug: 22787184
Change-Id: I75dbd339f11402ae774c7e4b8f2b15ee216270e8
2015-07-28 17:47:11 -07:00
Jeff Sharkey
15c6489aa9 am 32679a82: Create user directory on emulated storage.
* commit '32679a82d9542ec26ea8b4e32d29dd7b02202611':
  Create user directory on emulated storage.
2015-07-23 18:26:46 +00:00
Jeff Sharkey
32679a82d9 Create user directory on emulated storage.
When mounting a primary external storage device that is multi-user
aware, ensure that the user-specific directory actually exists before
moving forward.

Bug: 22472026
Change-Id: I33c8eed261a9c0d5acedd5be6133ed9990679d08
2015-07-21 14:22:03 -07:00
Jeff Sharkey
0d3fe8152e am 81f55c6d: Mount emulated volumes as consistent location.
* commit '81f55c6dc1a14ed68e404fa3a2c244dd343e4990':
  Mount emulated volumes as consistent location.
2015-07-08 22:08:07 +00:00
Jeff Sharkey
81f55c6dc1 Mount emulated volumes as consistent location.
We really only support a single emulated volume on the device at a
time, either on internal storage, or moved to a private volume.  To
avoid kicking off a giant rescan of all media when moved, keep all
the paths the same when mounted as primary.

Also ensure we have /data/media/0 ready on private volumes.

Bug: 20275423
Change-Id: I0c102f430b865ca7536772b1fae56d8c9660a97a
2015-07-08 14:07:39 -07:00
Jeff Sharkey
3ff337db56 am c86ab6f5: Trim both internal and adopted private storage.
* commit 'c86ab6f538bec63638c168d6c843fe7cf73add3b':
  Trim both internal and adopted private storage.
2015-07-02 00:58:16 +00:00
Jeff Sharkey
c86ab6f538 Trim both internal and adopted private storage.
Refactor fstrim code to be encapsulated in unique task object, and
give it option of benchmarking when finished.  Trimming now includes
both storage from fstab and adopted private volumes.  Cleaner timing
stats are logged for each unique volume.

Add wakelock during ongoing async move tasks.  Push disk sysfs path
to framework so it can parse any SD card registers as desired.

Bug: 21831325
Change-Id: I76577685f5cae4929c251ad314ffdaeb5eb1c8bf
2015-07-01 15:53:51 -07:00
Jeff Sharkey
1458955fec am c7b5b570: Null-terminate readlink() result, full remount.
* commit 'c7b5b570bd05ed3bc921b0c2dc346416a52b4e3e':
  Null-terminate readlink() result, full remount.
2015-07-01 00:30:39 +00:00
Jeff Sharkey
c7b5b570bd Null-terminate readlink() result, full remount.
In order to compare results from readlink() calls, we need to null
terminate the read value, otherwise we can end up doing an infinitely
recursive remount in the root namespace.

When remounting inside a namespace, unmount all existing mounts before
mounting the new storage into place.  This also means we need to mount
the user-specific symlinks back into place.

Skip spinning up the FUSE daemon when not visible, otherwise we get
stuck waiting for a daemon that never shows up.

Bug: 22192518, 22204412
Change-Id: Icc7db822354ab7ffc47c39cd0611f65edecc32e5
2015-06-30 15:54:17 -07:00
Jeff Sharkey
8da07375f9 am 63123c06: Last ditch check for partition on raw disk.
* commit '63123c067a4e709198d9b8d3279c98561f8c990e':
  Last ditch check for partition on raw disk.
2015-06-26 20:38:18 +00:00
Jeff Sharkey
63123c067a Last ditch check for partition on raw disk.
Some storage devices can be formatted as bare partitions, without an
MBR or GPT header.  If we found no partitions, try poking at the raw
disk, and treat it as a public volume if we found a valid filesystem.

Bug: 20503551
Change-Id: I80304e1ad865435321c341b667c0daf2daf4d56c
2015-06-26 11:16:17 -07:00
Jeff Sharkey
0deb385f85 am 66270a21: Let\'s reinvent storage, yet again!
* commit '66270a21df1058434e4d63691221f11ff5387a0f':
  Let's reinvent storage, yet again!
2015-06-26 16:05:27 +00:00
Jeff Sharkey
66270a21df Let's reinvent storage, yet again!
Now that we're treating storage as a runtime permission, we need to
grant read/write access without killing the app.  This is really
tricky, since we had been using GIDs for access control, and they're
set in stone once Zygote drops privileges.

The only thing left that can change dynamically is the filesystem
itself, so let's do that.  This means changing the FUSE daemon to
present itself as three different views:

/mnt/runtime_default/foo - view for apps with no access
/mnt/runtime_read/foo - view for apps with read access
/mnt/runtime_write/foo - view for apps with write access

There is still a single location for all the backing files, and
filesystem permissions are derived the same way for each view, but
the file modes are masked off differently for each mountpoint.

During Zygote fork, it wires up the appropriate storage access into
an isolated mount namespace based on the current app permissions.  When
the app is granted permissions dynamically at runtime, the system
asks vold to jump into the existing mount namespace and bind mount
the newly granted access model into place.

Bug: 21858077
Change-Id: Iade538e4bc7af979fe20095f74416e8a0f165a4a
2015-06-25 22:40:08 -07:00
Makoto Onuki
34507d60ad am 5d268fda: Merge "Make sure volume is vfat before fsck\'ing." into mnc-dev
* commit '5d268fdac49bd3174a7f0c6dbb042162ae87a695':
  Make sure volume is vfat before fsck'ing.
2015-06-24 21:05:39 +00:00
Makoto Onuki
5d268fdac4 Merge "Make sure volume is vfat before fsck'ing." into mnc-dev 2015-06-24 20:33:57 +00:00
Makoto Onuki
c82c9ce18c Make sure volume is vfat before fsck'ing.
Bug 21948137

Change-Id: I6843423fd8809d9e2f352059a810aa17dd83b3e3
2015-06-24 13:30:45 -07:00
Shawn Willden
4fcd2fca22 am 86af3557: Add purpose to vold-generated keymaster1 keys.
* commit '86af3557e3dc0f6e4fa2c0d56f840eb4247f9f4f':
  Add purpose to vold-generated keymaster1 keys.
2015-06-24 17:13:53 +00:00
Shawn Willden
86af3557e3 Add purpose to vold-generated keymaster1 keys.
Also remove the app ID and additional padding and digest options.

Bug: 22009890
Change-Id: Ibff9bbd0e0c11d651d11fac85d4ac907588f1cd2
2015-06-24 09:27:31 -07:00
Jeff Sharkey
b5e680ac37 am bc40cc8f: Add method to forget private partition keys.
* commit 'bc40cc8f07f69e0e26fc41516e2a83f0a8becbe0':
  Add method to forget private partition keys.
2015-06-22 21:33:51 +00:00
Jeff Sharkey
bc40cc8f07 Add method to forget private partition keys.
Report both the disk and the partition GUID for private volumes to
userspace, and offer to forget the encryption key for a given
partition GUID.

Bug: 21782268
Change-Id: Ie77a3a58e47bf3563cdb3e4b0edfab1de4d0e6b4
2015-06-22 14:04:54 -07:00
Shawn Willden
c6c5932cf8 am 0417060e: Use correct error code for rate limiting.
* commit '0417060e8ebfd28171fd0aaef8f4e42d9ddd482e':
  Use correct error code for rate limiting.
2015-06-20 19:32:57 +00:00
Shawn Willden
0417060e8e Use correct error code for rate limiting.
Note that this CL depends on cl 712195, which must be submitted first.

Bug: 21607106
Change-Id: Iafc42d1c8a1145a31ea252b33b404044f92ec62b
2015-06-19 09:14:51 -06:00
Shawn Willden
8087e11655 am da6e899f: Add keymaster1 support to vold.
* commit 'da6e899f4e1429add2ef023e0cc6b0fcca42c945':
  Add keymaster1 support to vold.
2015-06-17 21:07:23 +00:00
Shawn Willden
da6e899f4e Add keymaster1 support to vold.
Bug: 21607106
Change-Id: I498141b90888d4f0652912413b04519f61886935
2015-06-17 10:27:07 -06:00
Paul Lawrence
4cc173e135 am b1ef4665: Improve boot time by 0.1s by reducing a polling sleep interval
* commit 'b1ef4665e8df4abf0f3f134bf3090415fc834606':
  Improve boot time by 0.1s by reducing a polling sleep interval
2015-06-11 21:10:46 +00:00
Paul Lawrence
b1ef4665e8 Improve boot time by 0.1s by reducing a polling sleep interval
Bug: 21516860
Change-Id: I9e28f4d9cc20ec2a7d9e325c02ef85f0ad9b3d60
2015-06-11 11:36:18 -07:00
Jeff Sharkey
b75343ae99 am 210228a0: Merge "Start tracking added users with serial numbers." into mnc-dev
* commit '210228a089cd215bc671b9fb664d869d2c5ad986':
  Start tracking added users with serial numbers.
2015-06-10 17:05:45 +00:00