Commit Graph

55109 Commits

Author SHA1 Message Date
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
Treehugger Robot d1e9812217 Merge "libmodprobe: parse kernel command line for module options" 2019-12-27 22:53:32 +00: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 8edafa2393 Merge "libfiemap: Add helpers to remove images from recovery." 2019-12-27 20:28:48 +00:00
Matthew Maurer 369dff24da Merge "trusty: storageproxyd: Fix rebase of UFS support" 2019-12-27 00:39:32 +00: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 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 e1c879c816 Merge "fs_mgr: Move libfiemap into libfs_mgr, and introduce libfs_mgr_binder." 2019-12-24 04:37:05 +00:00
Wenhao Wang e4d95b77d5 Merge "Add storageproxyd UFS support" 2019-12-22 22:01:35 +00: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 a6954573ae Merge "Fix handling of possible bad gnu_debugdata_size." 2019-12-21 02:14:03 +00:00
Treehugger Robot 1451e0f14c Merge "libsnapshot: no underscores in test names" 2019-12-21 00:54:25 +00: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 d5c3fe6952 Merge "libutils: sp/wp: undef #defines" 2019-12-20 16:53:28 +00:00
Kiyoung Kim 5bc7941be3 Merge "Remove ld.config.recovery.txt build" 2019-12-20 07:10:29 +00:00
Treehugger Robot d4502115ad Merge "Add system_ext/apex/*/bin to fs_config" 2019-12-20 04:45:40 +00:00
Kiyoung Kim 80416f7a80 Merge "Generate linkerconfig per mount namespaces" 2019-12-20 03:30:33 +00:00
Christopher Ferris 8726d3a448 Fix handling of possible bad gnu_debugdata_size.
Rather than use a std::vector for backing memory, allocate the memory
using a new with nothrow, and in MemoryBuffer use realloc. Since
the size field is coming from the elf, it could be corrupted or
intentionally crafted to cause problems.

In addition, add some other protections to make sure that overflows
don't occur.

Bug: 146215949

Test: Ran unit tests with jemalloc and scudo to verify that they
Test: both behave the same way.
Change-Id: If14243ce382ba5403a6bacd0ec673452c6b7c3be
2019-12-19 16:48:15 -08:00
Kiyoung Kim e4d3f2123f Generate linkerconfig per mount namespaces
There are two namespaces from init - bootstrap and default - and those
will have different set of APEX modules. To support difference between
two namespaces, linker config should be generated per namespace and each
namespace should use its own linker configuration. As a first step of
the work, this change will create different mount point for each
namespace, and re-generate linker config after APEX mount from each
namespaces.

Bug: 144664390
Test: m -j passed & tested from cuttlefish
Change-Id: Iac2e222376ec4b0ced6c29eed18b21d39ff0b1ba
2019-12-20 09:46:59 +09:00
Treehugger Robot e8537ccfa2 Merge "TEST_MAPPING: add libmodprobe_tests to presubmit" 2019-12-20 00:38:44 +00:00
Treehugger Robot e2e2b2d3d3 Merge "Fix error checking in append_string" 2019-12-20 00:38:25 +00:00
Steven Moreland 243f57bb82 libutils: sp/wp: undef #defines
Seems these undefs are slightly out of sync/out of date.

Bug: N/A
Test: libutils_test
Change-Id: I884ae1ca97754a6459a2c7844264f513eecddaba
2019-12-19 16:17:33 -08:00
Nikita Ioffe ee08c978d2 Merge "Now for real unmount bind-mounts on top of /data" 2019-12-20 00:01:28 +00:00
Nikita Ioffe c9d8d2b7aa Merge "Don't proceed with userspace reboot if device doesn't support it" 2019-12-19 23:44:06 +00:00
Treehugger Robot a275bc4b6a Merge "Merge libstatspush_compat and libstatssocket_q" 2019-12-19 23:31:55 +00:00
Treehugger Robot 0a31673879 Merge changes from topic "StatsEvent JNI"
* changes:
  Improve stats_event memory usage
  StatsEventCompat
  Remove libstats/Android.bp
  Make stats_event write function parameters const
  Create stats_buffer_writer
2019-12-19 23:31:48 +00:00
Ruchir Rastogi 3bbc240263 Fix error checking in append_string
Test: m -j
Change-Id: Ifa806d5037acb17f83cbf45712e9795d6f56152f
2019-12-19 14:57:10 -08:00
Nikita Ioffe 3d6a5fcb87 Now for real unmount bind-mounts on top of /data
Approach in
https://android-review.googlesource.com/c/platform/system/core/+/1191457
depended on ordering of entries. Instead fs_mgr now tries to unmount
everything with the same block device as /data until timeout is reached.
This is very similar to what is done in UmountPartitions in reboot.cpp,
but I'm a little bit reluctant to merge them together, since the later
unmount all read-write partitions, while here we are only interested in
/data.

Test: on both coral and blueline:
Test: adb shell /system/bin/vdc checkpoint startCheckpoint 1
Test: adb shell setprop sys.init.userdata_remount.force_umount_f2fs 1
Test: adb reboot userspace
Test: verified that userdata was remounted
Bug: 135984674
Change-Id: I929a058fa2f9639f0a2b73e9ea269cf1e07db889
2019-12-19 21:18:42 +00:00
Josh Gao 27fa358d41 Merge "adb: use poll instead of select in shell_service." 2019-12-19 20:22:13 +00:00
Steve Muckle e5b327385e TEST_MAPPING: add libmodprobe_tests to presubmit
Bug: 143884053
Test: atest libmodprobe_tests
Change-Id: I0050ebab3ff7c994bd7a67229db9b0a2c8ed8e09
2019-12-19 19:17:08 +00:00
Jooyung Han 08792eb5de Add system_ext/apex/*/bin to fs_config
Flattened APEXes can be installed in /system_ext.
Especially, GSI have both flattened/unflattened apexes so that it can
run with updatable devices and non-updatable devices as well.

Bug: 145963716
Test: flash GSI on P device and boot
Change-Id: I3a941672446a5353517243a851739a66f4252617
2019-12-20 03:54:57 +09:00
Yifan Hong be230af10b libsnapshot: no underscores in test names
This is required for gtest.
Test: run it

Change-Id: I9b0d7ee651c283c00035104d4257d8e8addf4db0
2019-12-19 10:45:54 -08:00
Songchun Fan a1344fa6d7 Merge "[incremental] create /data/incremental in init.rc" 2019-12-19 18:14:06 +00:00
Treehugger Robot 0ba7842577 Merge "Create libstatssocket_q" 2019-12-19 17:36:08 +00:00
Peter Collingbourne 1d789eb210 Merge "Stop using weak symbols in libvndksupport." 2019-12-19 17:27:37 +00:00
Kiyoung Kim 986e453d9c Remove ld.config.recovery.txt build
Remove ld.config.recovery.txt build as this will be replaced to be
generated from linkerconfig during build time.

Bug: 146414198
Test: m -j passed
Test: Checked linker config generated under recovery's system/etc
Change-Id: I0d2aa121973c4c99e68f44f4e76e4eab74dc2f95
2019-12-19 16:37:43 +09:00