Commit graph

1055 commits

Author SHA1 Message Date
Yifan Hong
789d905b50 Merge "Add none to supported fs type" 2019-01-07 18:26:19 +00:00
Treehugger Robot
32b695daa7 Merge changes from topic "fiemap-writer-1"
* changes:
  fiemap_writer: enforce filesystem optimal block size alignment
  fiemap_writer: Fix file pinning / pinning status check code.
2019-01-07 01:48:46 +00:00
Bowgo Tsai
a99a1f275c Skip building libfs_avb unittest for Mac
Bug: 117960205
Test: m libfs_avb_host_unittest
Change-Id: Ib53efe3e36a3f70134b2431c2c0bfed52fdd3df6
2019-01-06 13:41:45 +08:00
Sandeep Patil
eb28e0c44b fiemap_writer: enforce filesystem optimal block size alignment
... instead of using the block size from the underlying block device.

Bug: 121211685
Test: fiemap_writer_test /dev/block/sda21 (on blueline)

Change-Id: I6038d3f06505a397280b0482e33814b4883be9a2
Signed-off-by: Sandeep Patil <sspatil@google.com>
2019-01-05 17:38:31 -08:00
Sandeep Patil
d2b2e21f59 fiemap_writer: Fix file pinning / pinning status check code.
The IsFilePinned() function is still not being called because I am still
seeing # blocks moved when I run following test on
aosp_blueline-userdebug.

 $ fiemap_writer_test /dev/block/sda21 \
 --gtest_filter=FiemapWriterTest.CheckWriteError

Bug: 122138114
Test: fiemap_writer_test /dev/block/sda21

Change-Id: I08d74093a082674d621772d202143d2f32e7c665
Signed-off-by: Sandeep Patil <sspatil@google.com>
2019-01-05 15:29:54 -08:00
Treehugger Robot
0dd3725982 Merge "Adding libfs_avb unittest framework" 2019-01-05 10:57:13 +00:00
Treehugger Robot
aed2ee9664 Merge "fs_mgr_avb: introducing class VBMetaData" 2019-01-05 06:41:14 +00:00
Yifan Hong
ea1c779067 Add none to supported fs type
Test: mount sdcard in recovery on cuttlefish
Change-Id: I23b0ce418f8240cfdaa2d560678989067d746de6
2019-01-04 15:28:30 -08:00
David Anderson
126e481972 liblp: Allow GSI metadata to bypass slot suffixing checks.
Bug: 121210348
Test: manual test
Change-Id: I40634c72b0255197a5c16e23553f4cf54bc32579
2019-01-03 18:19:43 -08:00
David Anderson
189727089e liblp: Add API for adding predetermined linear extents to partitions
Bug: 121210348
Test: manual test
Change-Id: Ie9af456d5193e962a3bcf0cc5dcd22e794d143f6
2019-01-03 18:18:45 -08:00
Sandeep Patil
ac535f9713 Merge "fiemap_writer: First cut implementation with write() support." 2019-01-03 15:56:15 +00:00
Bowgo Tsai
b92fc1f423 fs_mgr_avb: introducing class VBMetaData
Currently vbmeta images are stored in AvbSlotVerifyData defined in
libavb, which contains some fields that isn't needed by fs_mgr.
e.g., loaded_partition, rollback_indexes. Adding a new class VBMetaData
to replace it.

Bug: 112103720
Bug: 117960205
Test: boot crosshatch
Change-Id: I480461dad3c6aca7e028097662a3b06c3aa6646d
2019-01-03 18:17:56 +08:00
Bowgo Tsai
583540330c Adding libfs_avb unittest framework
This commit adds the fundamental test framework for the upcoming
changes in libfs_avb. It replies on 'avbtool' to append AVB
metadata and then extracts the vbmeta content into an internal
|vbmeta_images_| variable for comparison later.

