Commit graph

55232 commits

Author SHA1 Message Date
David Anderson
5924eeb4a4 Merge "overlayfs: Refactor how the scratch device is deduced, again."
am: 81fbcbdbd4

Change-Id: I9799652b1286b20bab8d3ed084da48293146915e
2019-12-30 17:01:22 -08:00
David Anderson
81fbcbdbd4 Merge "overlayfs: Refactor how the scratch device is deduced, again." 2019-12-31 00:24:35 +00:00
Nikita Ioffe
0a1908cdf3 Merge "Reset sys.shutdown.requested property"
am: e6a32d5d90

Change-Id: I750dd7e95b0ca5611a347c13b8aa57d628da0dbb
2019-12-30 12:03:21 -08:00
Treehugger Robot
e6a32d5d90 Merge "Reset sys.shutdown.requested property" 2019-12-30 19:53:52 +00:00
Nikita Ioffe
1131a211dc Reset sys.shutdown.requested property
Otherwise, if userspace reboot is triggered from the framework, it will
end up in userspace reboot loop until watchdog kicks in triggers full
reboot.

Bug: 135984674
Test: adb shell svc power reboot userspace
Change-Id: I0de451aad4ea236a3ff1c20b317b01c6529b6231
2019-12-30 16:06:35 +00:00
Yifan Hong
61051f6fcc Merge "libfiemap: delete unuseful check"
am: d8a8988c6e

Change-Id: I0b714504d8576bdd7a991d613be31417734116c5
2019-12-27 18:57:58 -08:00
Treehugger Robot
d8a8988c6e Merge "libfiemap: delete unuseful check" 2019-12-28 02:55:38 +00:00
Yifan Hong
0ede9b43e5 libfiemap: delete unuseful check
Just let fallocate fails. It also doesn't check for the delta between
the old file and the new file.

Test: unit tests
Change-Id: I05e12b097a973d9fe7fe696cc472bd7ec2d180c7
2019-12-27 15:36:41 -08:00
Steve Muckle
6d46873127 Merge "libmodprobe: parse kernel command line for module options"
am: d1e9812217

Change-Id: I4b9c9aba8229497de7054f7d60aa61f860951fc1
2019-12-27 15:01:52 -08:00
Treehugger Robot
d1e9812217 Merge "libmodprobe: parse kernel command line for module options" 2019-12-27 22:53:32 +00:00
Tom Cherry
ffb8945e59 Merge "liblog: don't destroy global mutexes"
am: 0962561c9b

Change-Id: I3c579a0ebf27f2b552d3fbb07957811fb5fcd447
2019-12-27 14:06:35 -08:00
David Anderson
e790acd6cd Merge "init: Use ImageManager for DSUs."
am: bdaa9afbf2

Change-Id: I22777271ed2d85694154c6d577ddb25718a00549
2019-12-27 14:06:02 -08:00
David Anderson
caad1ad495 Merge "libfiemap: Add a MapAllImages() helper."
am: 4e5b505751

Change-Id: Ie9d838b6b91e6d0aeb289d075a76f626c9c0901f
2019-12-27 14:05:58 -08:00
David Anderson
fa61f9172a Merge "libfiemap: Add a way to get the block device path of a mapped image."
am: 31a35038a0

Change-Id: I143bcfe24cb22e1f36db3b47260ecdc895eb6b5e
2019-12-27 14:05:10 -08:00
Tom Cherry
0962561c9b Merge "liblog: don't destroy global mutexes" 2019-12-27 21:55:59 +00:00
Steve Muckle
373a3cadd7 libmodprobe: parse kernel command line for module options
Bug: 145808811
Test: atest libmodprobe_tests, verify on flame
Change-Id: I0b41b1610fe13ae526d38f029da888f6f0d8a02d
2019-12-27 13:39:23 -08:00
David Anderson
bdaa9afbf2 Merge "init: Use ImageManager for DSUs." 2019-12-27 21:13:51 +00:00
David Anderson
4e5b505751 Merge "libfiemap: Add a MapAllImages() helper." 2019-12-27 21:13:51 +00:00
David Anderson
31a35038a0 Merge "libfiemap: Add a way to get the block device path of a mapped image." 2019-12-27 21:13:33 +00:00
David Anderson
7208d546ef Merge "libfiemap: Add helpers to remove images from recovery."
am: 8edafa2393

Change-Id: Ib6d6237baee5c211869f1b2273f683e4a7ad77b0
2019-12-27 13:01:21 -08:00
David Anderson
8edafa2393 Merge "libfiemap: Add helpers to remove images from recovery." 2019-12-27 20:28:48 +00:00
Matthew Maurer
e6282d9d33 Merge "trusty: storageproxyd: Fix rebase of UFS support"
am: 369dff24da

Change-Id: I0b85cdb6542efd6ca634a110c45d100b39445b6e
2019-12-26 17:00:51 -08:00
Matthew Maurer
369dff24da Merge "trusty: storageproxyd: Fix rebase of UFS support" 2019-12-27 00:39:32 +00:00
Kiyoung Kim
eafc79a135 Merge "Use generated linker config only"
am: 3c0e06d829

