Commit Graph

48283 Commits

Author SHA1 Message Date
David Anderson 6ecedd2040 Merge "libsnapshot: Track the source slot across reboots." 2019-08-13 20:39:23 +00:00
Songchun Fan 93619e373a Merge "[adb] Add a getter for native Win32 file handle" 2019-08-13 19:51:01 +00:00
Tom Cherry 53620ca1b1 Merge "Actually add README contents for ueventd" 2019-08-13 14:48:04 +00:00
Treehugger Robot b85c72caed Merge "init: first stage init tie stdout and stderr to /dev/kmsg" 2019-08-13 12:48:40 +00:00
Zimuzo Ezeozue 6c62ae7adb Merge "Allow switching between sdcardfs and FUSE mounts" 2019-08-13 09:23:58 +00:00
Treehugger Robot cbd1af9db0 Merge "fs_mgr: adb-remount-test: non-verity recovery" 2019-08-13 00:40:17 +00:00
David Anderson 3c0fea923b libsnapshot: Track the source slot across reboots.
The purpose of this is twofold. First, we need a way to detect whether
the device has booted into the new slot after an update. Second, we need
a quick-and-dirty test for first-stage init so it can avoid searching
for snapshots if it doesn't need to.

We can solve both of these problems by storing the source slot in
/metadata/ota/snapshot-boot. The existence of the file implies a more
complex check is needed, and the file stores the source slot.

Test: libsnapshot_test gtest
Bug: 139204329
Bug: 139089801
Change-Id: I919dd1c27a65734c61f3a9bdffefb32bdebd723b
2019-08-12 17:10:21 -07:00
Treehugger Robot 92a3594b12 Merge "libpackageparser: C rules for bools." 2019-08-12 23:45:36 +00:00
Christopher Ferris b5d064f5c6 Merge "Fix incorrect closing of fds." 2019-08-12 23:44:24 +00:00
Elliott Hughes e5abcddf4e Merge "Use as much of the macOS endian support as we can." 2019-08-12 23:00:47 +00:00
Tom Cherry 79896d8880 Merge "init: Allow matching empty property values" 2019-08-12 22:35:31 +00:00
Treehugger Robot 3d0ecde28f Merge "adb: windows: fix writev on sockets." 2019-08-12 22:33:44 +00:00
Zim c9f8e5dfed Allow switching between sdcardfs and FUSE mounts
This change is part of enabling upcoming platform changes that are
described in the bug linked below.

Bug: 135341433
Test: builds, boots successfully and external storage remains
an sdcardfs mount by default and works correctly
Test: cat /proc/1/mountinfo is unchanged

Change-Id: Idf851b3a42910e0ce8fdd75daea1cce91dd1aa98
2019-08-12 21:37:12 +01:00
Tom Cherry aefb141c67 Actually add README contents for ueventd
A long time coming

Test: n/a
Change-Id: I6050e74d7497d5a7760f615fe2ad7d5c78a66ab9
2019-08-12 13:13:57 -07:00
Anatol Pomozov 0fe1b4bd8c Merge "Add header that declares memcpy()" 2019-08-12 20:09:34 +00:00
Elliott Hughes 38b6297bac libpackageparser: C rules for bools.
I don't see any reason to carry around code to be more fussy than we
need to be.

Test: treehugger
Change-Id: I548f76fc4e06fadefb9173827872fd7f39f300fd
2019-08-12 12:43:34 -07:00
Elliott Hughes 8c711a5384 Merge "Rewrite libpackagelistparser." 2019-08-12 19:26:12 +00:00
Elliott Hughes f86ea02de6 Use as much of the macOS endian support as we can.
Turns out that although there's no <endian.h> or <sys/endian.h>, there
are <machine/endian.h> and <sys/_endian.h>, and they're included by
other system headers such as <dirent.h>.

Reuse the contents of <sys/_endian.h> here for better interop.