Bug: 117960205
Test: m libfs_avb_host_unittest
Test: ./out/host/linux-x86/nativetest/libfs_avb_host_unittest/libfs_avb_host_unittest
Test: atest --rebuild-module-info
Test: atest libfs_avb_host_unittest

Change-Id: I0cb8e8f04bc4b8628576565e7ff1920d7c81ecac
2019-01-02 09:58:08 +00:00
Sandeep Patil
faa257ee0f fiemap_writer: First cut implementation with write() support.
The library is meant to help write to a file using its FIEMAP and the
raw block device.

Bug: 121211685
Test: fiemap_writer_test /data/local/tmp/foo.raw /dev/block/sda21
Test: fiemap_writer_test /data/local/tmp/foo.raw /dev/block/sda21 1073741824
Test: fiemap_writer_test /data/local/tmp/foo.raw /dev/block/sda21 \
      --gtest_filter=FiemapWriter.CheckBlockDevicePath
Test: fiemap_writer_test /data/local/tmp/foo.raw /dev/block/sda21 32768 \
      --gtest_filter=FiemapWriter.CheckWriteError
Test: fiemap_writer_test /data/local/tmp/foo.raw /dev/block/sda21 \
      --gtest_filter=VerifyBlockWritesExt4.CheckWrites
Test: fiemap_writer_test /data/local/tmp/foo.raw /dev/block/sda21 \
      --gtest_filter=VerifyBlockWritesF2fs.CheckWrites

Change-Id: I7b580afddc829c1064ebb52b7a6c7600a2fb2772
Signed-off-by: Sandeep Patil <sspatil@google.com>
2018-12-29 11:11:30 -08:00
Treehugger Robot
16845e6c51 Merge "dmctl: Add verbose 'dmctl list devices'" 2018-12-27 20:38:30 +00:00
Sandeep Patil
e9f8eb46e3 Remove unnecessary warning suppression from libdm.
Fixes: 110035986
Test:  mma -j builds without errors or warnings

Change-Id: Id00f844ad75c3ee2ebb9f47eebc7976bc40bdf59
Signed-off-by: Sandeep Patil <sspatil@google.com>
2018-12-20 09:31:05 -08:00
Yifan Hong
3fff9fbe00 Merge changes from topic "vintf_object_recovery_mount"
* changes:
  Move parts of roots.cpp from librecovery
  fs_mgr_do_mount_one: allow overriding mount_point
2018-12-19 22:19:52 +00:00
Yifan Hong
bf80e7dd91 Move parts of roots.cpp from librecovery
Move some mounting functionalities from librecovery so that
other modules can also mount logical partitions correctly.

- Also, refactor to use C++ Fstab struct.
- Also, fixed CreateLogicalPartitions() to take full path of
super device.

Test: run recovery tests
Test: vintf_object_recovery_test

Bug: 118634720
Bug: 113182233
Bug: 62292478
Change-Id: Ie02c3a941ed801fdae5818099faf5f3863444296
2018-12-19 10:23:50 -08:00
Yifan Hong
0cd2d5f048 fs_mgr_do_mount_one: allow overriding mount_point
Test: boots
Bug: 118634720
Change-Id: Ie2d05fdead27bfb1c922749272ff648bc7c418d1
2018-12-19 10:23:50 -08:00
Ruslan Trofymenko
23249c9fc5 fs_mgr: Fix kernel command line parsing
Remove new line character ('\n') from the kernel command line after
reading from '/proc/cmdline'. This character is not contained in the
original string and is added as a result of reading (according to
kernel source codes [1]):

    ...
    seq_puts(m, saved_command_line);
    seq_putc(m, '\n');
    ...

As a result, this may corrupt the last argument of the string. For
example, if the last argument is 'androidboot.slot_suffix=_a', then the
target partition ('vendor_a\n') will not be found in fstab section of
the device tree.

[1] fs/proc/cmdline.c

