Commit Graph

54964 Commits

Author SHA1 Message Date
Nikita Ioffe dde59c32ac Merge "libdm: add an overload of DeleteDevice accepting a timeout_ms" 2019-12-06 02:35:23 +00:00
Jaegeuk Kim fe9e8a3fa5 rootdir: init.rc to limit discard size to 128MB
In any case, UFS storage suffers from long discard latency.

Change-Id: Iaa8ef6eb862934af43254bd10873a12c3d34e926
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2019-12-05 15:58:18 -08:00
Tom Cherry c30a3eede5 logcat: clean up handling of logd control commands with -f and -L
* Print an error if -c is provided with -f and -L since it is ambiguous
* Move the clear operation when -f is provided to a stand alone
  location, since there is no need to loop
* Prevent -g/-G, -S, and -p/-P with -f, since that combination doesn't
  make sense

Test: logpersist works
Change-Id: I6d8709bd61c898c47835470e99b0acff8c2692e4
2019-12-05 13:39:34 -08:00
Yifan Hong ab0b17c081 Merge changes from topic "libsnapshot_write_atomic"
* changes:
  libsnapshot: write files atomically
  libsnapshot: lock on /metadata/ota
2019-12-05 20:13:21 +00:00
Tom Cherry d596ed66aa Merge "liblog: accept log messages with hdr_size greater than known headers" 2019-12-05 17:54:54 +00:00
Nikita Ioffe 091c4d1439 Remove service defined in an APEX during userspace reboot
Such services will be re-parsed and added back to the service list
during post-fs-data stage.

Test: adb reboot userspace
Test: atest CtsInitTestCases
Bug: 145669993
Bug: 135984674
Change-Id: Ibb393dfe0f101c4ebe37bc763733fd5d981d3691
2019-12-05 17:51:43 +00:00
Tom Cherry 759240289b Merge "init: Replace property_set() with android::base::SetProperty()" 2019-12-05 17:26:30 +00:00
Tom Cherry bb4754bef9 Merge "logcat: improve --help and error messages" 2019-12-05 17:09:23 +00:00
Anton Hansson 572350911a Merge "Point to exec_start from start in init documentation" 2019-12-05 17:04:25 +00:00
Christopher Ferris 25cd25168a Merge "Use elf offset in signal step check." 2019-12-05 16:31:34 +00:00
Anton Hansson 3c5cc31824 Run the derive_sdk service
Run this process as early as possible in the boot -- right
after its config has been parsed from the apex. This ensures
the sdk prop is set as early as it can be, should some other
early process need to look at it.

Note: this is unlikely to be the permanent way this gets run,
as it's only needed when apexes update.

Bug: 137191822
Test: boot && adb shell getprop | grep sdk_info
Change-Id: Ia48ef89435ca165333b52d653e3131f71a522747
2019-12-05 15:38:37 +00:00
Anton Hansson 8c4d930805 Point to exec_start from start in init documentation
Since it mentions a caveat, it's nice to know how to avoid
that caveat.

Test: N/A
Change-Id: I487f1080058bf83a76a725735c6f283f88b0739e
2019-12-05 15:37:09 +00:00
Nikita Ioffe 2c28919d48 libdm: add an overload of DeleteDevice accepting a timeout_ms
In some scenarios (e.g. apexd or userspace reboot), dm-devices are
getting deleted and re-created. Since this operation can be racy (newly
created device can get the same path as the previously deleted one,
resulting in the unexpected ENOENT errors on a system call to the path),
it will be nice to have an API that blocks until ueventd processes
corresponding udev events.

Test: libdm_test
Bug: 143970043
Bug: 122059364
Change-Id: I31a19afd9e245bf5e3554011bdde1c3cc4878f1c
2019-12-05 10:37:47 +00:00
Jooyung Han 028e1d4434 Merge "Bind-mount individual flattened APEXes" 2019-12-05 08:55:31 +00:00
Tom Cherry c88d8f93cf init: Replace property_set() with android::base::SetProperty()
Init is no longer a special case and talks to property service just
like every other client, therefore move it away from property_set()
and to android::base::SetProperty().

