Commit graph

574 commits

Author SHA1 Message Date
Treehugger Robot
6b07ee9fb5 Merge "DO NOT MERGE ANYWHERE Add comments and code about ro.boot.slot back" 2017-11-13 16:36:34 +00:00
Sandeep Patil
25f1631aa7 DO NOT MERGE ANYWHERE Add comments and code about ro.boot.slot back
Taimen bootloader passes androidboot.slot for now.
This reverts commit 211a4a5d5a.

Bug: 68710251
Test: taimen successfully mounts partition in first stage
Change-Id: I046afc99120e7ec9ef4b8ea7a852eb70e7231ea9
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-11-10 16:20:27 -08:00
Bowgo Tsai
ec19cf6306 first stage mount: abort when failed to parse fstab in device-tree
The client of FirstStageMount class should check the existence of fstab
in device-tree prior to using it. So raising a FATAL error inside
FirstStageMount when failed to parsing the fstab, in order to expose
more accurate error messages.

Also fixing a comment in fs_mgr, where it might happen in either
non-A/B or A/B.

Bug: 69102431
Test: boot sailfish
Change-Id: Ifb525beaa3423b118644778bfe0f84bff9465303
2017-11-10 12:53:46 +08:00
Treehugger Robot
3d879b10d8 Merge "fs_mgr: support reading fstab based on ro.boot.hardware.platform" 2017-11-01 20:46:22 +00:00
Chih-Hung Hsieh
122352d983 Use -Werror in system/core
* Move -Wall -Werror from cppflags to cflags.
* Fix/suppress warning on unused variables.

Bug: 66996870
Test: build with WITH_TIDY=1
Change-Id: I1e05e96a1d0bcb2ccef1ce456504b3af57167cc5
2017-11-01 11:32:55 -07:00
Oleg Matcovschi
018d7f69da fs_mgr: support reading fstab based on ro.boot.hardware.platform
This change adds fstab.${ro.boot.hardware.platform} file into list of
searched fstab filenames.
The ${ro.boot.hardware.platform} helps consolidate init sequence based
on platform. Potentially it allows same build serve different devices.

Bug: 68663168
Change-Id: I822d5bc432e823218ebc640093cfbe5e9271d3b1
2017-11-01 09:38:21 -07:00
Bowgo Tsai
6353d514e8 Merge "fs_mgr: removing is_device_secure()"
am: af54c27e1b

Change-Id: I22cac8bba9115765527b2c484b4ce9c15fe816cc
2017-10-15 02:48:33 +00:00
Bowgo Tsai
744361fc57 fs_mgr: removing is_device_secure()
Previously there is no vboot 1.0 metadata for ENG builds. It relies on
is_device_secure() to query "ro.secure" and skip setting up dm-verity
if the value is 0 (meaning ENG build).

This change will be submitted together with other changes to add vboot
1.0 metadata for ENG builds with a "disable magic". The resulting
metadata will be the same as triggering an "adb disable-verity" on an
USERDEBUG image.

Bug: 63056044
Test: boot sailfish eng/userdebug builds

Change-Id: I35eef771e1b30bfc6d01b8ed76b40c942fe7b783
2017-10-13 06:34:12 +08:00
Tom Cherry
604f61dcbd Merge "Move some properties users to __system_property_read_callback()"
am: 4a5a337ef2

Change-Id: Ia1553f78fc024d2c43ef9ddb0c191b7fe83a87ff
2017-10-12 17:01:14 +00:00
Tom Cherry
4a5a337ef2 Merge "Move some properties users to __system_property_read_callback()" 2017-10-12 16:53:41 +00:00
Bowgo Tsai
a4b15d7e2c Merge "fs_mgr: removing __BEGIN_DECLS and __END_DECLS"
am: 85b80dc18d

Change-Id: I6c86972b32534f7962656531de072a2ccc654ed8
2017-10-11 01:53:35 +00:00
Tom Cherry
31121cafec Move some properties users to __system_property_read_callback()
This is needed if they will ever handle ro. properties that have
values longer than 92 characters.

