Commit graph

45095 commits

Author SHA1 Message Date
Jiyong Park
6291da2936 move classes out of native_loader.cpp
native_loader.cpp is too crowded. Move the classes
NativeLoaderNamespaces and LibraryNamespaces out of native_loader.cpp to
their own source files.

This change does not alter any functionality.

Bug: 130388701
Test: m, presubmit tests
Change-Id: Ibc61ec0dc6727af7cac865b1971ebf1befac6855
2019-05-04 01:10:42 +09:00
Treehugger Robot
84235b7137 Merge "Workaround bad markdown parser." 2019-05-03 00:40:29 +00:00
Stephen Hines
f35183daa6 Merge "Fix an unintialized return value." 2019-05-03 00:18:58 +00:00
David Anderson
9187a72175 Merge "fs_mgr: overlay: resize other OTA partitions to zero to make space" 2019-05-02 23:56:12 +00:00
Treehugger Robot
5ddd49eeae Merge "adbd: avoid starting multiple worker threads." 2019-05-02 21:09:04 +00:00
Mark Salyzyn
c3fc2aa964 fs_mgr: overlay: resize other OTA partitions to zero to make space
If we do not have at least the minimum space to create a scratch
partition, let's resize the other partitions to zero to make the
space and try again.

Specify additional shared library dependencies for remount command.
margin_size could never be calculated because "scratch" partition
does not exist, so use super partition instead as argument to
GetBlockDeviceInfo.

Add a "Now reboot your device for settings to take effect" message
if the -R argument was not supplied.  Adjust some of the messages
to be clearer.

Manual test: On a full DAP device, resize or flash both a and b side
for system, vendor and product with fastboot to duplicate failure
conditions of limited space and check remount command resizes other
side partitions to mitigate.

Test: manual and adb_remount_test.sh
Bug: 131390072
Change-Id: I34c4a973f88a5e1e06b64af9589a84721dd1bbbd
2019-05-02 13:46:22 -07:00
Stephen Hines
45b11d9035 Fix an unintialized return value.
Bug: http://b/131390872
Test: Built aosp_blueline successfully.
Change-Id: Iea5255be280dfc089a95fc25a0f988e913c18679
2019-05-02 12:54:09 -07:00
Dan Albert
989467d94a Workaround bad markdown parser.
Test: None
Bug: None
Change-Id: I7b2dd6e140aafdf41bfa58516851bfd50eba5e00
2019-05-02 12:25:22 -07:00
Treehugger Robot
6bc132846a Merge "adb: increase adb [un]root timeout." 2019-05-02 15:53:20 +00:00
Martin Stjernholm
2d3becd361 Merge "Reland: Fix libnativeloader to correctly link to the platform namespace." 2019-05-02 10:40:04 +00:00
Treehugger Robot
7a7c71b2b6 Merge "adbd: compile a static version." 2019-05-02 04:20:24 +00:00
Josh Gao
ef4a999343 adb: increase adb [un]root timeout.
3 seconds isn't generous enough, because if we're rapidly restarting
(e.g. `adb root; adb unroot`), init will wait 5 seconds to restart us.

Test: `adb root && adb unroot`
Change-Id: I353e8d1ee14f3b08416445ff627dea4a49afd9a4
2019-05-01 18:53:43 -07:00
Josh Gao
bde8c848d8 adbd: compile a static version.
Test: mma
Change-Id: I785de074f9b5cc63d1804420b734c4b07081a716
2019-05-01 18:25:52 -07:00
Josh Gao
910ce0ff08 adbd: avoid starting multiple worker threads.
A previous patch intended to make receiving multiple FUNCTIONFS_ENABLEs
non-fatal, but failed to do so because we would try to spawn another
worker thread and hit a different assertion.