In doing so, this change moves the initial property set up from the
kernel command line and property files directly into PropertyInit().
This makes the responsibilities between init and property services
more clear.

Test: boot, unit test cases
Change-Id: I36b8c83e845d887f1b203355c2391ec123c3d05f
2019-12-04 15:43:21 -08:00
Tom Cherry 8d2225353c liblog: accept log messages with hdr_size greater than known headers
We don't need to be so strict about this comparison.  It's possible
that logd will extend the message that it passes to readers in the
future, and since we have a hdr_size parameter it can do so in a
backwards compatible way, as long as we loosen this restriction.

This keeps a sane upper bound that the hdr_size cannot be larger than
the log message itself.

Test: logcat, liblog-unit-tests
Change-Id: I8a6bea2a2d6e3315d998c51c1029e466ff06b45f
2019-12-04 15:28:03 -08:00
Yifan Hong 55974f1425 libsnapshot: write files atomically
... by writing to a temporary file then rename()'ing it
back.

Test: libsnapshot_test
Bug: 144549076
Change-Id: Ide400aff8d67d56d422d0adea3a4f1673ebc9994
2019-12-04 14:49:47 -08:00
Yifan Hong b6663cfb5a libsnapshot: lock on /metadata/ota
We used to flock() on /metadata/ota/state to ensure
atomic access. However, writing the file itself is
not necessary atomic and may lead to inconsistent
states.

This change redirects flock() to the outer directory, /metadata/ota,
which is very likely to exist (see exception below).
flock() is called on this directory instead of /state. This allows
a follow-up change to turn all writes to the /metadata partition
atomic.

Note: /metadata/ota may not exist during first boot after a flash
with wipe. However, first_stage_init always checks existence of
boot indicator before even trying to flock() (via
IsSnapshotManagerNeeded() and NeedSnapshotsInFirstStageMount()). If
the boot indicator exists, /metadata/ota must exist as well.

Also add tests to ensure LockExclusive() and LockShared() works as
expected.

Test: libsnapshot_test
Test: apply OTA from older build to this, then reboot

Bug: 144549076

Change-Id: Ib4dd9e9be1a43013c328e181b9398ac0b514dbce
2019-12-04 14:49:47 -08:00
Christopher Ferris f0c82e7bad Use elf offset in signal step check.
The function StepIfSignalHandler assumed that the rel_pc passed
to it was actually an elf offset. A new version of clang created a libc.so
that has a load bias, so tests unwinding through a signal handler
would fail on arm. On other ABIs, there is unwind information that could
be used instead, so the unwind still worked.

The fix is to subtract the load bias from the rel_pc to get an elf
offset to pass to the Register StepIfSignalHandler functions. Change all
of the Register funtions to make it clear what the first parameter means.

Add a unit test for this new code. Also, add an offline test for
this case.

Bug: 145683525

Test: Ran unit tests using the new clang and the old clang.
Change-Id: I3e249653b79bcad6d3a56411a7911fde4888e9d6
2019-12-04 22:29:59 +00:00
Tom Cherry 416973276e logcat: improve --help and error messages
Makes slight improvements to the --help text:
- Fix whitespace formatting and punctuation.
- Divide options into categories
- Clarify how the logd control functions work.
- Clarify --print.

Add additional text to the EOF error message that is returned when
logd disconnects the logcat instance, to clarify that this is intended
behavior if the logcat instance is reading too slowly.

