Commit Graph

49988 Commits

Author SHA1 Message Date
Josh Gao b41d7ae1a9 adb: turn CHECKs into an error + transport restart.
These CHECKs are expected to happen if the client does the wrong thing,
so we probably shouldn't be aborting in adbd.

Bug: http://b/133872605
Bug: http://b/134695864
Test: treehugger
Change-Id: I875b87a06ba9d399db26f8af1ad47ccf34e9445a
Merged-In: I875b87a06ba9d399db26f8af1ad47ccf34e9445a
(cherry picked from commit fc0f80ae49)
2019-06-19 15:01:02 -07:00
Zhijun He 5e1c51498b Revert "libprocessgroup users use libcutils"
am: 5360a8492d

Change-Id: I3cd5a95311ea42a1dc3ea235790f909e4da6a7e0
2019-06-18 22:50:55 -07:00
Zhijun He 5360a8492d Revert "libprocessgroup users use libcutils"
This reverts commit 1ec3b78b67.

Reason for revert: breaks all camera use cases

Bug: 135568875

Exempt-From-Owner-Approval: revert, no build cop

Change-Id: Iec8e1f94f5bedced3f3faf73f851fd2f13e2e768
2019-06-19 05:25:07 +00:00
Steven Moreland 0b4311702f Merge "libprocessgroup users use libcutils" into qt-dev
am: c99582dc51

Change-Id: I96ee6e13a50f5bd4d4aac88621f36cebd081659c
2019-06-18 16:49:12 -07:00
Steven Moreland c99582dc51 Merge "libprocessgroup users use libcutils" into qt-dev 2019-06-18 23:06:54 +00:00
Steven Moreland aedef73b9c libhwbinder users use libhidlbase
libhwbinder symbols are being moved into libhidlbase in order to
optimize linking/memory usage. libhwbinder will no longer be
required in the future (however removing references to it will come
separately).

Bug: 134961554
Test: boot
Change-Id: I2b9a4fb9d87913b6c0e4291d3debadbf27511111
2019-06-18 15:38:10 -07:00
Steven Moreland 1ec3b78b67 libprocessgroup users use libcutils
libprocessgroup symbols are being moved into libcutils in order to
optimize linking/memory usage. libprocessgroup will no longer be
required in the future (however removing references to it will come
separately).

Bug: 135145426
Test: boot

Test:
BEFORE:
$ adb shell showmap -a $(pid hwservicemanager) | grep -P "libprocessgroup|libcutils" -A1 | grep -P 'libprocessgroup|libcutils|\.bss' | awk '{s += $9}END{print s}'
28

AFTER:
$ adb shell showmap -a $(pid hwservicemanager) | grep -P "libprocessgroup|libcutils" -A1 | grep -P 'libprocessgroup|libcutils|\.bss' | awk '{s += $9}END{print s}'
12

Change-Id: I10d7c2d2b2b14cbbe0a128b9156d31206419d24c
2019-06-18 22:03:54 +00:00
Daniel Rosenberg 23c454fa3d Merge "Start Vold on early-fs" into qt-dev
am: d6253fc917

Change-Id: I64a4f4a557bf737c0fac1b2f5f94ed28f263ee06
2019-06-18 12:58:08 -07:00
TreeHugger Robot d6253fc917 Merge "Start Vold on early-fs" into qt-dev 2019-06-18 19:17:01 +00:00
Suren Baghdasaryan 320211cbba Merge "Remove ACgroupController_getFlags to fix API breakage" into qt-dev
am: fb888f6565

Change-Id: I3bb62d138cdb13b3f0ba62aae0e8ea276a4dfcfd
2019-06-17 16:36:31 -07:00
Suren Baghdasaryan fb888f6565 Merge "Remove ACgroupController_getFlags to fix API breakage" into qt-dev 2019-06-17 23:22:30 +00:00
Dongcheol Shin ca11f4699c Merge "Support importing property file with expanded name" into qt-dev
am: fa94b8f96b