Bug: 23102347
Bug: 34954705
Test: read and write properties with value length > 92 characters
Change-Id: I44aa135c97ec010f12162c30f743387810ae2c5d
2017-10-10 15:03:33 -07:00
Bowgo Tsai
d837f837ad fs_mgr: removing __BEGIN_DECLS and __END_DECLS
fs_mgr isn't usable by C now as we've migrated all fs_mgr clients in AOSP
to CPP. Removing the support for C clients.

Bug: 67024518
Bug: 67444051
Test: boot sailfish

Change-Id: Iac57f51eb6a524c6dcdc625c83af75602b4f9b3b
2017-10-10 18:17:29 +08:00
Bowgo Tsai
b08be62fca Merge "fs_mgr_fstab: removing fs_mgr_get_entry_for_mount_point_after()"
am: 16e31801a5

Change-Id: I59b8971b02f59f16082bc48ef96203ef13788277
2017-09-29 08:38:15 +00:00
Bowgo Tsai
c55f188207 fs_mgr_fstab: removing fs_mgr_get_entry_for_mount_point_after()
No fs_mgr client is using fs_mgr_get_entry_for_mount_point_after(), which
supports matching a mount point iteratively by specifying a starting entry
in the fstab. So removes it.

Also switch the public API from C/C++ to C++-only:
    fs_mgr_get_entry_for_mount_point(struct fstab* fstab, const char* path);
==> fs_mgr_get_entry_for_mount_point(struct fstab* fstab, const std::string& path);

Bug: 67024518
Test: boot sailfish, manually test fs_mgr_get_entry_for_mount_point().

Change-Id: I38e18fa6bd9485b6cd31b55474406a511df3f506
2017-09-28 15:28:59 +08:00
Bowgo Tsai
dff1e3418e Merge "fs_mgr_fstab: do an exact match when searching a mount point"
am: a0dd1adab0

Change-Id: If29801d08031c83587e43f981f148f22a675dec5
2017-09-26 23:17:16 +00:00
Bowgo Tsai
cc323958f9 fs_mgr_fstab: do an exact match when searching a mount point
Currently when searching a mount point from a fstab, it checks whether the
mount point of an fstab entry is the prefix of a given path, and the
next char after the match is either '\0' or '/'.

However, it will always return the fstab entry with mount point
"/vendor" when searching path is "/vendor", "/vendor/abc" or "/vendor/cde"
in the following fstab. Because "/vendor" is the prefix of "/vendor/abc"
and "/vendor/cde", and the next char after the match is '/'.

    /dev/block/platform/.../by-name/vendor   /vendor      ext4  ro  wait
    /dev/block/platform/.../by-name/abc      /vendor/abc  ext4  ro  wait
    /dev/block/platform/.../by-name/cde      /vendor/cde  ext4  ro  wait

Fix this by performing an exact match when searching the mount point.

Bug: 63912287
Test: boot sailfish

Change-Id: I504655f5c71790c5d528085de416ce3c30d21fea
2017-09-26 21:06:59 +08:00
Tom Cherry
9bc2a967cf Merge "Reland "Remove comments and code about ro.boot.slot""
am: dea5e081ac

Change-Id: Idf32e9600b6a3b93a6a2b4c414cc0193d5d65fb9
2017-09-26 00:08:55 +00:00
Tom Cherry
211a4a5d5a Reland "Remove comments and code about ro.boot.slot"
This reverts commit c5f5fd430a.

Dependencies are now merged.

Bug: 37663204
Bug: 66437505
Change-Id: I84284b6bc37f6aae4096dec73f45ebd85d28ca9d
2017-09-25 16:04:30 +00:00
Tom Cherry
0ff5f16f7b Merge "Revert "Remove comments and code about ro.boot.slot""
am: eb00b1f3aa

Change-Id: If6b511a19009e28a63b52e6701dbc8f7b1f514f7
2017-09-21 18:46:44 +00:00
Tom Cherry
c5f5fd430a Revert "Remove comments and code about ro.boot.slot"
This reverts commit f4ec2c50a3.

Dependencies hadn't been merged yet.