Bug: 144311420
Test: view these messages
Change-Id: Icc12d278a8e8cb483918c0637b6fb529949cc33f
2019-12-04 14:00:50 -08:00
Thomas Joseph Avila f7a6c4587f Merge "Remove projects being moved into from system/core into system/memory" 2019-12-04 19:50:06 +00:00
Nikita Ioffe cafa75ca22 Merge "FscryptInstallKeyring: don't re-create keyring if it's already created" 2019-12-04 19:27:52 +00:00
Nikita Ioffe 9f71d6193a Merge "Add basic support for remounting ext4 userdata into checkpoint" 2019-12-04 19:22:50 +00:00
Tom Cherry 8fa4d6c382 Merge "init: always kill oneshot services' process groups." 2019-12-04 18:16:19 +00:00
Tom Cherry ab96d9dec1 Merge "Remove warning from VNDK's <cutils/log.h>" 2019-12-04 18:16:05 +00:00
Nikita Ioffe 1f40c94a1f FscryptInstallKeyring: don't re-create keyring if it's already created
During userspace reboot FscryptInstallKeyring will be called again, this
CL will make it second call a no-op, which IMHO is better than having a
special logic in init to conditionally call FscryptInstallKeyring
depending on whenever it's normal boot, or userspace reboot.

Test: adb reboot userspace
Test: checked in kernel logs that new keyring is not created
Bug: 135984674
Change-Id: I4ad5aee6887b7318fb1cd02bf1c7be8da6ece599
2019-12-04 17:47:37 +00:00
Suren Baghdasaryan c19f63004d Remove projects being moved into from system/core into system/memory
The following directories are being moved into separate projects under
system/memory:
  platform/system/memory/libion
  platform/system/memory/libmeminfo
  platform/system/memory/libmemtrack
  platform/system/memory/libmemunreachable
  platform/system/memory/lmkd

Remove them from system/core.

Bug: 141634854
Test: build and boot
Change-Id: I0ecc0668a281ec360133c8472bbf12ece92116d2
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Merged-In: Ica64900cd8af273fdffd321591acf3a566f04355
Merged-In: I98793edd10954058448727635f101219f71d3ccf
2019-12-04 17:30:45 +00:00
Erwin Jansen 10fdfeb7b8 Merge "Dup the correct fd for qemu pipe." 2019-12-04 17:15:20 +00:00
Christopher Ferris 2da8e3c2ee Merge "Fix support finding global variables." 2019-12-04 17:03:44 +00:00
Tom Cherry 2d5cfa9fa6 Remove warning from VNDK's <cutils/log.h>
We're never going to fix this warning and it's not causing any active
issues that vendors are using this header.  It is however causing
active issues that we have extraneous warning messages in the log.

Bug: 123758136
Test: no build warnings from <cutils/log.h>
Change-Id: Iccf702bf2536ba106a00ac04467d54401cbe2a50
2019-12-04 08:33:49 -08:00
Treehugger Robot fea51309dc Merge "libsnapshot: Call EnsureImageManager before RemoveAllImages" 2019-12-04 13:53:36 +00:00
Yifan Hong e62591ec3b libsnapshot: Call EnsureImageManager before RemoveAllImages
Calls to RemoveAllImages may be on uninitialized
image manager.

Test: apply OTA to self

Change-Id: Id57c01ddfdb6985fb2c3c142ee19fd65eef6c131
2019-12-04 00:24:55 -08:00
Christopher Ferris df683b7439 Fix support finding global variables.
The code was not properly getting the variable addresses and using
the offset and address fields of the .data section.

Fix all of that, and update the tests.

Bug: 145162678

Test: Unit tests pass.
Test: ./art/test/run-test --dex2oat-jobs 4 --host --prebuild --compact-dex-level fast --jit --no-relocate --runtime-option -Xcheck:jni  137-cfi
Test: ./art/test/testrunner/testrunner.py -t 137 --host
Change-Id: Ic61c4487334fd2273cda9c56eb1a3b525a03edb7
2019-12-03 17:35:00 -08:00
Yifan Hong 51fb2a0855 Merge "libsnapshot: start in background" 2019-12-04 00:04:54 +00:00
Wei Wang 6db520807d libsnapshot: start in background
so that it won't block init starting other services on boot_completed.

Test: build
Bug: 145612906
Change-Id: I1ca325b9ef191c4689e925da2e797271ec9c7979
2019-12-03 13:27:05 -08:00
Yifan Hong 3a8001476d Merge changes I8c5ab552,If8546dea
* changes:
  libsnapshot: tests uses common MapUpdateSnapshot/WriteSnapshotAndHash
  libsnapshot: Add test for accounting for hash tree