Change-Id: I79c3cdb2f34e82e3bdc83b0ea1dfa87735072c04
2019-12-26 16:11:06 -08:00
Kiyoung Kim
3c0e06d829 Merge "Use generated linker config only" 2019-12-27 00:08:06 +00:00
Matthew Maurer
17785fd185 trusty: storageproxyd: Fix rebase of UFS support
The UFS support got rebased on top of the RPMB socket support
improperly. As a result, RPMB socket support was broken due to an
unconditional rmpb_fd = rc which would set the rpmb_fd to be connect()'s
error code in the case of an RPMB socket.

Bug: 146903427
Test: Boot Trusty+Android with the rpmb_dev mock, check for liveness
Change-Id: Ib1220dc49392f1a10369eed7716e44680bd83a66
2019-12-26 15:03:45 -08:00
David Anderson
69def12f08 overlayfs: Refactor how the scratch device is deduced, again.
The previous refactoring did not uncover the full breadth of issues that
arise when trying to use /data for adb remount. In fact, there are a few
distinct use cases for the scratch device, and one function cannot
sensibly provide them all.

(1) First-stage init needs to know if there are dependent devices. This
    would be userdata, super_<other>, or system_<other>. This knowledge
    is dependent on the state in /metadata, fstab, and the kernel
    command-line.

(2) First-stage init and fastbootd need to know where the scratch
    partition is. If it's not in super_<other> or system_<other>, and
    there is no indicator on /metadata, then it might be in a dynamic
    partition.

(3) "adb remount" needs to find a place to put scratch, which
    effectively amounts to the first writable space it can find.
    However, for Virtual A/B, devices, scratch wants to be stored in
    /data, which requires more complex checks and binder calls.

Trying to encapsulate all of this into one function is too difficult, so
instead, this patch breaks GetScratchStrategy into separate functions:
one to return a physical location if a candidate exists, and another to
deduce the "boot" scratch device.

"adb remount" no longer calls GetScratchDevice, since it only needs to
know whether or not a physical candidate was possible.

fs_mgr_overlayfs_teardown calls GetBootScratchDevice, but now only
attempts to make a dynamic "scratch" partition if one definitely exists.
This makes the functionality clearer and reduces fastbootd uart spam.

Bug: 134949511
Test: adb_remount_test.sh on coral
      adb_remount_test.sh on crosshatch
      adb_remount_test.sh on walleye
Change-Id: I5f6a3677bc6adcaaf54c8ab3594643e4f285c04e
2019-12-25 22:32:31 -08:00
David Anderson
d5745cce70 libfiemap: Add a MapAllImages() helper.
This adds a helper for first-stage init to easily map partitions backed
by /data. This can be used for the scratch partition as well as DSU
partitions.

Bug: 134949511
Test: fiemap_image_test
Change-Id: I46246b41ce19442d1476b9959e34df0e1bff58c3
2019-12-25 22:32:31 -08:00
Kiyoung Kim
32082a7e28 Use generated linker config only
Remove prebuilt ld.config.txt to use linker config from generator only,
including legacy and vndk_lite case.

Bug: 139638519
Test: m -j passed

Change-Id: I043d51daca8cde1977236f9fbda919176a18618d
2019-12-24 14:18:53 +09:00
David Anderson
88d4cf28b3 Merge "fs_mgr: Move libfiemap into libfs_mgr, and introduce libfs_mgr_binder."
am: e1c879c816

Change-Id: I1abee7835186287fc660c024068b315b9f3b5f3c
2019-12-23 21:01:58 -08:00
David Anderson
e1c879c816 Merge "fs_mgr: Move libfiemap into libfs_mgr, and introduce libfs_mgr_binder." 2019-12-24 04:37:05 +00:00
Wenhao Wang
fe553d0f11 Merge "Add storageproxyd UFS support"
am: e4d95b77d5

Change-Id: Ib3fc9b2f20e207985c4580c6779361cfbaf73bbc
2019-12-22 14:07:42 -08:00
Wenhao Wang
e4d95b77d5 Merge "Add storageproxyd UFS support" 2019-12-22 22:01:35 +00:00
Greg Kaiser
b9b2ba3550 Merge "fs_mgr: Fix return in error case"
am: 5821125694

Change-Id: I5d164abcdb3185bc9fe416b00e91a1e6ccb1f2eb
2019-12-20 23:03:24 -08:00
Treehugger Robot
5821125694 Merge "fs_mgr: Fix return in error case" 2019-12-21 06:59:02 +00:00
Greg Kaiser
d8fdf60367 fs_mgr: Fix return in error case
We were doing "return -1" in an error case from a function that
returns bool.  Since it's non-zero, this gets implicitly cast to
'true', which almost certainly isn't what we wanted here.

Test: TreeHugger
Change-Id: I76c188c22d907fc425cf4d5b0b1575f640a78ee3
2019-12-20 19:39:16 -08:00
Christopher Ferris
9f36c47cf9 Merge "Fix handling of possible bad gnu_debugdata_size."
am: a6954573ae