Bug: 66437505
Change-Id: I7551b7f2f184a6fefc39e184a42dc8d323c58b89
2017-09-21 18:37:22 +00:00
Tom Cherry
bf6168fd53 Merge "Remove comments and code about ro.boot.slot"
am: 7dcf076700

Change-Id: Ic28c5bd369d45489150741b1c1cf2b4c00c4eb52
2017-09-20 19:27:43 +00:00
Tom Cherry
f4ec2c50a3 Remove comments and code about ro.boot.slot
ro.boot.slot_suffix is the correct parameter.

Bug: 37663204
Test: boot sailfish
Change-Id: I72f94b3c611a2280d0732321dd8de88b0530a3cd
2017-09-20 10:14:44 -07:00
Jin Qian
76fd6f6cf1 Merge "fs_mgr: replace make_ext4 api with e2fsprogs"
am: ff9c7c5e3e

Change-Id: I136e627d1a4a9cf72940e0dfbbcc7fa03206de96
2017-09-11 20:55:47 +00:00
Jin Qian
42d8137da8 fs_mgr: replace make_ext4 api with e2fsprogs
Execute mke2fs to create empty ext4 filesystem.
Execute e2fsdroid to initialize selinux context.

Test: zero-out first 4k of data partition and reboot,
      fs_mgr successfully formats /data.
Bug: 35219933
Change-Id: If6f72f62c618c64be703b83f0114a4dd0a2b079f
(cherry picked from commit f71bc0c152)
2017-09-11 18:34:32 +00:00
Bo Hu
5e8de93697 Merge "Allow the use of a custom Android DT directory" am: 6fa0884188 am: 8b2e0e03d4
am: 8bdf7ed10e

Change-Id: I6e924fb7f52650343ba4ae591e09deee6a366905
2017-07-29 07:10:18 +00:00
Bo Hu
8b2e0e03d4 Merge "Allow the use of a custom Android DT directory"
am: 6fa0884188

Change-Id: I1c37cb0c809b2ed51d61e6b1e8ea87830e48eda5
2017-07-29 07:05:18 +00:00
Bo Hu
6fa0884188 Merge "Allow the use of a custom Android DT directory" 2017-07-29 06:58:07 +00:00
Yu Ning
c01022a62e Allow the use of a custom Android DT directory
On platforms that use ACPI instead of Device Tree (DT), such as
Ranchu x86/x86_64, /proc/device-tree/firmware/android/ does not
exist. As a result, Android O is unable to mount /system, etc.
at the first stage of init:

 init: First stage mount skipped (missing/incompatible fstab in
 device tree)

Those platforms may create another directory that mimics the layout
of the standard DT directory in procfs, and store early mount
configuration there. E.g., Ranchu x86/x86_64 creates one in sysfs
using information encoded in the ACPI tables:

 https://android-review.googlesource.com/442472
 https://android-review.googlesource.com/443432
 https://android-review.googlesource.com/442393
 https://android-review.googlesource.com/442395

Therefore, instead of hardcoding the Android DT path, load it from
the kernel command line using a new Android-specific property key
("androidboot.android_dt_dir"). If no such property exists, fall
back to the standard procfs path (so no change is needed for DT-
aware platforms).

Note that init/ and fs_mgr/ each have their own copy of the Android
DT path, because they do not share any global state. A future CL
should remove the duplication by refactoring.

With this CL as well as the above ones, the said warning is gone,
but early mount fails. That is a separate bug, though, and will be
addressed by another CL.

Test: Boot patched sdk_phone_x86-userdebug system image with patched
      Goldfish 3.18 x86 kernel in patched Android Emulator, verify
      the "init: First stage mount skipped" warning no longer shows
      in dmesg.

Change-Id: Ib6df577319503ec1ca778de2b5458cc72ce07415
Signed-off-by: Yu Ning <yu.ning@intel.com>
2017-07-28 11:10:48 +08:00
Lennart Wieboldt
e1332dd01b Merge "Remove LOCAL_CLANG and clang: true" am: 80ec81cf4b am: f7b315c985
am: 8a8b97b271