2019-12-03 19:44:51 +00:00
Yifan Hong 8b8ffbb2df Merge "SOURCE_COPY operation: implement src == dst" 2019-12-03 19:44:35 +00:00
David Anderson 332360fece Merge "libsnapshot: Remove all image data and metadata when cancelling an update."
am: 710d6cc419

Change-Id: If47a068143c7416f1b6aa5e479996f26403a6dd6
2019-12-02 16:46:49 -08:00
David Anderson 710d6cc419 Merge "libsnapshot: Remove all image data and metadata when cancelling an update." 2019-12-03 00:36:56 +00:00
Hans Boehm 174f8d8b1e Merge "Add check to sp<> raw pointer constructor"
am: c532941e54

Change-Id: I10e6b0bc269709e19665f9bd2d5c0b0b2622700d
2019-12-02 15:52:05 -08:00
Hans Boehm c532941e54 Merge "Add check to sp<> raw pointer constructor" 2019-12-02 23:44:48 +00:00
Alessio Balsini ef2c39bd6b SOURCE_COPY operation: implement src == dst
Helper function to compare the source and destination extents of a
SOURCE_COPY InstallOperation.
The function returns true iff source and destination are identical with
the use of std::equal().

Bug: 141207436
Test: build
Change-Id: I146aeba1c8ede35f21cfef8e21d4af62274bda84
Signed-off-by: Alessio Balsini <balsini@google.com>
2019-12-02 14:58:17 -08:00
Alessio Balsini dff772c226 Merge "PartitionCowCreator accounts for extra extents"
am: adb98df120

Change-Id: I0df9eb0def72ea3fdcb1fa8b9c034010cabf21b5
2019-12-02 14:21:13 -08:00
Treehugger Robot adb98df120 Merge "PartitionCowCreator accounts for extra extents" 2019-12-02 22:08:49 +00:00
Yifan Hong 18a78959ab libsnapshot: tests uses common MapUpdateSnapshot/WriteSnapshotAndHash
Factor out duplicated code.
Test: run it

Change-Id: I8c5ab552b97837b0e37cada6263eeda23f7f71b4
2019-12-02 13:59:48 -08:00
Yifan Hong defcbb4b7f libsnapshot: Add test for accounting for hash tree
Test: libsnapshot_Test
Bug: 145180464
Change-Id: If8546dea89fdd7ec7499522a232a777699c52d82
2019-12-02 13:59:48 -08:00
Alessio Balsini 33836a6061 PartitionCowCreator accounts for extra extents
dm-verity and error correction use part of the partitions using these
features to store their data.  Their data may be modified during an
update, so the COW device for the dm-snapshot must reserve some extra
space for them.
This patch extends the PartitionCowCreator data structure with the
extra_extents field that will store the (optional) additional extents,
e.g., the hash table extent for dm-verity or the error correction
extent.

Test: incremental OTA apply
Test: libsnapshot_test
Bug: 145180464
Change-Id: I387a6cc8438507ad41a85cc3400241ecaf627b8f
Signed-off-by: Alessio Balsini <balsini@google.com>
2019-12-02 12:49:38 -08:00
Erwin Jansen 4f138b2ce8 Dup the correct fd for qemu pipe.
Logcat dup-es STDOUT and used the dup-ed file descriptor to write logging
information. Because of this writes happen on that fd and not on stdout.
This in turn causes no output in the LogcatService in the emulator.

The qemu-pipe forwarder now dup-es the same fd as logcat is using so
that we receive data again.

Bug: b/145214141
Test: Logcat works again in emulator 29.2.10
Change-Id: Ia6e2430f1d7a0476a5b438d315a9ea337c13806d
2019-12-02 18:56:27 +00:00
Nikita Ioffe eea98abcb3 Merge "Fix typo in userspace reboot watchdog"
am: 4ac630b562

Change-Id: I825d646a7f86e17b43b75cd4c422867fb110a6cb
2019-12-02 10:44:37 -08:00
Nikita Ioffe 4ac630b562 Merge "Fix typo in userspace reboot watchdog" 2019-12-02 18:38:01 +00:00