Change-Id: I8bbb8ef720b3d7527b31e7af54cb385a622b849f
2019-12-20 18:16:08 -08:00
Christopher Ferris
a6954573ae Merge "Fix handling of possible bad gnu_debugdata_size." 2019-12-21 02:14:03 +00:00
Yifan Hong
454ce6dd43 Merge "libsnapshot: no underscores in test names"
am: 1451e0f14c

Change-Id: I7032df2e021c1aac665602b4a9f4a88e7b439b09
2019-12-20 16:58:13 -08:00
Treehugger Robot
1451e0f14c Merge "libsnapshot: no underscores in test names" 2019-12-21 00:54:25 +00:00
Nikita Ioffe
e813196585 Merge "Unify logic for resetting properties before userspace reboot"
am: 636ad74313

Change-Id: I4eca9ea918d2fa22db467a69cafada09bbd94d52
2019-12-20 16:45:57 -08:00
Nikita Ioffe
636ad74313 Merge "Unify logic for resetting properties before userspace reboot" 2019-12-21 00:41:42 +00:00
David Anderson
734047a231 libfiemap: Add a way to get the block device path of a mapped image.
This is needed for adb remount, to find the scratch device if it is
already mapped. Note that on devices without metadata encryption, this
cannot be done by querying device-mapper, since scratch will be a loop
device.

Bug: 134949511
Test: fiemap_image_test
Change-Id: Ia25d279c6f8a4838be32a8c01aefc67b5ec1e002
2019-12-20 16:41:35 -08:00
David Anderson
f41c7bbb96 libfiemap: Add helpers to remove images from recovery.
ImageManager can map images in recovery, but not delete them, because
/data is not mounted. libsnapshot handles this by storing extra state
files, but this is complex to manage and inconvenient for
fs_mgr_overlayfs.

Instead, this patch introduces two new calls:

 - DisableImage(), which indicates the image should not be used. This is
   implemented by adding a new DISABLED attribute to
   LpPartitionMetadata. CreateLogicalPartitions ignores this flag, and
   thus recovery/fastbootd can disable the scratch partition and
   communicate that it can be deleted. This cannot be called from binder
   since it is intended for recovery/first-stage init only.

 - RemoveDisabledImages(), which walks the images for a given folder on
   /metadata and deletes any that are disabled. This can be called from
   binder.

Note that there is no metadata version bump for this flag. It's
considered to be included in the flag list for minor version 1, and
currently is not used for the actual super partition.

Bug: 134949511
Test: adb remount, fastboot flash system
Test: fiemap_image_test
Change-Id: Iaeca2d1eddb5637dd9a20202cafd11ae60b4d0e3
2019-12-20 16:41:35 -08:00
David Anderson
43482de3f9 fs_mgr: Move libfiemap into libfs_mgr, and introduce libfs_mgr_binder.
This eliminates libfiemap as a standalone library and instead bundles it
into libfs_mgr. All consumers of libfiemap need libfs_mgr, and having
them tightly coupled reduces linkage complexity.

When to use libfs_mgr: In recovery, first-stage-init, or when libfiemap
or overlayfs is not used.

When to use libfs_mgr_binder: When not in recovery/first-stage init, and
overlayfs or libfiemap is needed. In this case, IImageManager will proxy
over binder to gsid.

Bug: 134949511
Test: builds, fiemap_writer/image_test passes.
Change-Id: I4c1a5698afdbf9b3bf87accec98254c1fb6f4e0e
2019-12-20 16:41:34 -08:00
Tom Cherry
ee747e7dfa liblog: don't destroy global mutexes
Some objects may log when they're destructed, so don't destroy the
global std::mutex in fake_log_device.cpp.

Test: AAPT works with a log in VectorImpl::finish_vector()
Change-Id: Ie5a0ac9fc4e6a137e9516059a831e499d55d5ddb
2019-12-20 16:13:00 -08:00
Wenhao Wang
ce2f1a4761 Add storageproxyd UFS support
This CL enables storageproxyd to run on UFS device.
The proxy prepares and sends SECURITY PROTOCOL IN/OUT commands to UFS
device.

Bug: 143636526
Test: Trusty storage tests
Change-Id: Ibe16578c12b978c9a95deccfb1873081e8d0e994
2019-12-20 15:44:51 -08:00
Nikita Ioffe
018ddd7a6f Unify logic for resetting properties before userspace reboot
Since I was there, added two more properties to reset, and switched
ordering of sys.init.updatable_crashing and
sys.init.updatable_crashing_process_name setprops to make sure that
process name is already set when apexd/PackageWatchdog get's notified
about sys.init.updatable_crashing.

Also fixed a typo in what HandleUserspaceReboot function.

Test: adb reboot userspace
Bug: 135984674
Change-Id: I954ec49aae0734cda1bd833ad68f386ecd808f73
2019-12-20 17:55:13 +00:00
Steven Moreland
0b955f333d Merge "libutils: sp/wp: undef #defines"
am: d5c3fe6952

Change-Id: I7316502cc50efd08247d8f6f5a0b2ba16bbb3a48
2019-12-20 09:09:24 -08:00
Steven Moreland
d5c3fe6952 Merge "libutils: sp/wp: undef #defines" 2019-12-20 16:53:28 +00:00