Change-Id: Iff4adad019e0f919536d1cce0ed55d536ea65e4e
2019-06-17 15:56:11 -07:00
Daniel Rosenberg 1be83e30c5 Start Vold on early-fs
We need vold on early-fs so we can handle userdata checkpointing.
Without this, devices will take an extra minute or two as checkpointing
related vdc calls attempt to reach vold before it is available.

Bug: 134114000
Test: Boot, see vold has started before vdc checkpointing tries to call
      out to vold.

Change-Id: Idfdb304503a163fbb91f9317949eb98c06fecce1
2019-06-17 22:30:44 +00:00
TreeHugger Robot fa94b8f96b Merge "Support importing property file with expanded name" into qt-dev 2019-06-17 22:30:28 +00:00
Steve Muckle cf643b1183 VtsKernelLiblpTest: use static test
am: 9b90198887

Change-Id: I5ba01410457a22305a156c62d56115a2697c77f5
2019-06-17 10:21:22 -07:00
Suren Baghdasaryan aa1d54f0cc Remove ACgroupController_getFlags to fix API breakage
Since ACgroupController_getFlags was introduced after LLNDK freeze it
causes media crashes due to missing symbol. Remove the new function and
re-implement cgroup controller detection to not require flags field but
instead check for its existence on the first access.

Bug: 135049992
Test: libcutils_test with and without CONFIG_CPUSETS enabled
Change-Id: I0220d6a926884dc22a7424d7d0a980c379c6f4eb
Merged-In: I0220d6a926884dc22a7424d7d0a980c379c6f4eb
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2019-06-17 16:49:36 +00:00
Steve Muckle 9b90198887 VtsKernelLiblpTest: use static test
To avoid introducing dependencies on target libraries, use a statically
compiled test instead.

Bug: 134912860
Test: run vts-kernel -m VtsKernelLiblpTest
Change-Id: Ie24cc8532c7821cb225c024c240c4d485557bfa7
2019-06-14 16:10:25 -07:00
Peter Collingbourne c58c10a973 Link the sanitizer runtime libraries to the default unrestricted namespace.
Without this, binaries can't be run out of /data/local/tmp on a HWASANified
device.

Bug: http://b/134503977
Test: Chromium's /data/local/tmp/md5sum/md5sum_bin works on walleye_hwasan-userdebug
Change-Id: Ieceaab8aae0024864022ca42b38aa36e6212cf31
(cherry picked from commit 563ca38154)
2019-06-14 14:57:45 -07:00
Dongcheol Shin ea9e783b4b Support importing property file with expanded name
This change is to support importing property file with its path
variations.

By substitute its filename with another, it can be used to handle
runtime varying filename within single binary.

Here's an example of usage in property defined file.
    import /odm/build_${ro.boot.product.hardware.sku}.prop

Bug: 132592551
Test: boot a device and checks above example import statement in
    "/odm/build.prop" loading expanded filename correctly

Merged-In: If3fdcf620a5d717e0930b1e4e58261bc8f79ec24
(cherry picked from commit a87c0f99ad)

Change-Id: If3fdcf620a5d717e0930b1e4e58261bc8f79ec24
2019-06-14 10:25:12 +09:00
Hemant Kumar b2d79c5e48 adb: daemon: Assign valid fd to usb_handle ep0 file descriptor
Bug: http://b/129283234
Test: treehugger
Change-Id: I2d005e17ccb45af95351c074cc53f6cfc53b5fdd
Merged-In: I2d005e17ccb45af95351c074cc53f6cfc53b5fdd
(cherry picked from commit 1cbe5edbc3)
2019-06-13 12:38:19 -07:00
Min Yun 702981f54f Merge "Add libcgrouprc to ld.config.txt." into qt-dev
am: 4e5fddd5f5

Change-Id: Ia28f8fb8e68deb24e17504ea8369da61501f0b5b
2019-06-12 15:49:23 -07:00
TreeHugger Robot 4e5fddd5f5 Merge "Add libcgrouprc to ld.config.txt." into qt-dev 2019-06-12 22:36:30 +00:00
mtk16036 28995c21c1 race condition in libprocessgroup
am: 540b1556c9

