Commit Graph

44588 Commits

Author SHA1 Message Date
Matthew Maurer 2ba61b775a Merge "Add support for RPMB over VirtIO Serial" 2019-03-07 21:30:56 +00:00
David Anderson e9223204d3 Merge "Add write support to SplitFiemap." 2019-03-07 19:55:48 +00:00
David Anderson 1c1850fad2 Merge "Create /metadata/password_slots during boot." 2019-03-07 16:20:01 +00:00
Treehugger Robot e820afdadb Merge "Don't defer zygote" 2019-03-07 13:59:17 +00:00
Jiyong Park 1a789db2e3 Don't defer zygote
Removing 'updatable' from zygote as zygote is started after apexd. All
APEXes are guaranteed to be activated at the moment.

Sequence of actions:
1) /data mounted. post-fs-data is triggered.
2) apexd starts. APEXes are activated. Init does not execute more
commands until the activation finishes.
3) all post-fs-data sections from other *.rc are executed.
4) zygote-start is triggered.

Bug: 123404717
Bug: 126555629
Bug: 125549215
Test: device boots
Test: no following message on the logcat log
Could not restart 'zygote': Cannot start an updatable service 'zygote' before configs from APEXes are all loaded. Queued for execution.

Merged-In: Ib4d0716ed5225b6ade3adaa247ff6140a9b2b9d5
Change-Id: Ib4d0716ed5225b6ade3adaa247ff6140a9b2b9d5
(cherry picked from commit 3bddd540dd)
2019-03-07 22:21:32 +09:00
Treehugger Robot 96dc80f97a Merge "Make /apex on ramdisk" 2019-03-07 05:03:05 +00:00
David Anderson 6b4b265abf Add write support to SplitFiemap.
This adds few new methods to introduce write support to SplitFiemap:

(1) Write(), which has an internal cursor to stream data into the split
    files. As the end of one file is reached, the next is opened.
(2) Flush(), which calls fsync() on each internal FiemapWriter.
(3) HasPinnedExtents(), which calls the same on each internal
    FiemapWriter.

Included are some tests for edge cases in Write().

Bug: 126230649
Test: fiemap_writer_test gtest
Change-Id: I9fd509215975dbbb20a44b020315d3c1b287d1a0
2019-03-06 19:32:20 -08:00
Josh Gao 98efc485de Merge "adbd: cleanups in remount/verity." 2019-03-07 02:32:42 +00:00
Jiyong Park e5dc674a95 Make /apex on ramdisk
Bug: 127576519
Bug: 127653919
Test: build hikey, check ramdisk has /apex directory
Change-Id: I4e844caa032c0717bd36d323675852ce3681fb01
2019-03-07 11:17:44 +09:00
Sudheer Shanka 0c8b8af74a Merge "Allow callers to pass a flag to not link obb dirs of multiple users." 2019-03-07 00:34:59 +00:00
Tao Bao a3d394e9bb Merge "mkbootimg: extract to 'second' if size not 0" 2019-03-06 22:43:33 +00:00
Treehugger Robot 6bd04c1570 Merge changes I3506c8e7,I198c0e8c,I8a5d4e36
* changes:
  fs_mgr: remount: automatically disable verity
  fs_mgr: remount: pull root device from fstab
  fs_mgr: test: track device active slot throughout
2019-03-06 21:53:52 +00:00
Josh Gao 3ed90b75da adbd: cleanups in remount/verity.
1. Don't clear O_CLOEXEC on an fd we're duping to stdin/out/err: dup2
   does that for us if oldfd != newfd, and we know the fd can't be
   stdin/out/err.
2. Use unique_fd.
3. Remove gotos by breaking the remount logic into its own function.

Test: mma
Change-Id: If9929e7f20de445322fd498e1379a2d4e572cb52
2019-03-06 13:03:30 -08:00
Treehugger Robot 51deeb569f Merge "Access apex sysprops via the generated API" 2019-03-06 17:38:46 +00:00
Florian Mayer 30c898f1ca Merge "Fix copy / move behaviour of Maps object." 2019-03-06 16:31:10 +00:00
Mark Salyzyn 6a26b4b74d fs_mgr: remount: automatically disable verity
Disable verity even if -R flag is not supplied.

