Commit graph

28600 commits

Author SHA1 Message Date
Elliott Hughes
0c0afe17e9 Merge "Move off the Next ZipString overload." 2019-05-23 17:55:27 +00:00
Treehugger Robot
1b7d236e56 Merge "Disable native_coverage for scudo-related libraries" 2019-05-23 17:19:32 +00:00
Jiyong Park
b66a78b2aa linker namespace name is duped when the namespace is created
A linker namespace lives longer than its caller. It is never deleted
once created in a process. Currently, the pointer to the name is simply
copied which results dangling reference when the name is actually from
temporary objects like std::object. Fixing the issue by strdup'ing the
name upon namespace creation.

Bug: 130388701
Test: atest CtsJniTestCases; the log does not show broken error messages
like
unexpected dlerror: dlopen failed: library "/system/lib64/android.frameworks.cameraservice.common@2.0.so" needed or dlopened by "/data/app/android.jni.cts-HP6GyGXYy5honHQAffUXgw==/lib/arm64/libjnitest.so" is not accessible for the namespace " mT?"

Change-Id: I25d9d76f8520f490755c189ded5659e6c9741f79
2019-05-23 23:58:12 +09:00
Pirama Arumuga Nainar
17e7c75265 Disable native_coverage for scudo-related libraries
Bug: http://b/133379274
Bug: http://b/133322197

Test: coverage-enabled mediaextractor, which uses scudo, no longer
crashes during llvm_gcov_init.

Change-Id: I85a0cc91a2fbd8433823769c3032ec2591424e55
2019-05-22 22:18:37 -07:00
Elliott Hughes
127a706581 Move off the Next ZipString overload.
Bug: http://b/129068177
Test: treehugger
Change-Id: I83840c2ffd6cdede8cb34b4ec168427a43e1daf7
2019-05-22 18:50:53 -07:00
Christopher Ferris
705de3c639 Disable malloc debug when asan enabled.
Bug: 123312263

Test: Verified with asan enabled, malloc debug does not initialize.
Test: Ran tests on non-asan build and verify they pass.
Change-Id: I3c37c170bf6c1de42740972f2113ae991351d931
2019-05-22 17:16:37 -07:00
Christopher Ferris
933bd3ae66 Merge "Update to kernel headers to v5.1.3." 2019-05-22 19:09:12 +00:00
Treehugger Robot
d277334059 Merge "Export some symbols for vendor libmemunreachable" 2019-05-21 22:51:26 +00:00
Treehugger Robot
e1276ba538 Merge "pwd/grp: fix pwd _r reentrancy, new tests, clean up" 2019-05-21 18:29:33 +00:00
Christopher Ferris
03345ed54a Merge "Keep .debug_frame on arm 32." 2019-05-21 18:09:08 +00:00
Treehugger Robot
f8813d14aa Merge "Limit threads in pthread_leak#detach for low power devices." 2019-05-21 02:15:30 +00:00
Christopher Ferris
dcc855456e Merge "Temporarily disable unwind through signal test." 2019-05-20 20:15:13 +00:00
Christopher Ferris
24f97eb27b Update to kernel headers to v5.1.3.
Test: Builds and boots taimen.
Test: Ran bionic unit tests.
Change-Id: Ieaca8709d568f075df8cac60c9da2c0ed1916963
2019-05-20 12:58:13 -07:00
Christopher Ferris
035988ffb4 Temporarily disable unwind through signal test.
On cf_x86_phone-userdebug, both of the unwind through signal
tests fail. This has been failing forever, but seems to have suddenly
become an issue, so disable while I try to figure out why this is happening.

Bug: 132763120

Test: Ran on emulator and verified tests are skipped.
Change-Id: Iafc227d972a7783e94c701d73078c9570cea288e
Merged-In: Iafc227d972a7783e94c701d73078c9570cea288e
(cherry picked from commit d424fafbce)
(cherry picked from commit fe0fbcff7f)
2019-05-20 12:33:09 -07:00
Christopher Ferris
0c0f6fb293 Keep .debug_frame on arm 32.
The arm exidx unwind information can be sparse and clang is producing
functions that cannot be properly represented. The .debug_frame includes
extra unwind information that covers the cases that are not complete, so
do not remove it. For example, the __strchr_chk function has a push
in the middle of the function, so any crash before that instruction will
not unwind properly.

This does increase the size of libc.so, but only by about 80,000 bytes.

Bug: 132992102