Change-Id: I96a853f1f55f27d782afe2ca8c0b006a75368149
Signed-off-by: Ruslan Trofymenko <ruslan.trofymenko@linaro.org>
2018-12-19 20:03:10 +02:00
Sandeep Patil
2d04ce3b5a dmctl: Add verbose 'dmctl list devices'
This adds an option to list device mapper devices including their
current target table. Useful to be included in bugreport to
map the logical partitions metadata with actual device mapper setup.

Bug: 120916687
Test: dmctl list devices -v

Change-Id: I091666506d24372d1e111ffa1c0256c8bbff0c5e
Signed-off-by: Sandeep Patil <sspatil@google.com>
2018-12-19 08:51:59 -08:00
Mark Salyzyn
38a17f0d76 fs_mgr: overlayfs: test issues with single super device
Cleanup test issues with single super device.  Indicate mount point
instead of partitions as that can lead to confusion when referencing
the partition when there is none.  For example root (/) partition
uses overlay on /system.  Resolve a script syntax error when there
are no devices.  Fix script logic surrounding detection of overlayfs
takeover and handling of reboot device request from
adb disable-verity.

In README.overlayfs.md discuss
BOARD_<partitiion>IMAGE_PARTITION_RESERVED_SIZE and its negative
impact on right sizing.

Soften README.overlayfs.md wording with respect to update_engine
to match changes in handling.

