Commit Graph

67 Commits

Author SHA1 Message Date
JP Abgrall cee206880e [HACK]fs_mgr+init: Format via recovery if encryptable /data is wiped
If the encryptable partition is wiped (4KB worth of 0 or 0xff),
then reboot into recovery to format /data+/cache

This is while waiting for the Mac OS support to format f2fs.
The flashstation running on Mac OS will currently just erase userdata
and not format it with f2fs.

Bug: 15720406
Bug: 15747366
Change-Id: Ib7cca3e1701483a09573457a835750f34da71ee0
2014-07-02 14:28:50 -07:00
JP Abgrall f22b745294 fs_mrg: clean up multi-type mount_all
Move the code that attempts to mount alternative fstab entries
into its own function.
Clarify return codes.
Suggest wipe via recovery in error messages.

Bug: 15747366
Change-Id: I3634477cd4d1d73f974f3e906c53285f0d9e0eac
Signed-off-by: JP Abgrall <jpa@google.com>
2014-07-02 13:39:44 -07:00
Todd Poynor 4a974df8ad Merge "fs_mgr: fix crash on "noemulatedsd" in fstab" 2014-07-01 19:15:58 +00:00
Todd Poynor 22f63e393f fs_mgr: fix crash on "noemulatedsd" in fstab
MF_FORCECRYPT claimed same flag value as existing MF_NOEMULATEDSD.
MF_FORCECRYPT also crashes if no "=" in the option.

Modify MF_NOEMULATEDSD flag value to unique, and reformat comment to keep
the definition near the other defines.

Change-Id: Iec86f40ff43eea14b791d3d19c0ae11fd4b5f784
2014-07-01 17:57:13 -07:00
JP Abgrall 7553d57298 fs_msg: fix bad tmpfs detection (fix /persist mount errors)
Without this, the wrong mount point is flagged as being mounted.
Which leads to:

<6>[    3.278040] fs_mgr: __mount(source=/dev/block/platform/msm_sdcc.1/by-name/userdata,target=/data,type=ext4)=-1
<7>[    3.278834] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
<6>[    3.278925] fs_mgr: fs_mgr_mount_all(): skipping fstab dup mountpoint=/persist rec[3].fs_type=ext4 already mounted.


Bug: 15925030
Bug: 15976144
Change-Id: I0bc617f11dfc97c32bb2d0e52b94ec19282568eb
2014-06-30 18:28:09 +00:00
JP Abgrall e29cbd3372 fs_mgr: increase tmpfs size to accommodate bigger dex2oat data
During encryption and decryption, art is pumping out data via
dex2oat into the /data that is actually a tmpfs.
It currently needs ~195MB.
So we increase the tmpfs from 128MB to 256MB.

Bug: 15909689
Change-Id: I5d518a87d7b4eccf32fcd77f61980646ee8a3d35
Signed-off-by: JP Abgrall <jpa@google.com>
2014-06-27 02:24:55 -07:00
Daniel Rosenberg f67d6bd3c0 Moved symlink back up.
Moving the vendor symlink down was causing issues with some devices.
Moved it back up, and adjusted mount to remove symlinks if necessary.

Change-Id: I77126d77cfbef32250012bea3960c99b55db4cbb
Signed-off-by: Daniel Rosenberg <drosen@google.com>
2014-06-26 22:07:37 +00:00
JP Abgrall 983411318f fs_mgr: fix double mounting of partition
When looking for partitions to encrypt, it would setup a tmpfs
onto the mount point. But with multi-type mount points it would
repeat the mount.
This would lead to having and extra tmpfs mounted on /data, as
only one would get removed.

Change-Id: I28f2c2c4955906f1172342ea07e0795d6880986b
Signed-off-by: JP Abgrall <jpa@google.com>
2014-06-25 20:04:25 +00:00
Daniel Rosenberg f530c93c4a Added support for vendor partition and image
Modified fastboot to flash vendor.img as well. Moved symlink
for /vendor to occur after mounting partitions. Changed mount
to also create the mount point.