Test: Verified the .debug_frame exists in libc.so only for arm32.
Test: Used the unwind_reg_info to verify that __str_chk gets proper
Test: unwind info. Also use unwind_reg_info on some assembler functions
Test: to make sure that there is no overlapping information.
Change-Id: If9a6de15b3adf08a93c4563da8c89846e4dd059b
2019-05-17 17:52:51 -07:00
Colin Cross
b9667b51a8 Export some symbols for vendor libmemunreachable
Add the malloc symbols used by libmemunreachable to the VNDK, and
make libc_malloc_debug_backtrace vendor_available.

Bug: 132302484
Test: m checkbuild
Change-Id: Ide555195afa084c13eaeaf0eab6ff90787b5f2d0
2019-05-17 14:26:31 -07:00
Treehugger Robot
72aafad950 Merge "Don't resolve already resolved paths when parsing ld.config.txt" 2019-05-17 04:15:41 +00:00
Peter Collingbourne
8bb97d7781 Merge "Add bootstrap directory to bootstrap linker's search path." 2019-05-17 02:26:29 +00:00
Jiyong Park
341b61e694 Don't resolve already resolved paths when parsing ld.config.txt
When parsing ld.config.txt, paths in *.search.paths properties are
resolved using resolved_paths(). This is causing a number of newfstatat
system calls during a process start-up and is contributing about 3.6%
of the entire linker initialization time.

Optimize the overhead by not resolving already resolved paths; resolved
paths are cached.

Bug: 132348336
Test: strace -C -e newfstatat ls shows the number of the syscalls is
reduced from 131 to 99
Test: simpleperf record --call-graph fp -f 10000000 -o /data/perf.data ls
simpleperf report -g -i /data/perf.data
shows percentage of get_paths() from 2.9% to 2.5%

Change-Id: I79823255a89f6e2a63b80c74e6768850276ab536
2019-05-17 10:09:13 +09:00
Peter Collingbourne
ea11be0cc8 Add bootstrap directory to bootstrap linker's search path.
A proposed set of changes:
https://android-review.googlesource.com/q/topic:"no-dup-hwasans"

will cause the HWASAN runtime to be moved from /system/lib64 to
/system/lib64/bootstrap. This causes a problem in the case where libc is built
with HWASAN but init is not built with HWASAN. In this case, libc.so will have
a DT_NEEDED dependency on the HWASAN runtime but init will not. Currently,
init and other bootstrap executables arrange to load bootstrap libraries by
setting rpath, but rpath only has an effect on libraries directly depended
on by the main executable, not libraries indirectly depended on by it. This
means that the loading of the HWASAN runtime will fail.

Instead of relying on rpath to find the bootstrap libraries, modify the
bootstrap linker so that it searches the bootstrap library directory after
searching the rpath.

Change-Id: I297be32e04ecd316ee12b8e694588e1249e2bb89
2019-05-16 16:10:41 -07:00
Haibo Huang
b43f0b7993 Merge "libc: import ARM strcmp from newlib" 2019-05-16 19:28:11 +00:00
Vic Yang
d8bef67153 Staticlly allocate string buffers for realpath_fd()
Creating two huge buffers with std::vector, as it is now, is very
expensive, because it ends up being satisfied with mmap()/munmap().
Instead, we statically allocate a large string buffer while resizing
the other one to be a smaller and more appropriate size so that it can
be placed on the stack.

Note that this does mean that we increase linker data segment by 4KB
and that increases the overall system memory usage by about 400KB.
However, since that additional page is mostly zeroed with only some
ASCII text, it should be fairly easy to compress when it's swapped out
to ZRAM.

Test: Run with strace and observe no mmap/munmap around readlinkat().
Test: Measure average linker time of starting cameraserver on a Go
      device and see ~3% speed-up.
Bug: 132783386

Change-Id: I600cc7a92be316ef67440a9a28c05d18de229f6c
2019-05-16 12:10:10 -07:00
Jake Weinstein
bff53b2617 libc: import ARM strcmp from newlib
* Current version is also based on newlib, but an older revision

* The Krait and A9 specific changes no longer seem relevant, so
  let's use A15 directly.

Tested on OnePlus 3 (MSM8996):

Before (Krait strcmp):
                                       iterations      ns/op
BM_string_strcmp/8                          1000k         24    0.322 GiB/s
BM_string_strcmp/64                           20M        123    0.519 GiB/s
BM_string_strcmp/512                           2M        920    0.556 GiB/s
BM_string_strcmp/1024                       1000k       1818    0.563 GiB/s
BM_string_strcmp/8Ki                         200k      14405    0.569 GiB/s
BM_string_strcmp/16Ki                        100k      28762    0.570 GiB/s
BM_string_strcmp/32Ki                         50k      57526    0.570 GiB/s
BM_string_strcmp/64Ki                         10k     114959    0.570 GiB/s

After:
                                       iterations      ns/op