Test: adb-remount-test.sh
Bug: 120536582
Bug: 109821005
Change-Id: Iad7e19a436322ff9c3bdc597f4545028be112ff5
2018-12-17 11:26:03 -08:00
Treehugger Robot
567c45e10e Merge "Fix sign-compare warnings" 2018-12-17 00:51:13 +00:00
Yi Kong
e93040c618 Fix sign-compare warnings
system/core/fs_mgr/fs_mgr_fstab.cpp:161:18: error: comparison of integers of different signs: 'int' and 'const uint64_t' (aka 'const unsigned long') [-Werror,-Wsign-compare]
        if (flag == j->flag) {
            ~~~~ ^  ~~~~~~~

system/core/fs_mgr/fs_mgr.cpp:674:11: error: comparison of integers of different signs: 'int' and 'std::__1::vector<FstabEntry, std::__1::allocator<FstabEntry> >::size_type' (aka 'unsigned long') [-Werror,-Wsign-compare]
    if (i < fstab.size()) --i;
        ~ ^ ~~~~~~~~~~~~

Test: m checkbuild
Change-Id: I056add222a92f99134a49ac141bd143ddd54179b
2018-12-14 16:02:38 -08:00
Treehugger Robot
010a85afe5 Merge "fs_mgr: overlayfs: test w/o sepolicy in enforced mode" 2018-12-14 22:27:17 +00:00
Bowgo Tsai
4c80edf9cd fstab: allow mounting other slot
Adding a new fs_mgr flag 'slotselect_other' to mount _b when _a is
active, or vice versa.

Bug: 113182233
Bug: 112103720
Test: `mount_all fstab.test` with one line using `slotselect_other`.

Change-Id: I96c63141df7722dc30ca9817b0b154e493b9eef9
2018-12-14 05:50:21 +00:00
Treehugger Robot
42c9e7e393 Merge "fs_mgr: overlayfs: test inAdb and inFastboot" 2018-12-14 04:12:12 +00:00
Mark Salyzyn
436464ab71 fs_mgr: overlayfs: test w/o sepolicy in enforced mode
Skip sepolicy test if device is not in enforcing mode.

Test: adb-remount-test.sh
Change-Id: I1558674819bda0c9f575d5202f693fec55c9d84f
2018-12-13 16:48:41 -08:00
Mark Salyzyn
f7572ec8ff fs_mgr: overlayfs: test inAdb and inFastboot
If no serial number is supplied, then check if there is 0 devices

Test: adb-remount-test.sh
Change-Id: Ie78c379078d3d99d67594a5be1a22795bfcc6d36
2018-12-13 16:19:35 -08:00
Tom Cherry
6bbe9477f3 fs_mgr: allow boot_devices to be supplies on the kernel commandline
boot_devices in device tree is our last remaining device tree entry
for specifying the kernel commandline.  Since this doesn't make sense
to be included in the fstab, especially as there is no way to
differentiate between different boot devices within a single device
tree as some devices do, it is moved to the kernel commandline.

Bug: 117933812
Test: boot blueline without boot_devices in DT
Change-Id: If498836ae2ef14e68ff761338ef352c20c4a7b3d
2018-12-13 11:13:28 -08:00
Tom Cherry
41216e591b Merge "Allow specifying vbmeta/parts via fstab" 2018-12-13 18:24:34 +00:00
Treehugger Robot
8f3ed62422 Merge changes Ic9957cb3,If7ae257c
* changes:
  fs_mgr: adb-remount-test in non overlayfs world
  fs_mgr: errno handling in fs_mgr_overlayfs_setup()
2018-12-13 15:32:14 +00:00
Mark Salyzyn
da27fa0b53 fs_mgr: adb-remount-test in non overlayfs world
Extend test script to check non overlayfs case too.  Establish
whether overlayfs is supported, or needed, and adjust expectations.
For the flash vendor code, make sure it is the _right_ vendor,
skip instead of fail.

Improve quality of the testing and handle more cases.

Test: adb-remount-test.sh
Bug: 109821005
Change-Id: Ic9957cb378d8e7737ffc4ba04078c1cb6bbd1bbd
2018-12-12 14:21:42 -08:00
Mark Salyzyn
d202c55453 fs_mgr: errno handling in fs_mgr_overlayfs_setup()
Do not report errno if ENOENT or ENXIO as it is expected when verity
is in fact disabled or not setup on platform.

Reading the default fstab can also result in ENOENT if fstab or dt
are missing on purpose, but if we get an fstab then restore the
errno as we move on.

fs_mgr_has_shared_blocks sets errno, when all we care about is yes
or no answer (EPERM notwithstanding, which indicates do not know).

If no candidates are found to override, and not caused by EPERM,
then suppress errno.

Test: adb-remount-test.sh
Bug: 109821005
Change-Id: If7ae257cb6b738a64ba43d32805760cc292b2fae
2018-12-12 14:21:10 -08:00
Tom Cherry
de545a4bb3 Allow specifying vbmeta/parts via fstab
We want to move all information required for first stage mount into
the first stage ramdisk instead of using device tree.  A previous
change allowed reading the fstab from the first stage ramdisk, but
'vbmeta/parts' was still in device tree.  This change allows
specifying the required vbmeta/parts information in the fstab.

The new syntax is that instead of simply specifying 'avb' as an fs_mgr
option, a partition may specify 'avb=<vbmeta partition name>' and that
vbmeta partition will also be initialized by first stage init before
attempting to mount any devices.

Bug: 117933812
Test: boot crosshatch without device tree fstab
Change-Id: Ida1a6da988c10d364b3ccdaa6c5d63e5264d1b27
2018-12-12 13:58:44 -08:00
Tom Cherry
898b642d8a fs_mgr: remove -Wno-unused-variable from cflags
Don't know why this was ever specified, but seems reasonable to remove
it now that we're so close.

Test: build
Change-Id: Ia8d056cd1c9660b3c22531317098ace78e661d6a
2018-12-12 10:30:10 -08:00
Treehugger Robot
fe3becb56b Merge "Fix performance-for-range-copy warnings" 2018-12-12 17:46:46 +00:00
Tom Cherry
07eea062d5 Merge "Start using new C++ Fstab class widely" 2018-12-12 17:42:45 +00:00
Tom Cherry
23319ebebf Start using new C++ Fstab class widely
Bug: 62292478
Test: boot
Test: adb-remount-test.sh

Change-Id: Id4715af4c1f03e2cfc67de92d3ea58e933685e51
2018-12-12 17:08:09 +00:00
Greg Kaiser
eefd2e9006 fs_mgr_fstab: Add Adiantum support
Adiantum is a crypto method Android is supporting for devices
which don't have AES CPU instructions.  See the paper
"Adiantum: length-preserving encryption for entry-level processors"
(https://eprint.iacr.org/2018/720.pdf) for more details.

We add Adiantum to our list of supported encryption modes.

Bug: 112010205
Test: Tested on a device
Change-Id: I14a400164803a1e217d378ad9bd8b67a61b8b7d0
2018-12-11 15:39:09 -08:00
Chih-Hung Hsieh
1b7b7979af Fix performance-for-range-copy warnings
Bug: 30413223
Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,performance*
Change-Id: I3ad102f2b0f971266d57488a3bd57d312f7ee3e6
2018-12-11 10:51:13 -08:00
David Anderson
0059bc76c3 Merge "liblp: Reclaim wasted space from unaligned partitions." 2018-12-11 00:35:42 +00:00
David Anderson
dccfdca1e1 liblp: Reclaim wasted space from unaligned partitions.
When allocating a partition with a size that is unaligned (to the
optimal alignment), the remaining sectors are wasted since they are
never reallocated. This is because the free list is guaranteed to only
contain optimally-aligned regions. Unfortunately this means when a
partition is resized, we are wasting a small amount of space each time.
On a non-A/B device, this could wind up being significant.

For example, with an alignment of 512KiB, a 4KiB partition at offset 0
will waste 508KiB of space. The next extent to be allocated by any
partition will start at the next 512KiB.

To address this, we round up extents to the optimal alignment. This
means partitions may wind up slightly over-allocated, versus before,
where they would waste space by making it unavailable.

Bug: 120434950
Test: liblp_test gtest
Change-Id: I555209b301058555526cc4309f7049ae81cf877d
2018-12-10 12:53:52 -08:00
Tom Cherry
298fd6d956 fs_mgr: fix typo
Bug: 62292478
Test: boot
Change-Id: I6bbb6190cb92dcd7f71c16494ea2f2b4871b8b0f
2018-12-10 10:58:38 -08:00
Tom Cherry
1fcf7f7d1f Merge "fs_mgr: use std::string in more places" 2018-12-10 17:34:23 +00:00
Tom Cherry
02eff5cccd Update fs_mgr_update_verity_state() for new C++ Fstab
Bug: 62292478
Test: boot and check verity state
Change-Id: I4912a16ada9a6d72480d7ac905654b764c5d18b6
2018-12-07 14:14:54 -08:00
Tom Cherry
c3e7bd3b32 fs_mgr: use std::string in more places
This will ease the transition in the future to using an Fstab struct
that uses std::string instead of char*.

Bug: 62292478
Test: boot

Change-Id: I170db74c2eb6dc16bd21fe65d7e7c685ce5c8b11
2018-12-07 12:35:46 -08:00
Mark Salyzyn
215d1d510e Merge changes I368d3a56,Idb769991,Ia158b6ed
* changes:
  fs_mgr: overlay: use alternate for backing storage
  fs_mgr: overlay: split out fs_mgr_overlayfs_create_scratch()
  fs_mgr: overlay: split out fs_mgr_overlayfs_make_scratch()
2018-12-06 15:26:47 +00:00
Treehugger Robot
323ca1ea6b Merge "fs_mgr: Add fs_mgr_overlayfs_is_setup()" 2018-12-06 01:01:06 +00:00
Mark Salyzyn
f269312466 fs_mgr: overlay: use alternate for backing storage
When we have multiple physical super partitions, it is prudent to
take the alternate super physical partition in its raw entirety
rather than to construct a logical partition out of the current
super partition's limited remaining space.

SideEffect: alternate boot partitions destroyed for the sake of debug
Test: adb-remount-test.sh (including manually disabled to check
      both code paths).
Bug: 119885423
Change-Id: I368d3a5619f69de3b0d1fcad73c4b42d25d0d969
2018-12-05 14:01:59 -08:00