Commit graph

43908 commits

Author SHA1 Message Date
Josh Gao
d19b77ac12 adb: finish switching service creation to string_view.
Test: test_adb.py
Test: test_device.py
Test: $ANDROID_HOST_OUT/nativetest64/adb_test/adb_test
Test: adb shell /data/nativetest64/adbd_test/adbd_test
Change-Id: If4ea92aee1c0264d946de72483f8d715d96fcfd8
2018-12-21 11:53:27 -08:00
Josh Gao
9dd1f5c0b7 adb: switch socket spec to string_view.
Test: test_adb.py
Test: test_device.py
Test: $ANDROID_HOST_OUT/nativetest64/adb_test/adb_test
Test: adb shell /data/nativetest64/adbd_test/adbd_test
Change-Id: I92c057215e041b98abb026628ea4acfba8a8132d
2018-12-21 11:53:27 -08:00
Josh Gao
e26154167c adb: switch daemon_service_to_fd to string_view.
Test: test_adb.py
Test: test_device.py
Test: $ANDROID_HOST_OUT/nativetest64/adb_test/adb_test
Test: adb shell /data/nativetest64/adbd_test/adbd_test
Change-Id: I298517b688650c9d94bf837284e0264ca0ac6702
2018-12-21 11:52:56 -08:00
Tom Cherry
2c56d7cdda ueventd: create a /dev/block/by-name/ symlink without a partition name
Create /dev/block/by-name/<device> symlink for block devices that are
boot devices but do not have a partition name given.

Test: boot normally
Change-Id: I8c100b0d30dce02a2dd31aebcfea538b8eed9b19
2018-12-21 09:27:38 -08:00
Tom Cherry
c02d05dc1c Merge "logd: improve logd prune" 2018-12-21 16:20:14 +00:00
Martin Stjernholm
f679c58787 Merge "Revert^2 "Linker namespace configuration for the Runtime APEX."" 2018-12-21 13:30:22 +00:00
Treehugger Robot
a7d2ffa821 Merge "Move DwarfCfaInfo::kTable from data.rel.ro to rodata" 2018-12-21 12:58:26 +00:00
Martin Stjernholm
e71d91e729 Revert^2 "Linker namespace configuration for the Runtime APEX."
This reverts commit a0d9f2fd6c.

Original change: Needs to support e.g. app_process in "default" ->
libnativehelper in "runtime" -> platform libs in "default" -> libc etc in "runtime".

Always make sure to switch namespaces when switching library paths between
/system and the APEX, so that internal library dependencies in both
locations are loaded from their own directory. E.g. libc++ and libbase live
in both places, and their dependents must always load the version they were
compiled with.

This CL also adds a temporary workaround to not break hwasan builds
(b/121038155).

Bug: 119867084
Bug: 113373927
Bug: 121038155
Change-Id: I58d09ed091dd82b2162c4a0b51555174d9322e0e
Test: Flash and reboot device
Test: Remount / read-write, then on device: rm -f system/lib{,64}/lib{c,m,dl}.so; system/bin/dex2oat -h; stop && start
Test: mmma bionic/tests/ && adb root && adb shell rm -rf /data/nativetest\* && adb push out/target/product/taimen/data/nativetest* /data/ && adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests && adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
Test: cts-tradefed run commandAndExit cts-dev -m CtsJniTestCases
Test: cts-tradefed run commandAndExit cts-dev -m CtsCompilationTestCases
Test: cts-tradefed run commandAndExit cts-dev -m CtsBionicTestCases (8 failures remain unchanged by this CL)
Test: Patch internal; lunch taimen_hwasan-userdebug && m SANITIZE_TARGET=hwaddress && vendor/google/tools/flashall -w && adb shell /vendor/bin/sh -c ls
2018-12-21 11:15:52 +00:00
Josh Gao
5021cfc135 adb: switch usb_linux helper to string_view.
Test: test_adb.py
Test: test_device.py
Test: $ANDROID_HOST_OUT/nativetest64/adb_test/adb_test
Test: adb shell /data/nativetest64/adbd_test/adbd_test
Change-Id: Iccbeb61905852b72fceec1bca498895b38a2e7d4
2018-12-21 01:43:34 -08:00
Josh Gao
0f29cbc750 adb: switch unix_open to string_view.
Test: test_adb.py
Test: test_device.py
Test: $ANDROID_HOST_OUT/nativetest64/adb_test/adb_test
Test: adb shell /data/nativetest64/adbd_test/adbd_test
Change-Id: Ieecc9b1b7f2111f4da45d4bbd1b7703535fe7d4d
2018-12-21 01:43:31 -08:00
David Anderson
bcede5f61a Merge "init: Don't fail first stage mount for formattable partitions." 2018-12-21 07:52:42 +00:00
David Anderson
00dc20701a Merge "fastbootd: Better error message when boot_devices is missing." 2018-12-21 07:52:19 +00:00
Treehugger Robot
db2ffaa0f0 Merge "Minor refactor to support strings with embedded zeros." 2018-12-21 00:59:48 +00:00
David Anderson
a48f86b88e fastbootd: Better error message when boot_devices is missing.
Bug: 121333158
Test: N/A
Change-Id: Ifac7ae382d9e57864f6a3915987300eb91355293
2018-12-20 16:56:06 -08:00
David Anderson
a1bb982c01 init: Don't fail first stage mount for formattable partitions.
If a partition can be formatted by vold, then it doesn't make sense to
have first-stage mount fail if the partition hasn't been formatted yet.