Change-Id: I7e691abe2e2ccec5d9477c528d603c081c0a5661
2017-07-25 22:35:56 +00:00
Lennart Wieboldt
f7b315c985 Merge "Remove LOCAL_CLANG and clang: true"
am: 80ec81cf4b

Change-Id: Ia7f79d8e25ee9870fe44d198568d0e5dabdff811
2017-07-25 22:28:56 +00:00
Lennart Wieboldt
cd15fc7ba8 Remove LOCAL_CLANG and clang: true
clang is the default compiler since Android nougat

Test: mma & verified it´s still build with clang
Change-Id: I34adaeef2f6558a09f26027271222bad94780507
Signed-off-by: Lennart Wieboldt <lennart.1997@gmx.de>
2017-07-25 14:29:50 +02:00
Keun-young Park
2eba1eb7d2 Merge "fs_mgr:Add filter condition to make sure that the super block is correct." am: 9dd1a12b1e am: bc4c5032fc
am: 29a5cc174c

Change-Id: I84223b5e0cb7bda24cc62377ed88b027b81169f8
2017-07-21 22:46:37 +00:00
Keun-young Park
bc4c5032fc Merge "fs_mgr:Add filter condition to make sure that the super block is correct."
am: 9dd1a12b1e

Change-Id: I8947564ee32cd90ea8f3a7c986426b9c3dbd70af
2017-07-21 20:11:52 +00:00
Keun-young Park
9dd1a12b1e Merge "fs_mgr:Add filter condition to make sure that the super block is correct." 2017-07-21 20:04:15 +00:00
Jin Qian
3f531ac5cf Merge changes from topic 'mke2fs_2'
am: 176827e166

Change-Id: I933e0d96d9c81c5800e4cf406582277b140f3e2b
2017-07-21 19:06:03 +00:00
Treehugger Robot
176827e166 Merge changes from topic 'mke2fs_2'
* changes:
  fastboot: add mke2fs and e2fsdroid to build package
  fastboot: call mke2fs tools to generate ext4 image
  fs_mgr: call format_f2fs correctly with -f
  init: require e2fsdroid and mke2fs when building init
  init: rename mke2fs tools with _static suffix
2017-07-21 19:00:46 +00:00
katao
4e8d73fa0c fs_mgr:Add filter condition to make sure that the super block is correct.
Because full disk encryption make surper block is not except contents. Only
judge the magic number can prevent most of encrypted surper block.
In particular, magic number plaintext may be equal ciphertext. In order to
avoid this situation, we add the judgment of adaptive situation of the
s_rev_level, s_log_block_size and EXT4_INODE_SIZE.

Test: 1. Config fstab,userdata add flags: forceencrypt=footer,reservedsize=128M
      2. build a new target files, and flash all image.
      3. Config encrypt userdata surperblock,set magic number is 0xEF53
      4. reboot system and check log of fs_mgr.
Change-Id: I925584d58f17afabbb3aa91f8be2302518172bb2
Signed-off-by: katao <katao@xiaomi.com>
2017-07-21 11:35:35 +08:00
Jaegeuk Kim
c0d88edfec fs_mgr: call format_f2fs correctly with -f
This patch formats f2fs with -f option.

Change-Id: I3fc415f35d81f22cbf1eadebc619465d36205927
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
(cherry picked from commit 0331c2cf77)
2017-07-20 11:54:47 -07:00
Bowgo Tsai
2e19aa92ed Merge "fs_mgr_verity: allow verification error when the device is unlocked" am: a68f633675 am: 84937296c6
am: e5de94756b

Change-Id: Iedca76aea1c93320bbba29bcd013d1cd331380de
2017-07-20 02:01:05 +00:00
Bowgo Tsai
84937296c6 Merge "fs_mgr_verity: allow verification error when the device is unlocked"
am: a68f633675

Change-Id: Iba60c7f544ae86a1487354a9e799cab7167f37ad
2017-07-20 01:55:04 +00:00
Bowgo Tsai
b674894199 fs_mgr_verity: allow verification error when the device is unlocked
On a A/B device, the image combination in VTS is:
  - system.img (userdebug): provided by Google (system as root)
  - vendor.img (user): provided by the OEM