Bug: http://b/130638368
Test: echo mem | adb shell "su 0 sh -c 'cat > /sys/power/state'"
Change-Id: I53456112244d8b4f7d26df6ec6961389fca70498
2019-05-01 17:27:27 -07:00
Martin Stjernholm
c57ed29dd5 Reland: Fix libnativeloader to correctly link to the platform namespace.
This relands http://r.android.com/951440:

This affected binaries in the Runtime APEX, where the platform namespace is
"platform" rather than "default".

Also extend ANDROID_ADDITIONAL_PUBLIC_LIBRARIES to create links to both to
platform and runtime namespaces, so that it can be used to open up access to
internal libraries in the Runtime APEX as well, which is used by ART gtests
and run tests.

Also update some comments in the ld.config*.txt files to accurately explain
why some namespaces need to be visible, and some other minor changes for
consistency. There are no semantically significant changes in those files.

Test: Flash and boot
Test: Run an ART run test with the internal libarttest.so library
Test: lunch aosp_cf_x86_phone-eng;
  atest android.compilation.cts.AdbRootDependentCompilationTest#testCompile_curProfile \
    com.android.cts.dexmetadata.InstallDexMetadataHostTest#testProfileSnapshotAfterInstall \
    installd_dexopt_test
Bug: 130293232
Bug: 121117762
Change-Id: I3d9f2102a03e83843e15bc78b5ad347220c52769
2019-05-01 16:46:06 +01:00
Martin Stjernholm
cc30f4d7dd Merge "Add linker entries for the new libdexfiled_external.so." 2019-05-01 14:30:35 +00:00
Zimuzo Ezeozue
e9252285ef Merge "Attempt native rollback for frequent crashes before boot completed" 2019-04-30 22:57:39 +00:00
Martin Stjernholm
8a50dad467 Add linker entries for the new libdexfiled_external.so.
Follow up to http://r.android.com/943476. This library is only available in
debug builds of the Runtime APEX.

Test: Flash and boot with eng build
Change-Id: I260f9b838f44ba3f8976c117d9e42fc456239e88
2019-04-30 16:11:30 +01:00
Zimuzo
88de80fc53 Attempt native rollback for frequent crashes before boot completed
Before, if updatable processes crash 4 times in 4mins, a native
rollback will be attempted. This behavior does not detect
system_server early boot deadlocks because the system server requires
at least a min to detect a deadlock, and crash itself. The crashes
don't happen frequently enough for init to detect.

After, this cl, the old behavior exists and additionally, init detects
*any* 4 crashes of updatable processes before boot completed,
regardless of if they happen within 4mins or not.

Test: Manually tested by adding artificial sleep in system_server so
deadlock is triggered before boot. system_server crashes 4 times in
over 4mins and the ro.init.updatable_crashing prop is set to 1.
Bug: 129597207

Change-Id: Ie6fb5693ff4be105bcbe139c22850fb076e40260
2019-04-30 11:19:19 +00:00
Jim Blackler
446014ecf9 Merge "Allow memory metrics on devices that use kernel LMK" 2019-04-30 10:05:42 +00:00
Treehugger Robot
68cf801ad9 Merge "Revert "Fix libnativeloader to correctly link to the platform namespace."" 2019-04-30 00:13:22 +00:00
Tom Cherry
6682d3bbba Merge "liblog: display valid utf8 characters with 'printable' log format" 2019-04-29 23:17:12 +00:00
Treehugger Robot
fe6cc3e2d3 Merge "adb: restore generation of public key in adb keygen." 2019-04-29 22:31:17 +00:00
Martin Stjernholm
b9259a9cbe Revert "Fix libnativeloader to correctly link to the platform namespace."
This reverts commit 4ca0ca67bf.

Reason for revert: Breaks android.compilation.cts.AdbRootDependentCompilationTest#testCompile_curProfile and others: http://g/art-team/R2nEDA1Ka_s

Change-Id: Ia6285648133d21e61040efafc73cac97d702a7c4
2019-04-29 20:57:16 +00:00
Josh Gao
032989a2ba adb: restore generation of public key in adb keygen.
We don't need the public key to be generated at ~/.android/adbkey.pub,
but it's still useful to be able to generate the public key for use with
ADB_VENDOR_KEYS.