BM_string_strcmp/8                          1000k         28    0.284 GiB/s
BM_string_strcmp/64                           20M        107    0.596 GiB/s
BM_string_strcmp/512                           2M        800    0.639 GiB/s
BM_string_strcmp/1024                       1000k       1579    0.649 GiB/s
BM_string_strcmp/8Ki                         200k      12469    0.657 GiB/s
BM_string_strcmp/16Ki                        100k      24931    0.657 GiB/s
BM_string_strcmp/32Ki                         50k      49843    0.657 GiB/s
BM_string_strcmp/64Ki                         20k      99635    0.658 GiB/s

Test: bionic-benchmarks BM_string_memcmp
Change-Id: Icb3bfb0a381bcc1e10885ca5e9547842c3f620d7
2019-05-16 04:37:26 +00:00
Tom Cherry
c57c5bdb7f pwd/grp: fix pwd _r reentrancy, new tests, clean up
getpwnam_r() and getpwuid_r() clobber the storage used by getpwnam()
and getpwuid().  This isn't likely to be a big issue, but since we do
this right for the group functions, fix this as well as add a test.
Both use more space in buf than is actually required, but well below
their sysconf() suggested values, so we accept that to keep the code
concise.

Add tests for dealing with unaligned input buffers, particularly for
getgrnam_r() and getgrgid_r(), as they require alignment but this
wasn't being tested.

Refactor common initialization code for both passwd and group state
structs.

Remove extraneous null pointer checks; the values they were testing
were offsets of a previous pointer, so guaranteed to never actually be
null.  If the underlying pointer is actually null, we're beyond repair
anyway, so accept that we'll crash.

Test: pwd/grp unit tests

Change-Id: I60c4d00e9ab3cf55daf8314c5029fd914025b696
2019-05-15 15:49:34 -07:00
Josh Gao
3d64506c02 Merge "Annotate no_return and returns_twice functions."
am: 93f79a1a5b

Change-Id: I0e77cc78696f7dcf91f63220422a1d7c5088d51b
2019-05-15 13:59:11 -07:00
Josh Gao
93f79a1a5b Merge "Annotate no_return and returns_twice functions." 2019-05-15 20:26:46 +00:00
Xin Li
c3cfb94466 DO NOT MERGE - Merge pi-platform-release (PPRL.190505.001) into stage-aosp-master
Bug: 132622481
Change-Id: Ie8ba6a818bbe0d9d982624eb5e8cd9cb618827b1
2019-05-13 15:38:40 -07:00
Josh Gao
3403315521 Annotate no_return and returns_twice functions.
When building the bionic tests, we use -fno-builtins, which turns off
clang's recognition of vfork as a magical function that can return
twice. Explicitly annotate our returns_twice functions to ensure that
we generate correct code even in -fno-builtins (and while we're at it,
annotate the no_return functions as well, so we generate faster code).

Bug: http://b/131856005
Test: treehugger
Change-Id: I465f8042a965f0c7c03caa5f17af67deea8f5d9d
2019-05-13 13:17:51 -07:00
Elliott Hughes
36f53ef0eb Merge "bionic_tests_zipalign: don't explicitly specify no prefix/suffix."
am: 235ccfd19b

Change-Id: I2849e9c6374785e03c5d9d85d39e6ed957ec013e
2019-05-10 18:47:54 -07:00
Treehugger Robot
235ccfd19b Merge "bionic_tests_zipalign: don't explicitly specify no prefix/suffix." 2019-05-11 01:22:26 +00:00
Elliott Hughes
be6c641141 bionic_tests_zipalign: don't explicitly specify no prefix/suffix.
Bug: http://b/129068177
Test: treehugger
Change-Id: If061ba04a0b3396898b6150d8fb1a8c27abb03f8
2019-05-10 16:59:13 -07:00
Dmytro Chystiakov
a339233629 Limit threads in pthread_leak#detach for low power devices.
This patch decreases created threads to 90 (instead of 100)
on devices with 2 cores CPU. This test can fail with timeout
on such devices.

Bug: b/129924384
Test: Run CtsBionic module on 2 core device with command
	"run cts -m CtsBionicTestCases"

Change-Id: Ic770006a324748d7d6dfbe8d4fb301e21e494ff9
Signed-off-by: Dmytro Chystiakov <dmytro.chystiakov@intel.com>
2019-05-10 16:44:49 -07:00
Elliott Hughes
4d00ebc652 Merge "linker: support ldd(1)-like behavior via --list."
am: 96babde2e4