Change-Id: I78e1ba24e6bb8b4af96a67ee0569af579439e682
Signed-off-by: Daniel Rosenberg <drosen@google.com>
2014-06-24 21:51:31 +00:00
JP Abgrall 4bb7bba118 [HACK]fs_mgr: force recovery+wipe if data looks wiped
We do the recovery+wipe if
 - the mount fails and
 - the partition is forceencrypt
 - the partition seems wiped (== the 1st 4KB are all 0x00 or 0xFF).

This is a hack until we get the flashstation up and running with f2fs.
Bug: 15731906

The alternative would be for the user to manually enter
recovery and wipe his device.

Bug: 15747366
Change-Id: Ic8f3ef59f3d7d01d5d93d8e4c01502080f422157
Signed-off-by: JP Abgrall <jpa@google.com>
2014-06-19 22:12:20 -07:00
JP Abgrall 5c01dac6d8 fsmgr: support multiple fs-types/mountpoint
Previous attempt was broken.
It would incorrectly be affected by mount failures.

This changes allows an fstab to contain multiple lines for a given
mount point.
The lines sharing a mount MUST be after each other.

The 1st matching line is the primary when it comes to mounting
and look ups for wiping.

Mounting based on a mount_point will attempt each dup in turn
until one succeeds.
The reported error will be that of the last failed attempt.

This is to allow quick experimentation between different FSes.

Bug: 15702546
Change-Id: I378d68ad13eb0098ec1ccb8dcf108b82acbe9ebb
Signed-off-by: JP Abgrall <jpa@google.com>
2014-06-18 22:18:24 +00:00
JP Abgrall f786fe5438 fsmgr: revert multiple fs-types/mountpoint (fix N5 boot)
This is apparently breaking N5, so reverting for now.

This reverts commit a794f86522.

Bug: 15709256
Change-Id: I37a5160eead17e153e2c83fa94632ffa5d8553c2
2014-06-18 07:28:14 +00:00
JP Abgrall a794f86522 fsmgr: allow for a multiple fs-types for a mount point.
This changes allows an fstab to contain multiple lines for a given
mount point.
The lines sharing a mount MUST be after each other.

The 1st matching line is the primary when it comes to mounting
and look ups for wiping.

Mounting based on a mount_point will attempt each dup in turn
until one succeeds.

This is to allow quick experimentations between different FSes.
It does not deal with checkfs yet, because the underlying invocation
of fs-type appropriate fsck does not handle the error code.
Only the primary FS (1st in the dups) is checked.

Change-Id: I8329737454b53e2681436fe85cd00a9bc522676b
Signed-off-by: JP Abgrall <jpa@google.com>
2014-06-17 17:01:20 -07:00
JP Abgrall 1235158c29 F2FS support for fastboot format and fsmgr
- Enables fsck.f2fs for partitions with type F2FS.
- Adds support for f2fs as format fs-type.
- f2fs is optional and support is dlopen()d when needed.

Needs changes in
  system/extras/f2fs_utils
  external/f2fs-tools

Change-Id: I8d141a0d4d14df9fe84d3b131484e9696fcd8870
Signed-off-by: JP Abgrall <jpa@google.com>
2014-06-17 17:01:14 -07:00
Mark Salyzyn 87f1dd5da1 am af0df46d: am e6246ca6: am 01ef52e1: Merge "fs_mgr: turn on -Werror"
* commit 'af0df46d74368bb98edaadb3c09ddbc7252d3110':
  fs_mgr: turn on -Werror
2014-05-08 21:43:06 +00:00
Mark Salyzyn 86e3f22b6a fs_mgr: turn on -Werror
- deal with some -Wunused-variable issues

Change-Id: Ie0140d4777ddf862e4bbed76142a1dbb8320c1b0
2014-05-07 16:56:21 -07:00
Sasha Levitskiy e2acb82a94 am 43cb7ae6: am 4f362e43: am 835526fd: Merge "Cleanup: warning fixit."
* commit '43cb7ae6c31ced8cd518eab59dfea31ab1ade812':
  Cleanup: warning fixit.
2014-04-12 00:02:33 +00:00
Sasha Levitskiy cdc1cfb3e5 Cleanup: warning fixit.
bootable/recovery has a dependent commit: I9adb470b04e4301989d128c9c3097b21b4dea431