Bug: http://b/119634232
Test: manual
Change-Id: Iecd6ff1bba4af4ba142456034f3faf52bb9e017d
2019-04-29 12:36:32 -07:00
Tianjie Xu
56311071fe Merge "Support adb rescue wipe command" 2019-04-29 17:47:20 +00:00
Tom Cherry
9158984894 liblog: display valid utf8 characters with 'printable' log format
This started as a change to use mbrtowc() instead of
utf8_character_length() as mbrtowc() does everything that
utf8_character_length() intends to do, but is a libc function. The
change was further intended to add unit tests to ensure that these
functions operate as intended.

It turns out that utf8_character_length() returned an error for the
utf8 characters that I tested, so this also has the side effect of
allowing valid utf8 characters to be printed in the 'printable' log
format, which was the original intention.

Also, print the binary data as hex instead of octal, since it is a
more suitable choice.

Test: new unit tests, existing unit tests, logcat -v printable
Change-Id: I4cc95aee81519411ef47892ca74eb31117c972d2
2019-04-29 09:14:37 -07:00
Treehugger Robot
d21a090f79 Merge "Nativeloader: Restrict anonymous namespace creation" 2019-04-29 16:08:15 +00:00
Treehugger Robot
bce25d2363 Merge "Fix libnativeloader to correctly link to the platform namespace." 2019-04-29 15:08:52 +00:00
Martin Stjernholm
4ca0ca67bf Fix libnativeloader to correctly link to the platform namespace.
This affected binaries in the Runtime APEX, where the platform namespace is
"platform" rather than "default".

Also extend ANDROID_ADDITIONAL_PUBLIC_LIBRARIES to create links to both to
platform and runtime namespaces, so that it can be used to open up access to
internal libraries in the Runtime APEX as well, which is used by ART gtests
and run tests.

Also update some comments in the ld.config*.txt files to accurately explain
why some namespaces need to be visible, and some other minor changes for
consistency. There are no semantically significant changes in those files.

Test: Flash and boot
Test: Run an ART run test with the internal libarttest.so library
Bug: 130293232
Bug: 121117762
Change-Id: I7ebaf5370dd0f533b1bb5f0e67e7c3c1df48e512
2019-04-29 13:09:08 +01:00
Jim Blackler
3947c938a7 Allow memory metrics on devices that use kernel LMK
Bug: 130017100
Test: Tested manually
Change-Id: I37f6edb71decc1260bd521595842508926fa86aa
2019-04-29 11:02:51 +00:00
xunchang
c2265c5343 Support adb rescue wipe command
Support `adb rescue wipe` command on the host side. This command runs
under the rescue mode and wipes data (and cache/metadata).

Bug: 131037235
Test: run adb rescue wipe

Change-Id: Ib3a3f2d564cc19d0446540d616cc21489ba558c2
2019-04-26 10:37:13 -07:00
Andreas Gampe
b9df7d936c Nativeloader: Restrict anonymous namespace creation
Create the anonymous namespace only from a non-empty library path.

This is a better heuristic than the current "first-come" one. It
allows creating classloaders that are not directly related to an
app's "main" classloader, that is, do not have any library path.
This is the case, for example, for shared libraries, including
preloaded ones.

Longer-term, the anonymous namespace creation should be made
explicit, so that the framework can have full control.

Bug: 130623656
Test: m
Test: manual
Change-Id: I8251363b372e365d10ae09d23df93d76388ac7f9
2019-04-26 08:55:53 -07:00
Joseph Jang
67231474fe Merge "init: Add reboot timeout handler" 2019-04-26 08:23:06 +00:00
Misha Wagner
79474ce6f3 Merge "Add UID printing to tombstone headers" 2019-04-26 08:22:17 +00:00
josephjang
aaddf282ec init: Add reboot timeout handler
In order to prevent device stuck at reboot, we try to create shutdownt
monitor thread with a timeout (default 30s). It will dump init process
and blocked tasks call trace in last kmsg then trigger kernel panic to
reboot device.