Change-Id: Icc8ece4ed2f58ad4265c53b7c0a8c3cc78bc2356
2019-05-10 08:45:52 -07:00
Elliott Hughes
96babde2e4 Merge "linker: support ldd(1)-like behavior via --list." 2019-05-10 15:35:24 +00:00
Elliott Hughes
90f96b9f48 linker: support ldd(1)-like behavior via --list.
Given that we have both linker and linker64, I didn't really want to have
to have ldd and ldd64, so this change just adds the --list option to the
linkers and a shell script wrapper "ldd" that calls the appropriate
linker behind the scenes.

Test: adb shell linker --list `which app_process32`
Test: adb shell linker64 --list `which date`
Test: adb shell ldd `which app_process32`
Test: adb shell ldd `which date`
Change-Id: I33494bda1cc3cafee54e091f97c0f2ae52d1f74b
2019-05-09 22:12:17 -07:00
George Burgess IV
c67f59fd15 Merge "tests: use clang's -verify instead of FileCheck"
am: af68f04e44

Change-Id: I5fe492fe0ad838a91792b7d259c1e30ea2792de7
2019-05-09 14:26:39 -07:00
George Burgess IV
af68f04e44 Merge "tests: use clang's -verify instead of FileCheck" 2019-05-09 20:29:27 +00:00
Christopher Ferris
e4a24f0fa2 Merge "Add removed platform functions used by apps."
am: 8106319006

Change-Id: I624bb17ac4cf12678ea1d110f0a349b2f45714ad
2019-05-08 19:30:58 -07:00
Christopher Ferris
8106319006 Merge "Add removed platform functions used by apps." 2019-05-09 01:09:21 +00:00
Christopher Ferris
23c056dbcb Add removed platform functions used by apps.
Added get_malloc_leak_info and free_malloc_leak_info for arm 32 bit
only so that the kindle app will continue to run.

Bug: 132175052

Test: Ran kindle app, read pdf file. Verified libKindleReaderJNI.so
Test: is loaded in memory properly.
Change-Id: Ib1ea3a37b3729f9bcc2739c5f3a584ea8f66d200
Merged-In: Ib1ea3a37b3729f9bcc2739c5f3a584ea8f66d200
(cherry picked from commit 235f35a266)
2019-05-08 15:43:25 -07:00
Christopher Ferris
84c29cc446 Merge "Avoid using malloc debug code after exit."
am: f15a00b1ec

Change-Id: Ia4681ead4bfb6b7543f32b8d39fb8998d9d36296
2019-05-07 15:45:36 -07:00
Christopher Ferris
f15a00b1ec Merge "Avoid using malloc debug code after exit." 2019-05-07 22:28:50 +00:00
Elliott Hughes
fbb1a0b029 Merge "Add SEEK_DATA and SEEK_HOLE constants."
am: 1a60589b97

Change-Id: I6dd7a65058dc03b10e01c14c448e8c8741652834
2019-05-07 14:55:28 -07:00
android-build-team Robot
245e08f39e Snap for 5450365 from dad73ef232 to pi-platform-release
Change-Id: I289817ccda4f870697efe5a044376a43988fad1f
2019-05-07 21:53:27 +00:00
Elliott Hughes
1a60589b97 Merge "Add SEEK_DATA and SEEK_HOLE constants." 2019-05-07 20:57:28 +00:00
Christopher Ferris
d269fcc935 Avoid using malloc debug code after exit.
I wrote a new unit test that would fail on the old version of the
code.

On a walleye big cpu, this costs about 40ns-50ns (going from ~430ns to ~480ns).
I think this is an acceptable performance degradation.

Bug: 131867816

Test: New unit tests pass.
Change-Id: I4c0f4373fb0694bf29c3824dbb1224a8a17e211e
2019-05-07 13:16:58 -07:00
Elliott Hughes
31c7309dc6 Add SEEK_DATA and SEEK_HOLE constants.
Without pulling in <linux/fs.h>, the UAPI source of these constants,
because it's full of pollution, in particular a macro called BLOCK_SIZE
that breaks a lot of stuff.

Test: treehugger
Change-Id: I7258ec57e91c67645c2b4d0ce44850d757c4bb12
2019-05-07 10:03:02 -07:00
Dimitry Ivanov
dc3f2a5d19 Merge "Enable native_bridge_support"
am: 78e42d81ec

Change-Id: I26a3935f20e27c834a84cec245f4f700ae96244e
2019-05-07 04:39:19 -07:00
Dimitry Ivanov
78e42d81ec Merge "Enable native_bridge_support" 2019-05-07 11:30:58 +00:00
Florian Mayer
dd6166e636 Merge "Match maximum command line size for startup tracing."
am: 0633e569bc

Change-Id: Idfb2a50e4caea03b6c388f5a7daa5fc737108856
2019-05-07 03:43:40 -07:00