Change-Id: Icf23e659265d71d5226d527c2b40cfbc132320ee
Signed-off-by: Sasha Levitskiy <sanek@google.com>
2014-04-11 16:15:46 -07:00
Paul Lawrence 2e5ae0a4f9 Add force_encrypt flag to fstab to force encryption on appropriate devices
forceencrypt= will encrypt the drive at boot if it is not encrypted. This change
will not have an impact until we set this flag in appropirate fstabs.

Bug: 11985952

Change-Id: I6c65eda7f109e4936aa160da50f871703aefb351
2014-04-04 11:07:27 -07:00
Geremy Condra cd642fc0b5 fs_mgr: disable verified partitions on debuggable devices.
This checks ro.debuggable to determine whether a device is in the
debuggable state or not, disabling verification if it is.

Eventually we'd like to narrow this down to only devices which
need to disable it, but we aren't there yet.

Change-Id: I06a329fe5449deab6bae595877dbb1f200850241
2014-04-02 18:07:22 -07:00
Paul Lawrence 166fa3de70 Auto-encrypt drive at startup
Modify fs_mgr to unmount encryptable drives after test mounting them and
then trigger an auto-encrypt via the init script

Needs matching vold changes from
 https://googleplex-android-review.googlesource.com/#/c/414200/

Feature is limited to list of serial numbers with this change

Bug: 11985952
Change-Id: I84f85a258b6a7e9809467c9149249302e203c41b
2014-03-24 15:00:53 -07:00
Geremy Condra 8c40dc90c5 Merge changes Ibea4c13a,I27215a3d
* changes:
  init: Add "partition.*.verified" properties to the property service.
  fs_mgr: Set the 'partition.*.verified' property for verified partitions.
2014-03-19 19:55:07 +00:00
Geremy Condra 05699b3e3e fs_mgr: Set the 'partition.*.verified' property for verified partitions.
This modifies fs_mgr to set the partition.*.verified properties.
Each of these should be used as a weak indicator that a given partition
is verified. For instance, if the 'partition.system.verified' property
is set to '1', this could indicate that the system partition is verified
and therefore should not be modified by, e.g., adb sync.

Note that these properties can be mutated by the system, and so
should not be used as the basis for security decisions.

Change-Id: I27215a3d3628a1b1e184df9eaad90541b9d8b841
2014-03-18 20:35:07 -07:00
Mohamad Ayyash 611f5e960c fs_mgr: fix mount_all when handling already mounted encryptable fs.
Since 38afe5f4ba
  fs_mgr_mount_all() will try to behave more like "mount -a"

So prevent inaccessible or busy (already mounted) encryptable filesystems
from mounting tmpfs in their mount points.


Change-Id: I32e5b3e26f2138d1e4d9ef8ba01c1466f8051d39
2014-03-13 03:45:21 +00:00
Mohamad Ayyash 38afe5f4ba fs_mgr: Ensure mount_all will process all fstab entries despite logging errors.
Change-Id: I0d58dd17d979b749a9ac03567cf2d395f9782f10
2014-03-12 12:44:18 -07:00
David 'Digit' Turner 28483d7ec4 fs_mgr: Don't run e2fsck inside SDK system images.
These images do not have GPL-ed binaries like /system/bin/e2fsck so
avoid running the program when we detect that we're running inside
one of them.

Note that this does not affect other emulator-based build products
(e..g full-eng instead of sdk-eng), which do have the binaries.

BUG=13057123

Change-Id: Ia42f1d02a3845fbf4b2f9d95818f35d760711a12
2014-02-24 23:32:00 +01:00
Colin Cross 5edee2aca9 fs_mgr: split fstab parsing into separate file
Move fstab parsing into fs_mgr_fstab.c so that it compiles into a
separate compilation unit.  uncrypt links against it but doesn't
need to pull in the rest of the dependencies on fs_mgr.c.

Change-Id: I6bffe1cd42720151533e958028259d1931aaa4bf
2014-01-23 14:24:16 -08:00
Colin Cross a8be627935 fs_mgr: update ext4_parse_sb to match change in ext4_utils
ext4_parse_sb now takes the struct fs_info to fill out to avoid
using the global info from external callers.