Change-Id: I546ef683a99a4dfd407d836de763cf1552bb1702
2019-06-12 15:24:52 -07:00
mtk16036 540b1556c9 race condition in libprocessgroup
while enable fdsan (file descriptor sanitizer),
fdsan report use-after-close error after boot complete (sedom).

Because, in SetCgroupAction::EnableResourceCaching() currently has a data race against all the
use fd_ functions like SetCgroupAction::ExecuteForProcess(uid_t uid, pid_t pid) etc.

ThreadA                                     | ThreadB
-------------------------------------------------------------------------------------------------
in SetCgroupAction::EnableResourceCaching() | in SetCgroupAction::ExecuteForProcess(...)
-------------------------------------------------------------------------------------------------
                                            | in SetCgroupAction::AddTidToCgroup(int tid, int fd)
-------------------------------------------------------------------------------------------------
fd_ = std::move(fd); /*modified fd_ value*/ |
-------------------------------------------------------------------------------------------------
                                            | write(fd)  /* crash here, fd is closed by ThreadA*/
-------------------------------------------------------------------------------------------------

So, add mutex lock to protect fd_ data race.

Bug: 134120826
Test: auto test, run the adb reboot test 100 times and no fdsan error report on libprocessgroup
Merged-In: Iccf2f705e030f79324f1164509e715dc5be825de
Change-Id: Iccf2f705e030f79324f1164509e715dc5be825de
2019-06-12 19:27:14 +00:00
Min Yun 8d502fc150 Add libcgrouprc to ld.config.txt.
- In GSI, media.extractor has follow dependency.
media.extractor -> libmpeg2extractor (media ns) ->
libprocessgroup (media ns) -> libcgrouprc (default ns).
If libcgroupsrc can't link from libmpeg2extractor, media.extractor is crashed.

Test: media.extractor didn't die.
Bug: 134981805
Merged-In: I7d3e7e6477708a505b87a884e05cd719f5a3d496
(cherry picked from commit d695733df9)

Change-Id: I7d3e7e6477708a505b87a884e05cd719f5a3d496
2019-06-12 13:56:31 +09:00
Tao Bao 88adf91530 Merge "adb: Allow `adb rescue getprop`." into qt-r1-dev 2019-06-11 18:54:00 +00:00
Jaegeuk Kim 09022ece56 Merge "fs_mgr: support -o sync" into qt-dev
am: 607611e016

Change-Id: If99555bb7062eec589f5d5d5472bad4a7f1e72dc
2019-06-10 20:03:11 -07:00
Jaegeuk Kim 607611e016 Merge "fs_mgr: support -o sync" into qt-dev 2019-06-11 02:55:47 +00:00
Jaegeuk Kim 9b85e1fb20 fs_mgr: support -o sync
Bug: 134172577
Change-Id: I1ad8811b07657727d8227d3668f58b0fbc7e7609
Merged-In: I1ad8811b07657727d8227d3668f58b0fbc7e7609
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2019-06-10 21:52:40 +00:00
Tao Bao e6827e5e87 adb: Allow `adb rescue getprop`.
Which will dump all the allowed properties, similar to `adb shell
getprop`.

Bug: 134027350
Test: Run the command under rescue mode.
Change-Id: Id668224098006d71ee192c8c2bea5d791d2423c1
(cherry picked from commit 599eee1f37)
2019-06-06 09:10:22 -07:00
Peter Collingbourne 3bdd3cfab6 Link the "runtime" namespace to more namespaces.
The canonical location of the HWASAN runtime, an LL-NDK library, is being moved
to the runtime APEX. It is apparently the first LL-NDK library in the runtime
APEX that does not require a legacy symlink in /system/${LIB}. Therefore we
need to link the HWASAN runtime in the runtime namespace to various namespaces
so that the library can be loaded from outside of the namespace.