Test: adb-remount-test.sh
Bug: 127494168
Change-Id: I3506c8e7d5525ca1d0685004c1fb7e26448fa648
2019-03-06 08:25:36 -08:00
Mark Salyzyn 3babd8488b fs_mgr: remount: pull root device from fstab
For devices that do not support overlayfs that are system as root,
need to pull /dev/root device from / mount point in fstab.

Test: adb-remount-test.sh
Bug: 126256072
Change-Id: I198c0e8c60770508737318afde95db2966294ff5
2019-03-06 08:25:36 -08:00
Mark Salyzyn 448fc9783c fs_mgr: test: track device active slot throughout
Report any discrepancy in the active slot.

Fix a problem with problematic error propagation for adb_cat()

Test: adb-remount-test.sh
Bug: 126256072
Change-Id: I8a5d4e364945c5e60d252333886987b8dca0cfb3
2019-03-06 08:25:36 -08:00
Yuvraj Saxena ff5e99a6cd mkbootimg: extract to 'second' if size not 0
Change-Id: I5f6804be6372371d51d5757f6a5700c07ed5e57f
2019-03-06 14:23:02 +00:00
David Anderson 0664f31dd0 Create /metadata/password_slots during boot.
This directory is used to store the Weaver/GateKeeper slot map so GSIs
do not overwrite host keys in secure storage.

Bug: 123716647
Test: /metadata/password_slots exists after boot
Change-Id: Ib0ca13edec38e68cba1fc2124465571feedc4be7
2019-03-05 22:18:14 -08:00
David Anderson 5a465412b1 Merge "Use distinct GateKeeper userids when running a GSI." 2019-03-06 02:40:03 +00:00
Matthew Maurer 57ba8c58fc Add support for RPMB over VirtIO Serial
In order to test Trusty gatekeeper automatically, the storage proxy
needs to be active inside the emulator. This patch allows storageproxyd
to speak a length-framed RPMB to an external RPMB daemon.

For a concrete example of a daemon speaking this protocol, see rpmb_dev
in the Trusty tree.

Bug: 124277696
Test: Launch storageproxyd with -t virt, use Trusty test infra
Change-Id: I391d4768976f0eb1f3b8df58eefd58fc3a9409cd
2019-03-05 17:25:57 -08:00
Treehugger Robot 2d85880b49 Merge "Clang-format before updating storage proxy" 2019-03-06 00:53:25 +00:00
David Anderson 925c78b7e8 Merge "Support FiemapWriters that extend across multiple files." 2019-03-05 23:06:19 +00:00
Sudheer Shanka cabc52646a Allow callers to pass a flag to not link obb dirs of multiple users.
Bug: 110960295
Test: atest cts/hostsidetests/appsecurity/src/android/appsecurity/cts/ExternalStorageHostTest.java
Change-Id: I738e7e6365fb4917f1172c578281e1835a5012c2
2019-03-05 14:41:54 -08:00
David Anderson 79a43cf135 Merge "Add more filesystem support to libfiemap_writer." 2019-03-05 18:14:53 +00:00
Suren Baghdasaryan a953ae0546 Merge "Add min_score_adj into LmkKillOccurred event" 2019-03-05 18:06:46 +00:00
Mark Salyzyn 4c46285e2e Merge "fs_mgr: remount: add partition argument list" 2019-03-05 17:49:30 +00:00
Florian Mayer 3d67d347f5 Fix copy / move behaviour of Maps object.
Currently, moving or copying a Maps object leads to double free of MapInfo.

Even moving a Maps object  did not prevent this, as after a move
the object only has to be in an "unspecified but valid state", which can
be the original state for a vector of raw pointers (but not for a vector
of unique_ptrs).

Changing to unique_ptrs is the most failsafe way to make sure we never
accidentally destruct MapInfo.

Test: atest libuwindstack_test
      Failed LocalUnwinderTest#unwind_after_dlopen which also fails at master.