Bug: 121209697
Test: device boots after fastboot flashall -w
Change-Id: I4a6c794a9912a5e0794983e9514a08f9c23e6ae9
2018-12-20 16:30:40 -08:00
Treehugger Robot
b0b0f62ced Merge "Remove unnecessary warning suppression from libdm." 2018-12-20 23:15:16 +00:00
Treehugger Robot
713398f8bf Merge "Add librank2" 2018-12-20 21:58:49 +00:00
David Sehr
eb2dd20dc3 Enable building ATRACE stubs on Windows
The header contained inline functions that called unimplemented code on
Windows.  Enable building the implementations.

Bug: none
Test: make -j 50 checkbuild
Change-Id: I11b39e6f5c72fc000088182f3631a9f538474c42
2018-12-20 13:46:08 -08:00
Alex Buynytskyy
a9e79489dc Minor refactor to support strings with embedded zeros.
Test: manual
Change-Id: Iaece3003deb257cbcae65a23a4c4a1ccfd690d49
2018-12-20 10:11:15 -08:00
Tom Cherry
b5a5c31093 Merge "improve LogBufferElement copy constructor" 2018-12-20 18:03:59 +00:00
Sandeep Patil
e9f8eb46e3 Remove unnecessary warning suppression from libdm.
Fixes: 110035986
Test:  mma -j builds without errors or warnings

Change-Id: Id00f844ad75c3ee2ebb9f47eebc7976bc40bdf59
Signed-off-by: Sandeep Patil <sspatil@google.com>
2018-12-20 09:31:05 -08:00
Treehugger Robot
d1ff11b94a Merge "Create staging directory for Staging Manager." 2018-12-20 17:10:25 +00:00
Sandeep Patil
2aeaaebc49 Add librank2
Identical with librank, but written using libmeminfo.

Bug: 114325007
Bug: 111694435
Test: librank2
Test: librank2 -m rx
Test: librank2 -m rx -P /system/lib64
Test: librank2 -u -P /system/lib
Test: librank2 -R -m rx

Change-Id: Ib6ecb601a0b6ecb5b4b75285f772586e05ae388a
Signed-off-by: Sandeep Patil <sspatil@google.com>
2018-12-20 09:01:40 -08:00
Christopher Ferris
a39aaf91eb Remove CHECK in AdjustEncodedValue.
The CHECK(encoding != DW_EH_PE_aligned) can trip given the right
arguments. This check isn't necessary, since the code will return
false in that case.

Add new unit test that tries all values to make sure no CHECK fires.

Bug: 120968571

Test: Passes new unit test, and passes fuzzing that failed before.
Change-Id: I062bcd18508c75cd3a4ca9dd12f922e25aafda8a
2018-12-20 08:40:58 -08:00
Jintao Zhu
d3987a9624 logd: improve logd prune
upon memory usage high(>log_buffer_size), logd will try to prune(erase) all those old log elements which have been read by all readers for reclaiming the memory.  As such, a too slow reader will be a hinder to the success of the prune.  Logd has to try to kick-out the slow-est reader when memory usage is really too high(>2 * log_buffer_size).  But the kick-out operation is just a request to the reader and at what time the reader will exit is always uncertain, beyond control.  Furthermore, if you kick-out reader-A, waiting for A to exit; then, another reader-B may come in; then A exit; and then you kick-out-B, waiting for B to exit; and then, ...loop for ever: yes, logd may find that there seems to be always a slow reader hinder its pruning.  As we all know, that, logd will probably kick-out a slow reader(logcat), hence, indeed, almost all log capturing tools will try to re-connect logd immediately after it being kick-out-ed.  Such retry makes the issue easy to happen.  And, we observed that the reader thread may often be blocked by socket write operation, which hindering its exiting and hereby hindering the prune progress.  We need gracefully shutdown socket to relieve it from blocking and eventually stop such disaster from happening.