Also, add $SANITIZER_RUNTIME_LIBRARIES to
namespace.default.link.system.shared_libs. This is necessary because in
the accompanying Soong change, we cause the HWASAN runtime to be removed
from $LLNDK_LIBRARIES. In most cases, except for this one, this was a no-op
because we were already including both sets of libraries in shared_libs.

Bug: http://b/134503977
Test: Builds

Change-Id: I67d64788855d28f3a156a1b9cf8a897617277730
Merged-In: I67d64788855d28f3a156a1b9cf8a897617277730
(cherry picked from commit fb1c5a724e)
2019-06-06 02:12:30 -07:00
Mark Salyzyn 1803972b6b fs_mgr: overlayfs: pre-emptive filesystem setup
am: 0dff785221

Change-Id: I007e1703957ddc064f8055dd5e0c3f834bb5ba3f
2019-06-05 08:53:38 -07:00
Mark Salyzyn 0dff785221 fs_mgr: overlayfs: pre-emptive filesystem setup
If we just disabled verity, take the step to setup the backing
storage for overlayfs.

Test: adb-remount-test.sh
Bug: 130131892
Change-Id: Ic56569eaf363e4417a0ce5df11ee5480a07b8b03
Merged-In: Ic56569eaf363e4417a0ce5df11ee5480a07b8b03
2019-06-04 14:14:58 +00:00
Anton Hansson 857a861c18 Merge "Close /dev/fuse FD before calling onClosed" into qt-dev
am: b6d9fbddc6

Change-Id: I9cf86c3206cfbbcc2bed84809e5cb7aa454156bd
2019-05-31 09:15:39 -07:00
Anton Hansson b6d9fbddc6 Merge "Close /dev/fuse FD before calling onClosed" into qt-dev 2019-05-31 15:59:39 +00:00
Anton Hansson c9e873f274 Close /dev/fuse FD before calling onClosed
This works around a deadlock when a bridge that is about to be closed
is reused for a new call to openFile. The call to open() ends up holding
the vold lock, waiting for appfuse to respond. The appfuse event loop
calls onClosed(), which ends up calling vold.unmountAppFuse(), which
cannot get the lock.

Closing this file descriptor causes any current calls to open() on its
mount path to fail with either ECONNABORTED or ENOTCONN, allowing the
event loop to make progress, call onClosed() and unmount the path.

Note that the failed call to open() will result in a retry, which
will create a new appfuse bridge. This is not ideal but not a new
problem -- the common case here is that that each call to
openProxyFileDescriptor creates a new bridge. This should ideally
be improved.

Bug: 132344997
Test: flick through info of photos with location info attached
Exempt-From-Owner-Approval: verbal approval of approach
Change-Id: I878e5cf86f18c5233f8505f52eb9db076bd72d01
2019-05-31 15:58:45 +00:00
Tom Cherry 6703305986 Merge "init: make fatal reboot target configurable" into qt-dev
am: 4d63d1b7bb

Change-Id: I0b2e40dc8bc23251b71e91abcbecee7c5fc643f0
2019-05-31 08:46:04 -07:00
Tom Cherry b2b99e2bbd Merge "init: dump stack when aborting" into qt-dev
am: d0ed53e5e7

Change-Id: Iae3268a0672337de5c3e2a7dbc016a59090fa9bc
2019-05-31 08:45:36 -07:00
TreeHugger Robot 4d63d1b7bb Merge "init: make fatal reboot target configurable" into qt-dev 2019-05-31 15:35:15 +00:00
TreeHugger Robot d0ed53e5e7 Merge "init: dump stack when aborting" into qt-dev 2019-05-31 15:35:13 +00:00
Daichi Hirono 709a189b8e Fix BridgeEpollController to handles EAGAIN correctly
am: ca0d4ffbe3

