Commit Graph

50022 Commits

Author SHA1 Message Date
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
Ryan Mitchell fd84f60d45 Fix leak of mapped zip central directories
am: d1531ac4e8

Change-Id: Iacc5d17b17cd05742e78650bde969ccbfa3b09c2
2019-05-29 08:58:44 -07:00
Ryan Mitchell d1531ac4e8 Fix leak of mapped zip central directories
Memory mapping the central directory of specific APKs caused memory
mappings to build up over time because they were never unmapped
correctly. This is because MappedFile is not calling munmap with the
size of the data after aligning the mmap offset to a page boundary.

Bug: 133463863
Test: install APKs and verify that the entire mapped CD is unmaped
Test: ran aapt2 as daemon and confirmed that mapped CD is unmapped
Change-Id: Icb6cfebe0e8d67160fee34c5e6423d0f05de526b
2019-05-28 23:00:04 +00:00
Narayan Kamath 9e28c5448b rootdir / sdcard : Stop creating /data/media/obb.
am: c6ca823710

Change-Id: I429eacda7dc48b7472814dcecf58e1c7262b37fa
2019-05-24 04:27:10 -07:00
Narayan Kamath c6ca823710 rootdir / sdcard : Stop creating /data/media/obb.
This directory is no longer used. OBB content is
placed in /data/media/$user/Android.

Test: make
Test: manually verify the path doesn't exist.
Bug: 129167772

Change-Id: I8549826586b9a68c8cfa3fe2e51295363f9b4e11
2019-05-23 15:09:54 +01:00
Bowgo Tsai 56e404c435 Merge "Moving /odm/build.prop to /odm/etc/buid.prop" into qt-dev
am: b36b54cf79

Change-Id: I2b24f88411f9ebd20216371280b2f97fb150e640
2019-05-22 21:35:19 -07:00
Bowgo Tsai b36b54cf79 Merge "Moving /odm/build.prop to /odm/etc/buid.prop" into qt-dev 2019-05-23 02:13:26 +00:00
Josh Gao 3d40524d33 Merge "adbd: respond to device-to-host control transfers." into qt-dev
am: 8ef22b102c

Change-Id: I198a023196af5815268117bbedfd5f5ba048ca4c
2019-05-22 19:02:56 -07:00
Wei Wang 1cc56a6d51 Merge "Report non-empty system boot reason when bootloader reason is empty" into qt-dev
am: c39fcd42d7

Change-Id: I75baac785e1069806138995582e22ea25d7ff521
2019-05-22 17:58:10 -07:00
Josh Gao 8ef22b102c Merge "adbd: respond to device-to-host control transfers." into qt-dev 2019-05-22 21:06:56 +00:00
Wei Wang c39fcd42d7 Merge "Report non-empty system boot reason when bootloader reason is empty" into qt-dev 2019-05-22 20:28:58 +00:00
Hridya Valsaraju 4a572d984f fastbootd: reduce USB buffer size to 16K
am: 4472fdb4d0

Change-Id: I86c52fdd909bce5e9ef485f0fda2c4506d5b534f
2019-05-22 10:20:09 -07:00
Wei Wang 699e342b3d Report non-empty system boot reason when bootloader reason is empty
Bug: 133321647
Test: build
Change-Id: Icd3ea4b69ef2ad040926e2b0e121a8f5f1c1b658
2019-05-22 09:46:02 -07:00
Victor Chang 11c0490499 Merge "Allow linking to libicuuc.so and libicui18n.so from executable in /data" into qt-dev
am: 28904625b8

Change-Id: I9e15dfd23cfdab5e16f615b694794b44b9e34937
2019-05-22 09:37:06 -07:00
Hridya Valsaraju 4472fdb4d0 fastbootd: reduce USB buffer size to 16K
Some USB controllers can only support transfers upto 16K.

Bug: 133208811
Test: fastboot flashall
Change-Id: Ic025bdd8e7a6cf2634fc24524fd189e0cc9efbb5
Merged-In: Ic025bdd8e7a6cf2634fc24524fd189e0cc9efbb5
(cherry picked from commit d747dba9c0)
2019-05-22 16:14:22 +00:00
Victor Chang 28904625b8 Merge "Allow linking to libicuuc.so and libicui18n.so from executable in /data" into qt-dev 2019-05-22 15:43:44 +00:00
Bowgo Tsai 3182ea132e Moving /odm/build.prop to /odm/etc/buid.prop
In device root directory, we have the following symlinks:
  - /odm/app -> /vendor/odm/app
  - /odm/bin -> /vendor/odm/bin
  - /odm/etc -> /vendor/odm/etc
  ...

This allows the Generic System Image (GSI) to be used on both devices:
  1) Has a physical odm partition, where those symlink will be hidden
     when /odm is used as the mount point
  2) Has no physical odm partition and fallback to /vendor/odm/.

We can't just have the symlink /odm -> /vendor/odm, because the former
devices won't have /vendor/odm directory, which leads to mount failure
when the mount point /odm is resolved to /vendor/odm.

The existing /vendor/odm/build.prop won't be loaded in the latter
devices, because there is no symlink
    - /odm/build.prop -> /vendor/odm/build.prop.

Note that init blocks reading through direct symlinks (O_NOFOLLOW) so
the above symlink won't work either. This CL moves the odm build.prop
to /odm/etc/build.prop for init to load it (symlinks in earlier
components of the path will still be followed by O_NOFOLLOW).

Bug: 132128501
Test: boot a device and checks /odm/etc/build.prop is loaded
Change-Id: I0733c277baa67c549bb45599abb70aba13fbdbcf
Merged-In: I0733c277baa67c549bb45599abb70aba13fbdbcf
(cherry picked from commit c49655b2a4)
2019-05-22 16:15:44 +08:00