Change-Id: I0984ba01c0dbdd5b68b825817faf0c5cf5aa5510
2014-01-23 14:24:16 -08:00
Elliott Hughes 7cd1561410 Merge "system/core 64-bit cleanup." 2014-01-16 21:59:58 +00:00
Elliott Hughes ccecf14254 system/core 64-bit cleanup.
This cleans up most of the size-related problems in system/core.
There are still a few changes needed for a clean 64-bit build,
but they look like they might require changes to things like the
fastboot protocol.

Change-Id: I1560425a289fa158e13e2e3173cc3e71976f92c0
2014-01-16 12:54:18 -08:00
William Roberts 071f28ae0e fs_mgr: increase verboseness on mount errors
While debugging a mount error, the dmesg output was less
than ideal. The error would be declared but why the mount
failed, and what options were passed was not present. This
patch ensures that the mount options and underlying
errno are printed.

Change-Id: I2b3a2c113149df878c0a8a10ef86fd9e4f909658
2014-01-15 13:26:26 -05:00
Nick Kralevich bc7776716a Revert "fs_mgr: correct warning on unused function parameter"
The build is broken.

system/core/fs_mgr/fs_mgr.c:824:77: error: expected '(' before 'unused'
                      const char *blk_device, long long length  __attribute__(unused))
                                                                             ^
system/core/fs_mgr/fs_mgr.c: In function 'fs_mgr_add_entry':
system/core/fs_mgr/fs_mgr.c:824:56: warning: unused parameter 'length' [-Wunused-parameter]
                      const char *blk_device, long long length  __attribute__(unused))
                                                        ^
make: *** [out/target/product/generic_x86/obj/STATIC_LIBRARIES/libfs_mgr_intermediates/fs_mgr.o] Error 1
make: *** Waiting for unfinished jobs....
This reverts commit 21095d0cae.

Change-Id: I64f8c4d9c17c0e3bbf2eb427a2c0b81bbe66ec3a
2014-01-15 06:18:54 +00:00
William Roberts 21095d0cae fs_mgr: correct warning on unused function parameter
target thumb C: libfs_mgr <= system/core/fs_mgr/fs_mgr.c
system/core/fs_mgr/fs_mgr.c: In function 'fs_mgr_add_entry':
system/core/fs_mgr/fs_mgr.c:828:56: warning: unused parameter 'length' [-Wunused-parameter]
                      const char *blk_device, long long length)

Change-Id: Ide1bfa120c4f8d8e2f643929cb84c1be065e3310
2014-01-14 15:04:56 -05:00
Elliott Hughes bfa7d0822b SWAP_FLAG_* constants are now in <sys/swap.h>.
Bug: 9336527
Change-Id: I77e2b05cefbfb4eebda39b4079107833f4160563
2014-01-07 18:20:17 -08:00
Rom Lemarchand b5ffadedd4 am 397a3642: fs_mgr: check that fstab is not NULL in fs_mgr_free_fstab
* commit '397a3642145dbd0919f8148ff24f0cafe1714b55':
  fs_mgr: check that fstab is not NULL in fs_mgr_free_fstab
2013-09-24 10:57:33 -07:00
Rom Lemarchand 397a364214 fs_mgr: check that fstab is not NULL in fs_mgr_free_fstab
Make sure fstab is not NULL before freeing it

Bug: 10911605
Change-Id: I549c0a470dd183fb15a2f3c5cf4f3dd393b6e307
2013-09-24 10:49:46 -07:00
Ken Sumrall dfcbf02bb0 am 6b1a0272: Merge "Create a separate copy of the fsck logs" into klp-dev
* commit '6b1a027239689a817aa5ca44a2bcbfe48ed21408':
  Create a separate copy of the fsck logs
2013-09-23 18:59:39 -07:00
Ken Sumrall 12d7192586 am 777a00e3: Merge "New fstab flags to support more expressive SD card permissions" into klp-dev
* commit '777a00e3d193e45d928b1a26de85ae5a238271c4':
  New fstab flags to support more expressive SD card permissions