Change-Id: I47ebbb9f83dfa55474a93ab4d28fba5b20758270
2019-05-31 08:26:40 -07:00
Daichi Hirono ca0d4ffbe3 Fix BridgeEpollController to handles EAGAIN correctly
When reading/writing proxy FD, if it returns EAGAIN,
BridgeEpollController updates epoll entries to observe specific FD
events. Before updating epoll entries, BridgeEpollController checks if
it really needs to update by comparing |state_| and |last_state_|.
|last_state_| has not been updated correctly so it resulted in wrong
epoll settings and keeps blocking the event loop.

Bug: 134104939
Test: atest libappfuse_test
Change-Id: I1c4a0164c1c016baf24ecfd523476ced981d3b28
2019-05-31 12:51:05 +09:00
Tim Murray 242a92953b Merge "lmkd: use ALOGE for logging kills" into qt-dev
am: cc18faf4d6

Change-Id: I00913e3bd6607a08dd14ba41d4ecf3c056c1cb6d
2019-05-30 15:32:07 -07:00
Tim Murray cc18faf4d6 Merge "lmkd: use ALOGE for logging kills" into qt-dev 2019-05-30 22:10:56 +00:00
Tim Murray b62b3ef2ba lmkd: use ALOGE for logging kills
Test: boots, works
Bug: 133761317
Signed-off-by: Tim Murray <timmurray@google.com>
Exempt-From-Owner-Approval: trivial change

Change-Id: I1a4a3741694078eec124f1f560ea68e78754bca6
2019-05-30 22:10:36 +00:00
Tom Cherry b80149d8bc init: make fatal reboot target configurable
Currently, if init encounters a fatal issues it reboots to fastboot
but this may be not desirable in all cases, especially the case of
critical services crashing.  Therefore this change adds the ability
for vendors to customize the reboot target via the
androidboot.init_fatal_reboot_target= kernel command line.

This applies to all LOG(FATAL) messages as well as fatal signals in
userdebug/eng builds, except for signals before logging is enabled in
first stage init.

Bug: 121006328
Test: device reboots to configurable target with LOG(FATAL)
Test: device reboots to configurable target after a segfault in the
      various stages of init
Test: device reboots to fastboot without a configured target
Change-Id: I16ea9e32e2fee08dece3d33b697d7a08191d607b
Merged-In: I16ea9e32e2fee08dece3d33b697d7a08191d607b
(cherry picked from commit 75e13baf32)
2019-05-30 12:10:51 -07:00
Tom Cherry 1fcd51255a init: dump stack when aborting
Dump init stacks when aborting either due to LOG(FATAL) or in
userdebug/eng builds due to signals, including signals from
sanitizers.

Doesn't work for static first stage init yet, b/133450393 tracks
that.

Also, ensure that LOG(FATAL) in child processes calls abort() in all
stages of init, not just 2nd stage init.

Bug: 131747478
Test: abort init in various ways and see stacks
Test: hang or crash in backtrace handler and see child reboot
Change-Id: Ib53b5d3e7e814244203f875de016ada9900dfce8
Merged-In: Ib53b5d3e7e814244203f875de016ada9900dfce8
(cherry picked from commit 59656fb377)
2019-05-30 12:08:42 -07:00
chihhao.chen 6c78e3ba1b Merge "Fix non-aio USB read issue for fastbootd" into qt-dev
am: 9122289a97

Change-Id: Id416f267f477d04ed5d71f2158ebc35183befa22
2019-05-29 16:35:22 -07:00
TreeHugger Robot 9122289a97 Merge "Fix non-aio USB read issue for fastbootd" into qt-dev 2019-05-29 23:11:55 +00:00
chihhao.chen 5f8b966d96 Fix non-aio USB read issue for fastbootd
non-aio USB read function was stuck in a loop waiting for more data
because data length parameter is always set 64 for fastbootd commands.
It should be a normal case to get less data than expected
since lengths of these commands are usually less than 64.
Add logic to check this and one more parameter to distinguish
fastbootd from general adbd case.

Bug: 133189029
Test: try various fastbootd commands
Change-Id: I6690324840d78f3f1e04235040301520329976db
2019-05-29 12:41:55 -07:00