Bug: http://b/139203733
Test: treehugger
Change-Id: Ic0e9bfa1a5b56d05e9e542839d237b6ceae4aa8c
2019-08-12 12:11:42 -07:00
Anatol Pomazau 6b2ea1ca70 Add header that declares memcpy()
It helps to fix a compilation issue with host libc:

core/fs_mgr/liblp/reader.cpp:252:9: error: use of undeclared identifier 'memcpy'; did you mean 'wmemcpy'?
        memcpy(&partition, cursor, sizeof(partition));
        ^~~~~~
        wmemcpy

Change-Id: I68f9c5b815b09f846aeba67bce0290f6829c80cf
2019-08-12 18:34:49 +00:00
Elliott Hughes a22599df58 Merge "Reland "libcutils: remove unused "jstring.h"." 2019-08-12 18:21:27 +00:00
Mark Salyzyn ae8b8a4e00 fs_mgr: adb-remount-test: non-verity recovery
For devices that do not have verity, or start the test with
verity disabled, but are using overlayfs, use a 'secret' surgical
technique to revert the device back to original state.

adb enable-verity will carry risk in that if the device did not
arrive with verity enabled, we can not guarantee it will boot
if we turn on verity.

Test: atest adb-remount-sh
Bug: 138649540
Change-Id: If6d55c57fb9daca9305c42a4df2c18c7f8c5eefa
2019-08-12 10:14:18 -07:00
Tom Cherry 6fd8d3bb1b init: Allow matching empty property values
When we have a property match along with an event trigger, we
currently don't allow matching empty property values, in other words,
properties that are unset.  For example, the below trigger would never
be run:

on zygote-start && property:persist.sys.fuse=""

That doesn't make sense though, it should be possible to match an
empty property value, so this change allows that trigger to match when
persist.sys.fuse is either empty or not set.

This continues to not match a '*' to an empty property, so

on zygote-start && property:persist.sys.fuse=*

will not run if persist.sys.fuse is empty or unset.

Test: the above triggers run appropriately
Change-Id: Ia57de7b96ad352590d0c82ff4ae95060b7361976
2019-08-12 09:31:42 -07:00
Elliott Hughes 5af75ed172 Merge "logcat: switch to <regex>." 2019-08-12 16:22:10 +00:00
Elliott Hughes 79198d9ade Reland "libcutils: remove unused "jstring.h".
This reverts commit 09ba34925f.

Bug: http://b/139257138
Test: treehugger
Change-Id: Id9b612c5a79b89ed17d2205219af19788ae96c9e
2019-08-12 15:09:20 +00:00
Mason Wang 4b8e6b673f Merge "Revert "libcutils: remove unused "jstring.h"."" 2019-08-12 05:21:17 +00:00
Mason Wang 09ba34925f Revert "libcutils: remove unused "jstring.h"."
This reverts commit aa96e8898c.

Reason for revert: It caused BB, and b/139257138 is for your reference

Change-Id: I93f1d0ba0fa43325e2815e9b2de84bb7cb41c457
2019-08-12 02:16:58 +00:00
Treehugger Robot e2adc14803 Merge "libcutils: remove unused "jstring.h"." 2019-08-11 15:39:27 +00:00
Anatol Pomozov 239439b787 Merge "Add header that declares memcpy function" 2019-08-10 01:57:25 +00:00
Anatol Pomozov 7eca57a20e Merge "Add header that defines strerror()" 2019-08-10 01:56:27 +00:00
Anatol Pomazau 60509705e6 Add header that declares memcpy function
It fixes following issue when compiling adb with host libraries:

In file included from core/adb/client/adb_install.cpp:31:
In file included from core/adb/adb.h:30:
In file included from core/adb/socket.h:28:
core/adb/types.h:237:9: error: use of undeclared identifier 'memcpy'; did you mean 'wmemcpy'?
        memcpy(copy->data(), first_block->data() + begin_offset_, copy->size());
        ^~~~~~
        wmemcpy