The generic system.img provided by Google doesn't have /verity_key.
So verified boot will fail when it tries to verify the signature of
vendor.img. This CL allows signature verification error (including
no verity_key) when the device is unlocked.

This CL also changes the return value to FS_MGR_SETUP_VERITY_SKIPPED when
signature verification failed in logging mode. Otherwise, first stage
mount will fail because it assumes verity device initialization should be
successful when receiving FS_MGR_SETUP_VERITY_SUCCESS.

Bug: 63821912
Test: boot generic system.img on a A/B device
Change-Id: I33e5ef753913ae9f0c8b02c518ae94d4c8505611
2017-07-19 18:45:40 +08:00
Tom Cherry
e1442a5df0 Merge changes from topic 'ext4_encryption_flag' am: 5be05733c2 am: 5a6226929e
am: d165de95da

Change-Id: I11ebc6c79bcd5cf6b8fd619b1a71582b7c788d41
2017-07-14 23:18:02 +00:00
Tom Cherry
5a6226929e Merge changes from topic 'ext4_encryption_flag'
am: 5be05733c2

Change-Id: I242f679bb96f9ae71b624db4cbcb54dda5be5ee4
2017-07-14 23:11:43 +00:00
Tom Cherry
5be05733c2 Merge changes from topic 'ext4_encryption_flag'
* changes:
  fs_mgr: set ext4 encryption flag with tune2fs when needed
  fs_mgr: refactor pre-mount logic into prepare_fs_for_mount()
2017-07-14 23:06:30 +00:00
Bowgo Tsai
ec721bdda2 Merge "fs_mgr: trim the terminating '\0' when reading from device tree" am: b76158d56a am: 3205cd6cc4
am: 776c67b4d5

Change-Id: I5cccad6c1d5df0dd0b5505eaf18353c96ba5ea72
2017-07-14 05:26:30 +00:00
Bowgo Tsai
3205cd6cc4 Merge "fs_mgr: trim the terminating '\0' when reading from device tree"
am: b76158d56a

Change-Id: I8498667cfdd266827a936a9e9a0bac50dc9699f4
2017-07-14 05:18:04 +00:00
Bowgo Tsai
f559655912 fs_mgr: trim the terminating '\0' when reading from device tree
Bug: 63637343
Test: boot device
Change-Id: I35ead1ad852493f7f92bdb6c87617fde57b3b0be
2017-07-13 15:11:16 +08:00
Eric Biggers
e9811f36e5 fs_mgr: set ext4 encryption flag with tune2fs when needed
Upstream kernels (v4.9+, v4.4.67+) have started to enforce that
encryption policies cannot be set on ext4 directories unless
EXT4_FEATURE_INCOMPAT_ENCRYPT is set in the filesystem superblock, as
was the original design.  Since Android's userspace was not setting this
flag, it was not possible to use "file-based encryption" (FBE) on
devices whose kernels enforce this constraint.  Fix this by updating
fs_mgr to set the flag if needed, similar to how it enables the quota
feature if needed.

Note that it would, eventually, be simpler to set this flag at mkfs
time.  But that seems infeasible for now, given the many different ways
the userdata filesystem can be formatted --- including via 'fastboot',
which I believe is expected to still be compatible with old devices
whose kernel and/or e2fsprogs don't support the 'encrypt' flag.

Bug: 36231741
Change-Id: Ibafb9a7116fc853b62f8ee074a78499399f290a6
2017-07-06 13:31:30 -07:00
Eric Biggers
8d3bcd4b6a fs_mgr: refactor pre-mount logic into prepare_fs_for_mount()
There were several duplications in the code that runs before a
filesystem is mounted.  This made it difficult to start running tune2fs
to set the encryption feature flag.  Refactor to deduplicate the logic,
and improve the log messages.

Bug: 36231741
Change-Id: I90846dad9c5ec85b3c5460615dec4cc19cb7e198
2017-07-06 13:31:30 -07:00