Test: monkey test for one day and one night

Change-Id: I5496ff74168b71e261914b91c145aa44814a5def
2018-12-20 23:35:54 +08:00
Dario Freni
22cdf96697 Create staging directory for Staging Manager.
Staging Manager is a high-level service (yet to be committed) that
manages multi-package sessions requiring a reboot to be applied, for
example if one of the packages is an APEX file. This directory will
contain the session data and the temporary copies of the packages.

Bug: 118865310
Test: N/A
Change-Id: I8aceefab849cf5af17086cb6868b801d1c2615e9
2018-12-20 15:24:18 +00:00
Martin Stjernholm
8478e56580 Merge "Revert^2 "Use libdexfile external API in libunwindstack."" 2018-12-20 11:34:26 +00:00
Elliott Hughes
ef4c29886c Merge "Build libbase with _FILE_OFFSET_BITS=64." 2018-12-20 00:47:38 +00:00
Yifan Hong
3fff9fbe00 Merge changes from topic "vintf_object_recovery_mount"
* changes:
  Move parts of roots.cpp from librecovery
  fs_mgr_do_mount_one: allow overriding mount_point
2018-12-19 22:19:52 +00:00
Tom Cherry
38ff80810a Merge "fs_mgr: Fix kernel command line parsing" 2018-12-19 21:28:35 +00:00
Martin Stjernholm
bb4f2b440a Revert^2 "Use libdexfile external API in libunwindstack."
This reverts commit cacf5bf6bc.

Reason for revert: Re-apply with proper fix for VNDK visibility on marlin and sailfish.

Test: Manual repro of http://b/121110092#comment1 on reported branch
Test: atest CtsRenderscriptTestCases
Test: mmma system/core/{libunwindstack,libbacktrace}, run host gtests
Test: Make image, flash, and reboot device.
Test: Forrest cts/art/gce-all: https://android-build.googleplex.com/builds/forrest/run/L00300000240828791
Test: Forrest cts/bionic/gce-all: https://android-build.googleplex.com/builds/forrest/run/L05600000240682947 (shows 27/2958 failed, but it doesn't pass on Blackbox either: http://screen/xbjioEf6UgR)
Test: Forrest cts/renderscript/gce-all: https://android-build.googleplex.com/builds/forrest/run/L66200000240680523
Bug: 119632407
Change-Id: I601aa97eac8127e30d753405f8bc1fc4ae7f849f
2018-12-19 21:04:35 +00:00
Elliott Hughes
9082e7af37 Build libbase with _FILE_OFFSET_BITS=64.
sehr points out that we already have two bugs caused by not doing this:
file.cpp has a call to pread with an off64_t that gets truncated, and
mapped_file.cpp does similar with mmap.

Bug: N/A
Test: ran tests
Change-Id: Ia098a836457e5adf109541235ad71c0ad7219da8
2018-12-19 12:55:17 -08:00
Yifan Hong
bf80e7dd91 Move parts of roots.cpp from librecovery
Move some mounting functionalities from librecovery so that
other modules can also mount logical partitions correctly.

- Also, refactor to use C++ Fstab struct.
- Also, fixed CreateLogicalPartitions() to take full path of
super device.

Test: run recovery tests
Test: vintf_object_recovery_test

Bug: 118634720
Bug: 113182233
Bug: 62292478
Change-Id: Ie02c3a941ed801fdae5818099faf5f3863444296
2018-12-19 10:23:50 -08:00
Yifan Hong
0cd2d5f048 fs_mgr_do_mount_one: allow overriding mount_point
Test: boots
Bug: 118634720
Change-Id: Ie2d05fdead27bfb1c922749272ff648bc7c418d1
2018-12-19 10:23:50 -08:00
Ruslan Trofymenko
23249c9fc5 fs_mgr: Fix kernel command line parsing
Remove new line character ('\n') from the kernel command line after
reading from '/proc/cmdline'. This character is not contained in the
original string and is added as a result of reading (according to
kernel source codes [1]):

    ...
    seq_puts(m, saved_command_line);
    seq_putc(m, '\n');
    ...

As a result, this may corrupt the last argument of the string. For
example, if the last argument is 'androidboot.slot_suffix=_a', then the
target partition ('vendor_a\n') will not be found in fstab section of
the device tree.

[1] fs/proc/cmdline.c

Change-Id: I96a853f1f55f27d782afe2ca8c0b006a75368149
Signed-off-by: Ruslan Trofymenko <ruslan.trofymenko@linaro.org>
2018-12-19 20:03:10 +02:00
Treehugger Robot
1baa19b1a6 Merge "Fix offsets when shared lib split across maps." 2018-12-19 17:11:53 +00:00
Sandeep Patil
2d04ce3b5a dmctl: Add verbose 'dmctl list devices'
This adds an option to list device mapper devices including their
current target table. Useful to be included in bugreport to
map the logical partitions metadata with actual device mapper setup.