Test: reboot device

bug: 128561401
Change-Id: Ieb400ab9fbd983544b61241a4f4b8aa2f4baa863
2019-04-26 06:02:09 +08:00
Ian Kasprzak
e30fe5fe89 Merge "Revert "Add a way to turn off unique_fd's operator int."" 2019-04-25 17:16:55 +00:00
Ian Kasprzak
2c58e1924a Revert "Add a way to turn off unique_fd's operator int."
This reverts commit 93d63c010a.

Reason for revert: b/131312539 - All aosp-master-with-phones phones failing boot / health check.

Change-Id: Id4239f93484b7d6b8d9bcd355a59cbd40d9766e2
2019-04-25 15:59:28 +00:00
Tom Cherry
81f5424560 Merge "liblog: remove LIBLOG_WEAK" 2019-04-25 15:43:36 +00:00
Josh Gao
0fcd9292c4 Merge "adbd: reduce queue depths." 2019-04-25 01:09:23 +00:00
Tom Cherry
927c3d9184 liblog: remove LIBLOG_WEAK
I'm not sure why I didn't remove this when I got rid of the other
functions marked as weak.

Test: build
Change-Id: I45e6bca7be0497e33be88d15afea8bb1d5165380
2019-04-24 17:24:23 -07:00
Treehugger Robot
8e6fb82af6 Merge "logd: remove SELinux dup handling" 2019-04-25 00:06:43 +00:00
Treehugger Robot
4b43299132 Merge "Fix a warning on namespace.media.link.default.shared_libs" 2019-04-24 23:16:37 +00:00
Josh Gao
971bae0bcf Merge "Add a way to turn off unique_fd's operator int." 2019-04-24 22:58:00 +00:00
Treehugger Robot
ee5083b3c7 Merge "adb: silence warning from libusb." 2019-04-24 22:46:28 +00:00
Treehugger Robot
e923e5ef62 Merge "adb: fix double close in wait-for-*." 2019-04-24 22:38:31 +00:00
Josh Gao
28293f16a8 adbd: reduce queue depths.
Each operation we submit results in a contiguous allocation in the
kernel which can trigger OOM-killing. Tune the queue depths to reduce
the chances of this happening, with a minimal impact on performance.

Bug: http://b/126582877
Test: ./benchmark_device.py with blueline
Change-Id: I4b0f83d54a9a9a69f0ab48322d78fb137c94dd35
2019-04-24 15:05:21 -07:00
Nick Kralevich
512a7bfd83 logd: remove SELinux dup handling
Remove the code which attempts to collapse multiple similar SELinux
denials into one denial. SELinux logs are already rate throttled by the
kernel
(https://android-review.googlesource.com/c/platform/system/core/+/941357
for example), so additional filtering here only adds complexity and may
result in SELinux denials being inappropriately suppressed or dropped.

Bug: 118815957
Test: atest logd-unit-tests
Change-Id: I611fa43dc56c99aa992aad002c16c742e6034e5c
2019-04-24 13:32:58 -07:00
Josh Gao
93d63c010a Add a way to turn off unique_fd's operator int.
unique_fd's implicit conversion to int has led to tons of problems (see
all of the overloads for close, fdopen, fdopendir, etc.). Add a switch
that can turn it off, and reduce the ridiculous amount of work to fix up
callers by introducing a borrowed_fd type that can be constructed from
either int or unique_fd.

Test: treehugger
Change-Id: If77cf5cbcaddacdaec5919a15b3520fb68f51a62
2019-04-24 12:59:42 -07:00
Elliott Hughes
4d89dc0f54 Merge "libion: convert a header file using update_all.py" 2019-04-24 19:24:32 +00:00