Change-Id: Id1c9739b334da5c1ba532fd55366e115940a66d3
2019-03-05 13:05:36 +00:00
Suren Baghdasaryan ec5e4c6eb1 Add min_score_adj into LmkKillOccurred event
Log min_score_adj when lmkd kills a process to determine the oom_score
levels that lmkd considers during the kill.

Bug: 123024834
Change-Id: I986ae8f2808199b1654bc8d2a32dd88046c79aa3
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-03-05 09:51:06 +00:00
Jiyong Park 8502ed308d Access apex sysprops via the generated API
Bug: 125549215
Test: m
Change-Id: Ie9b0aa5eec5931da3512d77613b034e5bd760f3e
2019-03-05 16:22:55 +09:00
Treehugger Robot c676cca4f6 Merge changes from topic "apex_earlymount_base"
* changes:
  Activate system APEXes early
  mount /apex during first_stage init
2019-03-05 06:49:02 +00:00
Jiyong Park dcbaf9f41b Activate system APEXes early
Summary: Boot sequence around apexd is changed to make it possible for
pre-apexd processes to use libraries from APEXes. They no longer need to
wait for the apexd to finish activating APEXes, which again can be
done only after /data/ is mounted. This improves overall boot
performance.

Detail: This change fixes the problem that processes that are started
before apexd (so called pre-apexd processes) can't access libraries
that are provided only by the APEXes but are not found in the system
partition (e.g. libdexfile_external.so, etc.). Main idea is to activate
system APEXes (/system/apex/*.apex) before /data is mounted and then
activate the updated APEXes (/data/apex/*.apex) after the /data mount.

Detailed boot sequence is as follows.

1) init prepares the bootstrap and default mount namespaces. A tmpfs is
mounted on /apex and the propagation type of the mountpoint is set to
private.

2) before any other process is started, apexd is started in bootstrap
mode. When executed in the mode, apexd only activates APEXes under
/system/apex. Note that APEXes activated in this phase are mounted in
the bootstrap mount namespace only.

3) other pre-apexd processes are started. They are in the bootstrap
mount namespace and thus are provided with the libraries from the system
APEXes.

4) /data is mounted. init switches into the default mount namespace and
starts apexd as a daemon as usual.

5) apexd scans both /data/apex and /system/apex, and activate latest
APEXes from the directories. Note that APEXes activated in this phase
are mounted in the default namespaces only and thus are not visible to
the pre-apexd processes.

Bug: 125549215
Test: m; device boots
Change-Id: I21c60d0ebe188fa4f24d6e6861f85ca204843069
2019-03-05 09:47:49 +09:00
Mark Salyzyn d458066bc7 Merge "adb: use /system/bin/remount command" 2019-03-04 22:27:19 +00:00
Mark Salyzyn f4e7422c65 fs_mgr: remount: add partition argument list
Can supply a specific partition to remount.  Partitions can be
specified by name or mount point.  Some extra work to differentiate
an unknown partition, invalid partition, or one that is covered by
overlayfs.

Test: adb-remount-test.sh
Bug: 122602260
Change-Id: Iab6f51c2b5ebe01f1cea3fb235445d5e2f495365
2019-03-04 11:13:05 -08:00
Mark Salyzyn 2f6c180749 adb: use /system/bin/remount command
Replace direct logic in support for 'adb remount' with an exec out to
/system/bin/remount to do the heavy lifting.  Remount success and
failure strings are reported by the adb remount service in response
to the various reported errors, freeing up the remount command itself
from the legacy of script expectations.

Test: adb-remount-test.sh
Bug: 122602260
Change-Id: I686fa465f463b881bbb38f709d780a95e463be80
2019-03-04 11:12:54 -08:00
David Anderson f344d63222 Support FiemapWriters that extend across multiple files.
This introduces a new SplitFiemap class that will divide an allocation
request across multiple FiemapWriters. This is primarily useful on
filesystems that have onerous restrictions on maximum file sizes. Vfat,
for example, supports a maximum of 4GiB, which is too small to satisfy
larger userdata size requests.

Bug: 126230649
Test: fiemap_writer_test gtest
Change-Id: I3c95d341e4e94e0c44bbf0e8553c34ccfdcd155b
2019-03-04 10:08:55 -08:00
Treehugger Robot 6521bf3c98 Merge "ld.config: Permit legacy /system/vendor paths" 2019-03-04 12:58:11 +00:00
Jiyong Park 4ba548d845 mount /apex during first_stage init
/apex is not mounted via init.rc but directly by the first_stage init
before the mount namespaces are configured.

This allows us to change the propagation type for /apex mount point to
private to isolate APEX activatesions across post- and pre-apexd
processes.

Bug: 125549215
Test: m; device boots to the UI

Change-Id: I10e056cd30d64cb702b6c237acd8dab326162884
2019-03-04 16:22:41 +09:00
Felix 9e40e12cea ld.config: Permit legacy /system/vendor paths
Because /vendor is a symlink to /system/vendor on devices without a
dedicated /vendor partition, /system/vendor/lib/* needs to be added to
the permitted paths whereever /vendor/lib/* is permitted.

Reasoning:
Legacy devices are forced to use ld.config.legacy.txt, which is very
permissive. We can prolong support for them and enable them to use the
VNDK if we extend the search paths to include the resolved symlink dirs.

Change-Id: I6b3bb7b86ed82395345a16bdc857353b1b15c704
2019-03-03 14:31:37 +01:00
Petri Gynther bc6372103a Merge "toolbox: make "r" available for /vendor" 2019-03-03 07:20:04 +00:00
David Anderson 4d4db8c09e Add more filesystem support to libfiemap_writer.
This adds support for vfat filesystems.

Bug: 126230649
Test: fiemap_writer_test gtest
Change-Id: I028cc7d95c313dd3ed826bc44cc3d0ffdcb58597
2019-03-02 00:31:15 -08:00
Treehugger Robot 924eec9518 Merge "libmeminfo: librank optimization using maps instead of vectors" 2019-03-02 03:58:28 +00:00
David Anderson 42294631a7 Merge "Fix double-accounting bug in liblp." 2019-03-02 03:16:10 +00:00
Petri Gynther 7c71e06f8e toolbox: make "r" available for /vendor
Make "r" package available for /vendor, so that we can easily add:

PRODUCT_PACKAGES_DEBUG += r.vendor

in device/google/<device>/device.mk

Change-Id: I46c23a85c95444083b8e4b68961c541d9af9b216
2019-03-01 17:51:56 -08:00
David Anderson 88e36c1514 Fix double-accounting bug in liblp.
When flashing in fastbootd, we create a new MetadataBuilder using the
given super_empty.img and attempt to import the existing partition
table. This will fail if there is some incompatibility in the partition
layout or partition quotas.

This import code was accidentally double-accounting partitions when
determining if they could fit within the group quota, preventing
"fastboot flashall" once partitions reached a certain size.

Bug: 126930319
Test: liblp_test gtest
Change-Id: I89a69cba110b62719197c9a4885cfc5bcf8f009f
2019-03-01 16:17:27 -08:00
Erick Reyes 5a744684c3 libmeminfo: librank optimization using maps instead of vectors
librank was calling std::vector::find_if in nested loops when iterating
through processes and maps.

Changed the implementation to use std::map::insert, this resulted in
a significant improvement to execution speed.

Test: time librank on crosshatch

Before:  1m22.57s real     1m15.87s user     0m05.79s system
After:   0m03.85s real     0m00.88s user     0m02.92s system

Bug: 124523194

Change-Id: I2b519d0bfd7f7929c6c4c6c2374794cb1a744585
Signed-off-by: Erick Reyes <erickreyes@google.com>
2019-03-01 16:17:20 -08:00
David Anderson b1f97f9d1b Merge "Remove the block size alignment restriction." 2019-03-01 22:48:25 +00:00
Treehugger Robot 8dcd839158 Merge "Reduce log spam from libprocessgroup" 2019-03-01 22:11:15 +00:00
Suren Baghdasaryan 6ad4eb3519 Merge "libprocessgroup: convert Json::Value to const refs" 2019-03-01 18:02:22 +00:00