Bug: 120916687
Test: dmctl list devices -v

Change-Id: I091666506d24372d1e111ffa1c0256c8bbff0c5e
Signed-off-by: Sandeep Patil <sspatil@google.com>
2018-12-19 08:51:59 -08:00
Treehugger Robot
613674049f Merge "Propagate dlopen errors to callers of OpenNativeLibrary." 2018-12-19 15:36:25 +00:00
Jintao Zhu
245fb369b1 improve LogBufferElement copy constructor
LogBufferElement copy constructor supported only partial function.

Solution: handle all cases.

Test: unit test for calling the copy constructor with all possible states.
Change-Id: I55091569d98eb35a09b4c3fc068836ecd256558c
2018-12-19 22:20:12 +08:00
Lorenzo Colitti
95a8d0d0c7 Merge "Allow dlopen()ing libraries from the netd APEX." 2018-12-19 14:19:41 +00:00
Pete Bentley
632f142c42 Propagate dlopen errors to callers of OpenNativeLibrary.
Bug: 119867084
Test: make && flashall
Change-Id: If98082db39796f0097ce7ef1d095c9f202c3a95e
2018-12-19 13:48:01 +00:00
Lorenzo Colitti
472c900f6b Allow dlopen()ing libraries from the netd APEX.
This is a workaround to allow us to use libnetd_resolv.so from
the resolver APEX before b/120661824 is fixed.

We cannot put the APEX into the search path due to b/120661824,
but we can put it into the permitted path,

Test: builds, boots
Test: system/netd/tests/runtests.sh
Test: atest FrameworksNetTests android.net.cts.ConnectivityManagerTest
Change-Id: Ia68df860b7edc92180284f62736146e6029d7655
2018-12-19 16:52:06 +09:00
Treehugger Robot
5ffa70ec4f Merge "Revert "Use libdexfile external API in libunwindstack."" 2018-12-19 02:30:27 +00:00
Remi NGUYEN VAN
354d5f27ff Merge "Add UID for network stack app" 2018-12-19 02:01:23 +00:00
Martin Stjernholm
cacf5bf6bc Revert "Use libdexfile external API in libunwindstack."
This reverts commit 444e23d2fc.

The rest of the topic doesn't need to be reverted.

Reason for revert: Breaks renderscript on marlin and sailfish.

Test: Manual repro of http://b/121110092#comment1 on reported branch
Test: "atest CtsRenderscriptTestCases" on that branch
Test: mmma system/core/{libunwindstack,libbacktrace}, run host gtests
Test: Make image, flash, and reboot device.
Bug: 121110092, 119632407
Change-Id: If1976b19ce386c95bc5bd4fd6d523745c167de18
2018-12-19 00:11:04 +00:00
Treehugger Robot
796e61c279 Merge "Log the last error code of StatsLog failures" 2018-12-18 23:28:12 +00:00
Treehugger Robot
958a669e58 Merge "zip_archive.cc: add O_CLOEXEC" 2018-12-18 22:49:32 +00:00
Tri Vo
96b8ce7228 Merge "init: support loading /product/etc/selinux/product_sepolicy.cil" 2018-12-18 21:13:27 +00:00
Nick Kralevich
3bdf744a55 zip_archive.cc: add O_CLOEXEC
Prevent file descriptors from leaking across an exec() boundary.

Bug: 120983106
Test: compiles and boots
Change-Id: I392b0767674b557b1e4404a2ba63bc48e3e37b24
2018-12-18 12:48:06 -08:00
Christopher Ferris
a09c4a6ff2 Fix offsets when shared lib split across maps.
The linker was modified so that a shared library has a read-only
map, then a read-execute map to represent the whole shared library.
When backtraces are created, then the offsets are set incorrectly
for backtraces. For example, all backtraces wind up with an offset now,
and a shared library loaded out of an apk shows the wrong offset.

Changes:
- Fix the FormatFrame function which was putting the offset before the
  map name.
- Refactor the Maps and MapInfo classes to keep track of the previous map
  instead of all maps. This was the only map that was ever needed.
- Modify the unwind_for_offline tool to capture both the read-only and
  read-execute map when using the read-only segment option.

Bug: 120981155

Test: Updated unit tests pass.
Test: Unwinds on device don't show the offsets everywhere any more.
Change-Id: I75b3727221be9c20316dfdcd7a1c6d242d7ce948
2018-12-18 11:22:14 -08:00