2013-09-23 18:59:39 -07:00
Ken Sumrall 4eaf905858 Create a separate copy of the fsck logs
The log_target parameter of android_fork_execvp_ext() is now a
bit field, and multiple targets can be set to log to multiple
places at the same time.

The new target LOG_FILE will log to a file specified by the new
parameter file_path.

Set LOG_FILE and log to a file in /dev (the only writable filesystem
avilable when e2fsck runs) when invoking e2fsck in fs_mgr.

Bug: 10021342

Change-Id: I63baf644cc8c3afccc8345df27a74203b44d0400
2013-09-20 17:44:33 -07:00
Ken Sumrall 887f289206 New fstab flags to support more expressive SD card permissions
Bug: 10330128

Change-Id: I41fb178b839487b604762fbc1ccba097d25c7aa0
2013-09-20 17:43:52 -07:00
Elliott Hughes a2a93250f6 am c67bd8d7: am a208ea63: Merge "Fix fstab memory leak"
* commit 'c67bd8d7cd9b43a5a5ef249ea787ac9786359d22':
  Fix fstab memory leak
2013-09-18 16:38:14 -07:00
Irina Tirdea d431b8d7f1 Fix fstab memory leak
When reading the fstab config file fails, fstab memory is not freed.
When fstab structure is no longer needed, only half of it is freed.

Free fstab memory in all cases (error or when it is no longer needed).

Change-Id: Ib0758a5aaa69505285bf64143632986a2dbbdccb
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
2013-09-18 16:34:02 -07:00
Elliott Hughes 9f25b565f7 am c4295d9b: am 810ff696: Merge "Cleanup fs_getline from fs_mgr"
* commit 'c4295d9b72812afbaebd7f2512c7a5bba9e7d5fa':
  Cleanup fs_getline from fs_mgr
2013-09-18 16:33:55 -07:00
Irina Tirdea e16d747b51 Cleanup fs_getline from fs_mgr
Since getline is included in bionic, fs_mgr can use this version instead of
the one defined internally by fs_getline.

Replace fs_getline with getline.

Change-Id: I49b53d639bd995f051256fb7573ff6ab45d9c36d
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
2013-09-18 22:55:51 +03:00
Geremy Condra 3ad3d1c4b5 Add basic verity support to fs_mgr.
This change adds a "verify" fs_mgr flag specifying that
the device in question should be verified.

Devices marked with this flag are expected to have a
footer immediately after their data containing all
the information needed to set up a verity instance.

Change-Id: I10101f2c3240228ee0932e3767fe35e673d2e720
2013-08-06 22:15:58 -07:00
Elliott Hughes 81274e9e6c am 6b78fad1: am a9396549: Fix my incorrect merge resolution for 132b7d750e harder.
* commit '6b78fad147c772075eae5cfc25f5a50748bc4015':
  Fix my incorrect merge resolution for 132b7d750e harder.
2013-07-11 19:12:18 -07:00
Elliott Hughes a9396549b3 Fix my incorrect merge resolution for 132b7d750e harder.
Change-Id: I3f8bc955f035b49407540053462e53b3f262d381
2013-07-11 19:07:06 -07:00
Elliott Hughes ae118966da am 43564031: am 7b9c33b1: Fix my incorrect merge resolution for 132b7d750e.
* commit '435640312ce48dab201d6f26a6258143a82f551e':
  Fix my incorrect merge resolution for 132b7d750e.
2013-07-11 19:05:32 -07:00
Elliott Hughes 7b9c33b1e0 Fix my incorrect merge resolution for 132b7d750e.
The conflict was the actual intended change.

Change-Id: Icc9493e4b24b7b53a18e2c7406ef24a81e4d4a7b
2013-07-11 18:58:07 -07:00
Elliott Hughes ad989d038e am dccd7773: am 786b1232: resolved conflicts for merge of 42031e0e to stage-aosp-master
* commit 'dccd77730754b681f3517308359a34f86aecd99f':
  fs_mgr_priv: Extend fs wait timeout to 20 seconds
2013-07-11 18:52:12 -07:00