/usr/include/wchar.h:262:17: note: 'wmemcpy' declared here
extern wchar_t *wmemcpy (wchar_t *__restrict __s1,

Change-Id: I233e533fa7a5e2ed98190e34e32ddbaddc528558
2019-08-09 22:20:15 +00:00
Treehugger Robot 3e59c847cc Merge "Add header that declares atomic primitives" 2019-08-09 21:36:41 +00:00
Christopher Ferris 7fdc80f6ec Fix incorrect closing of fds.
Test: Ran unit tests without fdsan aborts.
Change-Id: I4a060739c61e93364b9aabe3ae1d6cbc3639d310
2019-08-09 14:03:30 -07:00
David Anderson 5b9832748f Merge changes I5e93fcbf,I9d4c8bcf,Icd580aae,I7b2399a4
* changes:
  libsnapshot: Implement merge flow.
  libsnapshot: Unmap COW devices when deleting snapshots.
  libsnapshot: Eliminate per-snapshot flocks.
  libsnapshot: Improve first test-run and test cleanup.
2019-08-09 19:34:52 +00:00
Mark Salyzyn 2edc7a5128 Merge "fs_mgr: overlayfs: dig harder for /dev/root equivalent" 2019-08-09 15:11:54 +00:00
Elliott Hughes aa96e8898c libcutils: remove unused "jstring.h".
Test: treehugger
Change-Id: I56989862a51a6c8785f22f783027d50c42be650c
2019-08-08 17:45:48 -07:00
Songchun Fan 6e861740ff Merge "[adb] Cache features set inside the client process" 2019-08-09 00:40:51 +00:00
Songchun Fan 82834f1264 Merge "[adb] Speed up the streaming install" 2019-08-09 00:38:50 +00:00
Anatol Pomazau fd41f9a579 Add header that defines strerror()
It helps to fix a compilation issue with host libc:

core/base/errors_unix.cpp:25:10: error: use of undeclared identifier 'strerror'
  return strerror(error_code);
         ^

Change-Id: I71d4221cc1bfa6f0cc764b40b6b28159994b8e04
2019-08-08 23:31:36 +00:00
Anatol Pomazau 7b2ff6debc Add header that declares atomic primitives
It fixes a compilation issue:

/fdevent/fdevent_poll.cpp -o core/adb/fdevent/fdevent_poll.cpp.o
In file included from core/adb/fdevent/fdevent_poll.cpp:20:
In file included from core/adb/fdevent/fdevent_poll.h:29:
core/adb/fdevent/fdevent.h:106:10: error: no template named 'atomic' in namespace 'std'
    std::atomic<bool> terminate_loop_ = false;
    ~~~~~^

Change-Id: I5305a69a50e2638f514c5a7d47a9612b8ee38c69
2019-08-08 23:30:42 +00:00
Yurii Zubrytskyi 709dfc3524 [adb] Add a getter for native Win32 file handle
+ adb_pread() and adb_pwrite() functions for simpler cross
  platform file operations

Test: builds
Change-Id: I7e2b23e1da79acd7be974a3d7e1be0fb77d7d2c6
2019-08-08 15:52:21 -07:00
Elliott Hughes d32e7e2c05 Rewrite libpackagelistparser.
I was happy to ignore this as long as it wasn't being touched, but it's
been modified twice in the last year. Time to just throw it out and
rewrite it.

Also add some basic tests and put them in presubmit.

Bug: http://b/127686429
Test: new tests
Change-Id: Ie7e9406521291de0eab3138f55068cee6aaf365a
2019-08-08 13:53:20 -07:00
Josh Gao 6c4cfd6af5 Merge changes I4d6bda45,I72576e1f
* changes:
  adb: fix transport acquisition for forward, reverse.
  adb: don't manually construct device selection prefix in forward.
2019-08-08 20:38:15 +00:00
Yurii Zubrytskyi 6eca0e6999 [adb] Speed up the streaming install
1. Use bigger buffer for transfers - 64kb is the default size
   for push, so let it be the same in streaming

2. Use abb when it's available for lower overhead

3. Add a posix_fadvise() on the source APK

4. Increase buffer sizes for the socketpair that's transferring
the data from adbd.

Overall this saves about 25% time for streaming installations
and makes it faster than the legacy push (at last!)

Test: manual
Change-Id: Ieb84284da2058944815e062ef6e4389b842565fa
2019-08-08 12:55:51 -07:00
Tom Cherry ca94d79753 Merge "liblog: Remove stdbool.h from .cpp files" 2019-08-08 19:34:41 +00:00
Elliott Hughes 0c2dab9adf Merge "Remove more dead code." 2019-08-08 19:10:40 +00:00
Mark Salyzyn 31c14e15b9 fs_mgr: overlayfs: dig harder for /dev/root equivalent
Check for A/B /dev/block/by-name/system<slot> and also non-A/B
/dev/block/by-name/system to discover what /dev/root can be when
evaluating candidates for using overlayfs.

This is to handle a misconfigured (or legacy) system-as-root device.
It is recommended that the default fstab specifically mentions the
root mount's device node to prevent going down this path.

Test: adb-remount-test.sh
Bug: 138407617
Change-Id: I3853d203b9376d0f848cb490150ff00cc4ed3d5f
2019-08-08 11:50:36 -07:00
Elliott Hughes addd852165 logcat: switch to <regex>.
This was the only user of the google3 additions to external/pcre.

Test: adb logcat --grep camera
Change-Id: Iaa9dae38d30f60470f6a65b0a0fdd93e01abfc99
2019-08-08 08:53:59 -07:00
vichang ef0bc63043 Merge "Move ICU .dat" 2019-08-08 11:06:53 +00:00
David Anderson 5312c466b9 libsnapshot: Implement merge flow.
This implements InitiateMerge() and WaitForMerge(). InitiateMerge() is
meant to be called after an update has been marked successful.
WaitForMerge() is designed to be called either: immediately after
InitiateMerge, or during each subsequent boot where merging has not
completed.

InitiateMerge converts each snapshot device to a snapshot-merge device.

WaitForMerge polls each snapshot-merge device until no device reports a
"merging" state. One of the following states can result from this:
 - MergeFailed. This will happen if any device failed to merge, or we
   were unable to poll, or any other system-level failure occurred.
 - MergeNeedsReboot. This will happen if a snapshot-merge device has
   completed merging, but we were unable to clean it up due to something
   holding a resource open.
 - MergeCompleted. This indicates that all snapshots completed merging
   and were cleaned up.

If WaitForMerge() returns MergeCompleted, then all snapshots have been
removed and a new update can begin. GetUpdateState() will return None.

MergeFailed and MergeNeedsReboot, on the other hand, are "sticky". They
indicate a merge is still pending. When called again, WaitForMerge()
will poll again to attempt to make more progress in the merge. For
NeedsReboot, a single reboot will ensure all resources are released and
the next WaitForMerge() will successfully finish cleanup. In the failure
case, it is unlikely the next WaitForMerge will succeed, but we always
retry anyway (there is no harm in doing so, and if we get lucky, the
device can take more OTAs).

Bug: 136678799
Test: libsnapshot_test gtests
Change-Id: I5e93fcbffee1973da5ff76363df12d6317a7a7c7
2019-08-07 18:42:23 -07:00
David Anderson 986095036c libsnapshot: Unmap COW devices when deleting snapshots.
When we stopped unmapping snapshots in DeleteSnapshot, this also stopped
unmapping the COW device. Of course, the caller has no way to unmap this
since it's an implementation detail. Therefore unmap it in
DeleteSnapshot.

This scenario can arise after rewriting or removing a snapshot-merge
device.

Bug: 136678799
Test: manual test
Change-Id: I9d4c8bcfbb95b4454edd1cf0853d51b441e895fa
2019-08-07 18:42:22 -07:00